From 48726fbe11216ccea7c7a939c17296160754a6e8 Mon Sep 17 00:00:00 2001 From: Nikolaos Perrakis Date: Mon, 22 Jul 2024 21:45:14 +0300 Subject: [PATCH] add threshold value limits for multiclass metrics --- .../confidence_based/metrics.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nannyml/performance_estimation/confidence_based/metrics.py b/nannyml/performance_estimation/confidence_based/metrics.py index b5242a34..17d4a359 100644 --- a/nannyml/performance_estimation/confidence_based/metrics.py +++ b/nannyml/performance_estimation/confidence_based/metrics.py @@ -2326,6 +2326,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('ROC AUC', 'roc_auc')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) self.y_pred_proba: Dict[str, str] self.classes: List[str] = [""] @@ -2463,6 +2465,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('F1', 'f1')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # sampling error: @@ -2577,6 +2581,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('Precision', 'precision')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # sampling error @@ -2692,6 +2698,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('Recall', 'recall')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # sampling error @@ -2807,6 +2815,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('Specificity', 'specificity')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # sampling error @@ -2927,6 +2937,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('Accuracy', 'accuracy')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # sampling error @@ -3356,6 +3368,8 @@ def __init__( chunker=chunker, threshold=threshold, components=[('Average Precision', 'average_precision')], + lower_threshold_value_limit=0, + upper_threshold_value_limit=1, ) # FIXME: Should we check the y_pred_proba argument here to ensure it's a dict? self.y_pred_proba: Dict[str, str]