xpectra.metrics

Calibration and selective-prediction metrics not provided by sklearn.

Functions

aurc(y_true, y_pred, confidence)

Area under the risk-coverage curve (lower is better).

expected_calibration_error(y_true, proba[, ...])

Top-label ECE plus the per-bin table used for reliability diagrams.

multiclass_brier(y_true, proba)

Mean squared error between one-hot labels and predicted probabilities.

risk_coverage(y_true, y_pred, confidence)

Selective-risk curve: abstain on the least confident samples first.

selective_metrics_at_coverage(y_true, ...)

Accuracy/macro-F1/MCC on the retained fraction at a target coverage.

xpectra.metrics.expected_calibration_error(y_true, proba, n_bins=15, strategy='uniform')[source]

Top-label ECE plus the per-bin table used for reliability diagrams.

Parameters:
Return type:

tuple[float, DataFrame]

xpectra.metrics.multiclass_brier(y_true, proba)[source]

Mean squared error between one-hot labels and predicted probabilities.

Parameters:
Return type:

float

xpectra.metrics.risk_coverage(y_true, y_pred, confidence)[source]

Selective-risk curve: abstain on the least confident samples first.

Parameters:
Return type:

DataFrame

xpectra.metrics.aurc(y_true, y_pred, confidence)[source]

Area under the risk-coverage curve (lower is better).

Parameters:
Return type:

float

xpectra.metrics.selective_metrics_at_coverage(y_true, y_pred, confidence, coverage)[source]

Accuracy/macro-F1/MCC on the retained fraction at a target coverage.

Parameters:
Return type:

dict[str, float]