Metric
Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- class Metric(*args, **kwargs)[source]
Bases:
ProtocolEvaluation metric with explicit input requirements.
The
needs_probaflag declares whether the metric consumes class probabilities/scores (AUC, calibration tests) or hard labels (accuracy, sensitivity); evaluation drivers use it instead of guessing from the metric name.- __call__(y_true: ndarray, y_pred: ndarray, y_score: ndarray | None = None) float[source]
Compute the metric value.
- Parameters:
y_true – True class labels.
y_pred – Predicted class labels.
y_score – Probability/score of the positive class; required when
needs_probais true.
- Returns:
The metric value (
NaNwhere the metric is undefined for the given inputs, e.g. calibration tests on multi-class problems).
- __init__(*args, **kwargs)