From a954428952743d1dc9f0a62ab3e8c854cc42e4c9 Mon Sep 17 00:00:00 2001 From: Nikolaos Perrakis <89025229+nikml@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:13:24 +0300 Subject: [PATCH] Add threshold value limits for multiclass metrics (#411) --- .../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]