Metrics¶
limen_ml.metrics ¶
The metrics of a probabilistic model that need scikit-learn, and its error bands.
The plain ones (AUC, contingency, Brier, reliability) are in
limen_core.verification; these are the model's own:
- :func:
auc_pr: the area under the precision-recall curve, the measure that stays honest when landslides are one row in a thousand; - :func:
threshold_sweep: what catching 50, 70 or 90 % of the events costs in false alarms; - :func:
conformal_quantiles: split-conformal error bands on calibrated probabilities.
auc_pr ¶
auc_pr(y_true: Any, y_prob: Any) -> float
Area under the precision-recall curve (average precision).
threshold_sweep ¶
threshold_sweep(y_true: Any, y_prob: Any, *, recall_targets: Sequence[float] = (0.5, 0.7, 0.9)) -> list[dict[str, float]]
The operating point at each recall target: threshold, hit rate, FAR, TSS.
For each target, the highest threshold whose recall meets it. With no event the threshold is 1.0 and nothing else is said. An empty denominator reads 0.0.
conformal_quantiles ¶
conformal_quantiles(y_true: Any, y_prob: Any, *, alphas: Sequence[float] = (0.2, 0.1, 0.05)) -> dict[str, float]
Split-conformal error quantiles: [p - q, p + q] covers the outcome 1 - alpha.
Nonconformity is |y - p| on calibrated out-of-fold predictions, with the
finite-sample corrected rank. Keys are q80, q90, q95.