【Visual Python profiler】http://t
Sunday, May 22, 2016
10:21 PM
|
| | —- |
| Tags: #微博 |

网路冷眼
05/20/2016
【Visual Python profiler】http://t.cn/RGDoAe8 vprof 是一个为不同Python 程序特性提供丰富和交互可视化的包,对程序的运行时和内存使用进行可视化。它支持Python 2.7, Python 3.4, Python 3.5, BSD 授权许可发布。![计算机生成了可选文字: Flame chart pezchec . init_.py:106(<module... stscn . 226 sc l@ecé!} w .py: orthogonal basic.py:5(<module... (<module... miobase.py:7()... .py:3( init_.py:93()... Function name: [module] Location: Line number: 168 Time percentage: 14.6 % Cumulative time: 0.050955 s Time per call: 0.020272 s Primitive calls: 1 Ill ntco..w setup init_.py:l _ pylab.py:l() Object name: test/testscript.py (module) Total runtime: 0.34965599999999647s Total calls: 158982 Primitive calls. • 157123 l*ic..;• 'Gackend_bases.p... gure.... lot. 1901 in. ates.p... finance.py:8() ylab.py:217()](/uploads/projects/wsbo@ekqhd3/a908c6ee34f7f79dc4d8a2091a808803.jpeg)

![计算机生成了可选文字: Code heatmap Inspected modules test/ testscript. py test/ testscript . py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 import numpy import pylab import scipy.io dataset = scipy .io.10admat(‘test/ex7data2. mat’ x dataset[ def euclidean distance cxl, xz, yl, y2): um . s rt x EPS = 0.25 centroids = numpy. zerosCCK, 2)) for i in range(K): rand_i = numpy. random. random_integersCx. shape CO centroids[i] di stances = numpy. zerosCCx.shapeCØ], K)) distance_delta = numpy .ones(K) num_iter = history = C) while (distance_delta EPS) .all(): # Calculate distance to centroids. for i in range(x. shape : for j in range(K): distances[i, j) = euclidean_distance( # Pick closest cluster. point_clusters = distances . history. for i in range(K): Execution count: 1 300 prev_cent_x, prev_cent_y = centroidsCi, t], centroidsi, 1] centroidsCi , — numpy. , axis—O) distance_deltaCi] = eucl prev_cent_x, centroidsCi, 0], prev_cent_y, centroidsCi, 1]) num_iter 1 print( ‘ Algorithm converged in %s iterations % num—iter)
查看源微博
已使用 Microsoft OneNote 2016 创建。
