Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect evaluation metrics #1

@mohayl

Description

@mohayl

In the evaluation of binary metrics, precision_score, recall_score and f1_score get label and score in wrong order:
**

def compute_binary_metrics(anomaly_pred, anomaly_label, adjustment=False):
if not adjustment:
eval_anomaly_pred = anomaly_pred
metrics = {
"f1": f1_score(eval_anomaly_pred, anomaly_label),
"pc": precision_score(eval_anomaly_pred, anomaly_label),
"rc": recall_score(eval_anomaly_pred, anomaly_label),
}

**

It should be:
**

def compute_binary_metrics(anomaly_pred, anomaly_label, adjustment=False):
if not adjustment:
eval_anomaly_pred = anomaly_pred
metrics = {
"f1": f1_score(anomaly_label,eval_anomaly_pred),
"pc": precision_score(anomaly_label, eval_anomaly_pred),
"rc": recall_score(anomaly_label, eval_anomaly_pred),
}

**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions