@@ -38,6 +38,11 @@ def _not_in_sphinx():
38
38
return "__file__" in globals ()
39
39
40
40
41
+ # %%
42
+ # Benchmark and plot helper functions
43
+ # -----------------------------------
44
+
45
+
41
46
def atomic_benchmark_estimator (estimator , X_test , verbose = False ):
42
47
"""Measure runtime prediction of each instance."""
43
48
n_instances = X_test .shape [0 ]
@@ -289,13 +294,10 @@ def plot_benchmark_throughput(throughputs, configuration):
289
294
plt .show ()
290
295
291
296
292
- # #############################################################################
293
- # Main code
294
-
295
- start_time = time .time ()
296
-
297
- # #############################################################################
297
+ # %%
298
298
# Benchmark bulk/atomic prediction speed for various regressors
299
+ # -------------------------------------------------------------
300
+
299
301
configuration = {
300
302
"n_train" : int (1e3 ),
301
303
"n_test" : int (1e2 ),
@@ -325,7 +327,10 @@ def plot_benchmark_throughput(throughputs, configuration):
325
327
}
326
328
benchmark (configuration )
327
329
328
- # benchmark n_features influence on prediction speed
330
+ # %%
331
+ # Benchmark n_features influence on prediction speed
332
+ # --------------------------------------------------
333
+
329
334
percentile = 90
330
335
percentiles = n_feature_influence (
331
336
{"ridge" : Ridge ()},
@@ -336,9 +341,9 @@ def plot_benchmark_throughput(throughputs, configuration):
336
341
)
337
342
plot_n_features_influence (percentiles , percentile )
338
343
339
- # benchmark throughput
344
+ # %%
345
+ # Benchmark throughput
346
+ # --------------------
347
+
340
348
throughputs = benchmark_throughputs (configuration )
341
349
plot_benchmark_throughput (throughputs , configuration )
342
-
343
- stop_time = time .time ()
344
- print ("example run in %.2fs" % (stop_time - start_time ))
0 commit comments