limen.metrics
Score classifier and regressor outputs so experiments can compare permutations on consistent metrics.
Canonical docs
What this package owns
Owns the metric helpers used inside model functions and experiment outputs. Does not own model fitting, prediction generation, experiment logging, or backtesting.
Key entry points
| Entry point | Use it when | Notes |
|---|---|---|
binary_metrics | You need binary-classification metrics from predictions and probabilities | Import from limen.metrics.binary_metrics for the function form |
multiclass_metrics | You need macro or weighted metrics for multiclass problems | Import from limen.metrics.multiclass_metrics |
continuous_metrics | You need regression metrics like MAE, RMSE, and R2 | Import from limen.metrics.continuous_metrics |
safe_ovr_auc | You need OvR AUC without blowing up on missing-class edge cases | Import from limen.metrics.safe_ovr_auc |
balanced_metric | You want a single optimization target for balanced binary prediction quality | Exported directly from the package root |
Adjacent modules
limen.sfd.reference_architectureis a common caller of these helpers.limen.logandlimen.backtestevaluate experiment outcomes after the model phase, but they are downstream from these raw metrics.limen.utilsre-exports a small subset of metrics for convenience on older code paths.
Quick orientation
metrics/
├── binary_metrics.py
├── multiclass_metrics.py
├── continuous_metrics.py
├── safe_ovr_auc.py
└── balanced_metric.py
Things to know
- The clearest import style is function-level imports from each module, even though the package root also exposes part of the surface.
binary_metricsassumes the standard Limendata_dictshape and readsdata['y_test'].safe_ovr_aucreturnsNaNrather than raising when the class structure makes AUC undefined.balanced_metricis Limen-specific and should not be described as a standard sklearn metric.