@@ -293,15 +293,18 @@ def compute_and_plot_metric_over_metric_categories(self, class_name: str, data=N
293
293
return
294
294
295
295
optimal_results_per_cutoff = {}
296
- for c , cutoff in enumerate (metric2_cutoffs ):
297
- if c == 0 :
298
- cat_optimal_results = total_optimal_results .loc [total_optimal_results [metric2 ] <= cutoff ]
299
- optimal_results_per_cutoff ['<=' + str (cutoff )] = cat_optimal_results
300
- else :
301
- cat_optimal_results = total_optimal_results .loc [metric2_cutoffs [c - 1 ] < total_optimal_results [metric2 ] <= cutoff ]
302
- optimal_results_per_cutoff [']' + str (metric2_cutoffs [c - 1 ]) + ',' + str (cutoff ) + ']' ] = cat_optimal_results
303
- cat_optimal_results = total_optimal_results .loc [total_optimal_results [metric2 ] > metric2_cutoffs [- 1 ]]
304
- optimal_results_per_cutoff ['>' + str (metric2_cutoffs [- 1 ])] = cat_optimal_results
296
+ if metric2_cutoffs is None or len (metric2_cutoffs ) == 0 :
297
+ optimal_results_per_cutoff ['All' ] = total_optimal_results
298
+ else :
299
+ for c , cutoff in enumerate (metric2_cutoffs ):
300
+ if c == 0 :
301
+ cat_optimal_results = total_optimal_results .loc [total_optimal_results [metric2 ] <= cutoff ]
302
+ optimal_results_per_cutoff ['<=' + str (cutoff )] = cat_optimal_results
303
+ else :
304
+ cat_optimal_results = total_optimal_results .loc [metric2_cutoffs [c - 1 ] < total_optimal_results [metric2 ] <= cutoff ]
305
+ optimal_results_per_cutoff [']' + str (metric2_cutoffs [c - 1 ]) + ',' + str (cutoff ) + ']' ] = cat_optimal_results
306
+ cat_optimal_results = total_optimal_results .loc [total_optimal_results [metric2 ] > metric2_cutoffs [- 1 ]]
307
+ optimal_results_per_cutoff ['>' + str (metric2_cutoffs [- 1 ])] = cat_optimal_results
305
308
306
309
for cat in optimal_results_per_cutoff .keys ():
307
310
# @TODO. Must include a new fold average specific for the studies, with mean and std values as input,
0 commit comments