Add multiclass scoring.

master
junos 2023-05-19 01:34:34 +02:00
parent 70232949c3
commit a2401b5e36
1 changed files with 8 additions and 1 deletions

View File

@ -424,7 +424,14 @@ def run_all_classification_models(
data_groups: pd.DataFrame,
cross_validator: BaseCrossValidator,
):
data_y_value_counts = data_y.value_counts()
if len(data_y_value_counts) == 1:
raise (ValueError("There is only one unique value in data_y."))
if len(data_y_value_counts) == 2:
metrics = ["accuracy", "average_precision", "recall", "f1"]
else:
metrics = ["accuracy", "precision_micro", "recall_micro", "f1_micro"]
test_metrics = ["test_" + metric for metric in metrics]
scores = pd.DataFrame(columns=["method", "test_metric", "max", "mean"])