Skip to main content

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 pointUse it whenNotes
binary_metricsYou need binary-classification metrics from predictions and probabilitiesImport from limen.metrics.binary_metrics for the function form
multiclass_metricsYou need macro or weighted metrics for multiclass problemsImport from limen.metrics.multiclass_metrics
continuous_metricsYou need regression metrics like MAE, RMSE, and R2Import from limen.metrics.continuous_metrics
safe_ovr_aucYou need OvR AUC without blowing up on missing-class edge casesImport from limen.metrics.safe_ovr_auc
balanced_metricYou want a single optimization target for balanced binary prediction qualityExported directly from the package root

Adjacent modules

  • limen.sfd.reference_architecture is a common caller of these helpers.
  • limen.log and limen.backtest evaluate experiment outcomes after the model phase, but they are downstream from these raw metrics.
  • limen.utils re-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_metrics assumes the standard Limen data_dict shape and reads data['y_test'].
  • safe_ovr_auc returns NaN rather than raising when the class structure makes AUC undefined.
  • balanced_metric is Limen-specific and should not be described as a standard sklearn metric.