Last active
January 9, 2018 21:27
-
-
Save jnothman/2394b3e199438a500ed9c8f8c9e17500 to your computer and use it in GitHub Desktop.
Benchmarks for working_memory, i.e. https://github.com/scikit-learn/scikit-learn/pull/10280
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elapsed | n_features | n_samples | working_memory | ||
---|---|---|---|---|---|
0 | 259.7408814430237 | 100 | 40000 | 1 | |
1 | 263.6345293521881 | 100 | 40000 | 1 | |
2 | 263.4755172729492 | 100 | 40000 | 1 | |
3 | 32.214531898498535 | 100 | 20000 | 1 | |
4 | 32.38340449333191 | 100 | 20000 | 1 | |
5 | 32.6368203163147 | 100 | 20000 | 1 | |
6 | 4.7826080322265625 | 100 | 10000 | 1 | |
7 | 4.722550392150879 | 100 | 10000 | 1 | |
8 | 4.735676050186157 | 100 | 10000 | 1 | |
9 | 0.8438136577606201 | 100 | 5000 | 1 | |
10 | 0.8434607982635498 | 100 | 5000 | 1 | |
11 | 0.8423585891723633 | 100 | 5000 | 1 | |
12 | 0.027704477310180664 | 100 | 1000 | 1 | |
13 | 0.027656078338623047 | 100 | 1000 | 1 | |
14 | 0.02758312225341797 | 100 | 1000 | 1 | |
15 | 0.0010852813720703125 | 100 | 100 | 1 | |
16 | 0.0006594657897949219 | 100 | 100 | 1 | |
17 | 0.0006537437438964844 | 100 | 100 | 1 | |
18 | 55.213985443115234 | 100 | 40000 | 10 | |
19 | 58.77374887466431 | 100 | 40000 | 10 | |
20 | 55.19669032096863 | 100 | 40000 | 10 | |
21 | 11.520464181900024 | 100 | 20000 | 10 | |
22 | 11.497724294662476 | 100 | 20000 | 10 | |
23 | 11.49088716506958 | 100 | 20000 | 10 | |
24 | 2.747018337249756 | 100 | 10000 | 10 | |
25 | 2.733360767364502 | 100 | 10000 | 10 | |
26 | 2.8228633403778076 | 100 | 10000 | 10 | |
27 | 0.675994873046875 | 100 | 5000 | 10 | |
28 | 0.6749563217163086 | 100 | 5000 | 10 | |
29 | 0.6764612197875977 | 100 | 5000 | 10 | |
30 | 0.023439884185791016 | 100 | 1000 | 10 | |
31 | 0.02269458770751953 | 100 | 1000 | 10 | |
32 | 0.023115873336791992 | 100 | 1000 | 10 | |
33 | 0.0008337497711181641 | 100 | 100 | 10 | |
34 | 0.0006406307220458984 | 100 | 100 | 10 | |
35 | 0.0006313323974609375 | 100 | 100 | 10 | |
36 | 47.73020386695862 | 100 | 40000 | 22 | |
37 | 47.69992017745972 | 100 | 40000 | 22 | |
38 | 47.62230563163757 | 100 | 40000 | 22 | |
39 | 11.639677047729492 | 100 | 20000 | 22 | |
40 | 11.566004514694214 | 100 | 20000 | 22 | |
41 | 11.810020446777344 | 100 | 20000 | 22 | |
42 | 2.889223575592041 | 100 | 10000 | 22 | |
43 | 2.749232292175293 | 100 | 10000 | 22 | |
44 | 2.7498748302459717 | 100 | 10000 | 22 | |
45 | 0.6866409778594971 | 100 | 5000 | 22 | |
46 | 0.6885111331939697 | 100 | 5000 | 22 | |
47 | 0.690028190612793 | 100 | 5000 | 22 | |
48 | 0.022968053817749023 | 100 | 1000 | 22 | |
49 | 0.02248072624206543 | 100 | 1000 | 22 | |
50 | 0.02284836769104004 | 100 | 1000 | 22 | |
51 | 0.0007929801940917969 | 100 | 100 | 22 | |
52 | 0.0006601810455322266 | 100 | 100 | 22 | |
53 | 0.0006287097930908203 | 100 | 100 | 22 | |
54 | 47.31692409515381 | 100 | 40000 | 46 | |
55 | 49.07538294792175 | 100 | 40000 | 46 | |
56 | 48.277475118637085 | 100 | 40000 | 46 | |
57 | 11.227022647857666 | 100 | 20000 | 46 | |
58 | 11.562239646911621 | 100 | 20000 | 46 | |
59 | 11.235973119735718 | 100 | 20000 | 46 | |
60 | 2.7667436599731445 | 100 | 10000 | 46 | |
61 | 2.679640769958496 | 100 | 10000 | 46 | |
62 | 2.6795284748077393 | 100 | 10000 | 46 | |
63 | 0.6811165809631348 | 100 | 5000 | 46 | |
64 | 0.6973702907562256 | 100 | 5000 | 46 | |
65 | 0.7564349174499512 | 100 | 5000 | 46 | |
66 | 0.025141000747680664 | 100 | 1000 | 46 | |
67 | 0.02521491050720215 | 100 | 1000 | 46 | |
68 | 0.024368762969970703 | 100 | 1000 | 46 | |
69 | 0.0007998943328857422 | 100 | 100 | 46 | |
70 | 0.0006432533264160156 | 100 | 100 | 46 | |
71 | 0.0006325244903564453 | 100 | 100 | 46 | |
72 | 46.916279554367065 | 100 | 40000 | 100 | |
73 | 46.784446716308594 | 100 | 40000 | 100 | |
74 | 47.71704292297363 | 100 | 40000 | 100 | |
75 | 11.405823945999146 | 100 | 20000 | 100 | |
76 | 11.669658899307251 | 100 | 20000 | 100 | |
77 | 11.365206956863403 | 100 | 20000 | 100 | |
78 | 2.992124319076538 | 100 | 10000 | 100 | |
79 | 2.9002745151519775 | 100 | 10000 | 100 | |
80 | 2.6818411350250244 | 100 | 10000 | 100 | |
81 | 0.681471586227417 | 100 | 5000 | 100 | |
82 | 0.7413830757141113 | 100 | 5000 | 100 | |
83 | 0.6922602653503418 | 100 | 5000 | 100 | |
84 | 0.023858070373535156 | 100 | 1000 | 100 | |
85 | 0.023314237594604492 | 100 | 1000 | 100 | |
86 | 0.02337813377380371 | 100 | 1000 | 100 | |
87 | 0.0008080005645751953 | 100 | 100 | 100 | |
88 | 0.0006475448608398438 | 100 | 100 | 100 | |
89 | 0.0006434917449951172 | 100 | 100 | 100 | |
90 | 48.19805312156677 | 100 | 40000 | 215 | |
91 | 45.96044921875 | 100 | 40000 | 215 | |
92 | 47.590593338012695 | 100 | 40000 | 215 | |
93 | 12.487635135650635 | 100 | 20000 | 215 | |
94 | 11.264180183410645 | 100 | 20000 | 215 | |
95 | 11.47057843208313 | 100 | 20000 | 215 | |
96 | 2.7389330863952637 | 100 | 10000 | 215 | |
97 | 2.9447615146636963 | 100 | 10000 | 215 | |
98 | 3.197394371032715 | 100 | 10000 | 215 | |
99 | 0.7132112979888916 | 100 | 5000 | 215 | |
100 | 0.714383602142334 | 100 | 5000 | 215 | |
101 | 0.6667075157165527 | 100 | 5000 | 215 | |
102 | 0.025145769119262695 | 100 | 1000 | 215 | |
103 | 0.024105310440063477 | 100 | 1000 | 215 | |
104 | 0.02427816390991211 | 100 | 1000 | 215 | |
105 | 0.001071929931640625 | 100 | 100 | 215 | |
106 | 0.0009653568267822266 | 100 | 100 | 215 | |
107 | 0.0008819103240966797 | 100 | 100 | 215 | |
108 | 46.257248401641846 | 100 | 40000 | 464 | |
109 | 45.165510177612305 | 100 | 40000 | 464 | |
110 | 45.441216230392456 | 100 | 40000 | 464 | |
111 | 10.508992910385132 | 100 | 20000 | 464 | |
112 | 11.447564363479614 | 100 | 20000 | 464 | |
113 | 11.426690816879272 | 100 | 20000 | 464 | |
114 | 3.0052504539489746 | 100 | 10000 | 464 | |
115 | 2.8551981449127197 | 100 | 10000 | 464 | |
116 | 2.807879686355591 | 100 | 10000 | 464 | |
117 | 0.855536937713623 | 100 | 5000 | 464 | |
118 | 0.6697769165039062 | 100 | 5000 | 464 | |
119 | 0.7944178581237793 | 100 | 5000 | 464 | |
120 | 0.024903297424316406 | 100 | 1000 | 464 | |
121 | 0.024701595306396484 | 100 | 1000 | 464 | |
122 | 0.02453017234802246 | 100 | 1000 | 464 | |
123 | 0.0008106231689453125 | 100 | 100 | 464 | |
124 | 0.00064849853515625 | 100 | 100 | 464 | |
125 | 0.0006377696990966797 | 100 | 100 | 464 | |
126 | 44.7512321472168 | 100 | 40000 | 1000 | |
127 | 43.10793614387512 | 100 | 40000 | 1000 | |
128 | 43.913618326187134 | 100 | 40000 | 1000 | |
129 | 11.027376651763916 | 100 | 20000 | 1000 | |
130 | 10.156231164932251 | 100 | 20000 | 1000 | |
131 | 10.327084064483643 | 100 | 20000 | 1000 | |
132 | 2.692312240600586 | 100 | 10000 | 1000 | |
133 | 2.640241861343384 | 100 | 10000 | 1000 | |
134 | 2.6469826698303223 | 100 | 10000 | 1000 | |
135 | 0.668205738067627 | 100 | 5000 | 1000 | |
136 | 0.6639533042907715 | 100 | 5000 | 1000 | |
137 | 0.663642168045044 | 100 | 5000 | 1000 | |
138 | 0.025493383407592773 | 100 | 1000 | 1000 | |
139 | 0.02452874183654785 | 100 | 1000 | 1000 | |
140 | 0.025629758834838867 | 100 | 1000 | 1000 | |
141 | 0.0009765625 | 100 | 100 | 1000 | |
142 | 0.0008301734924316406 | 100 | 100 | 1000 | |
143 | 0.0008120536804199219 | 100 | 100 | 1000 | |
144 | 42.89431428909302 | 100 | 40000 | 10000 | |
145 | 42.75436544418335 | 100 | 40000 | 10000 | |
146 | 39.34532022476196 | 100 | 40000 | 10000 | |
147 | 10.498741149902344 | 100 | 20000 | 10000 | |
148 | 10.209395170211792 | 100 | 20000 | 10000 | |
149 | 10.23120379447937 | 100 | 20000 | 10000 | |
150 | 2.631664752960205 | 100 | 10000 | 10000 | |
151 | 2.6318283081054688 | 100 | 10000 | 10000 | |
152 | 2.548217535018921 | 100 | 10000 | 10000 | |
153 | 0.6596729755401611 | 100 | 5000 | 10000 | |
154 | 0.7769567966461182 | 100 | 5000 | 10000 | |
155 | 0.8544619083404541 | 100 | 5000 | 10000 | |
156 | 0.034839630126953125 | 100 | 1000 | 10000 | |
157 | 0.03863096237182617 | 100 | 1000 | 10000 | |
158 | 0.0359342098236084 | 100 | 1000 | 10000 | |
159 | 0.001064300537109375 | 100 | 100 | 10000 | |
160 | 0.0009489059448242188 | 100 | 100 | 10000 | |
161 | 0.0009412765502929688 | 100 | 100 | 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numpy as np | |
import pandas as pd | |
import sklearn | |
from sklearn.metrics.pairwise import pairwise_distances_argmin_min | |
n_features = 100 | |
results = [] | |
for working_memory in [1, 10, 22, 46, 100, 215, 464, 1000, 10000]: | |
with sklearn.config_context(working_memory=working_memory): | |
for n_samples in [100, 1000, 5000, 10000, 20000, 40000][::-1]: | |
for i in range(3): | |
X = np.random.rand(n_samples, n_features) | |
start = time.time() | |
pairwise_distances_argmin_min(X, X) | |
elapsed = time.time() - start | |
results.append({'n_samples': n_samples, | |
'n_features': n_features, | |
'working_memory': working_memory, | |
'elapsed': elapsed}) | |
print(results[-1]) | |
pd.DataFrame(results).to_csv('bench_working_memory.csv') | |
pd.DataFrame(results).to_json('bench_working_memory.json', orient='records') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import pandas as pd | |
bench = pd.read_csv('bench_working_memory.csv') | |
piv = bench.pivot_table('elapsed', ['working_memory'], ['n_samples', 'n_features']) | |
piv.plot(logy=True, logx=True) | |
plt.xlabel('working_memory') | |
plt.ylabel('time (s)') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment