@@ -27,6 +27,7 @@ def time_feature_creation():
27
27
feature_extractor = "malanchev"
28
28
)
29
29
30
+
30
31
def time_learn_loop (ml_model , strategy ):
31
32
"""Benchmark how long it takes for a run of the learning loop."""
32
33
# Use the precomputed features so we don't time their creation.
@@ -54,3 +55,29 @@ def time_learn_loop(ml_model, strategy):
54
55
["RandomForest" , "KNN" ], # The different ML methods
55
56
["RandomSampling" , "UncSampling" ], # The different strategies.
56
57
]
58
+
59
+
60
+ def peakmem_learn_loop (ml_model ):
61
+ """Benchmark how much memory it takes for a run of the learning loop."""
62
+ # Use the precomputed features so we don't time their creation.
63
+ features_file = str (_TEST_DATA_DIR / "test_features.csv" )
64
+ with tempfile .TemporaryDirectory () as dir_name :
65
+ metrics_file = str (Path (dir_name ) / "metrics.csv" )
66
+ output_queried_file = str (Path (dir_name ) / "queried.csv" )
67
+ learn_loop (
68
+ nloops = 25 ,
69
+ features_method = "malanchev" ,
70
+ classifier = ml_model ,
71
+ strategy = "RandomSampling" ,
72
+ path_to_features = features_file ,
73
+ output_metrics_file = metrics_file ,
74
+ output_queried_file = output_queried_file ,
75
+ training = "original" ,
76
+ batch = 1 ,
77
+ )
78
+
79
+
80
+ # Parameterize the ML models and strategies we benchmark.
81
+ peakmem_learn_loop .params = [
82
+ ["RandomForest" , "KNN" ], # The different ML methods
83
+ ]
0 commit comments