Canonical docs
In the research projects
The Python project returns its caller-defined validation net return. The Compiled project records architecture and backtest metrics under its declared objective. Read those values with their population, units and availability; a metric name alone does not make two experiments comparable.
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 case | Notes |
|---|---|---|
binary_metrics |
Binary-classification metrics from predictions and probabilities | Import from limen.metrics.binary_metrics for the function form |
multiclass_metrics |
Macro or weighted metrics for multiclass problems | Import from limen.metrics.multiclass_metrics |
continuous_metrics |
Regression metrics like MAE, RMSE, and R2 | Import from limen.metrics.continuous_metrics |
rule_based_metrics |
Position and trading statistics for rule-based outputs | Exported at the package root |
safe_ovr_auc |
OvR AUC without blowing up on missing-class edge cases | Import from limen.metrics.safe_ovr_auc |
balanced_metric |
Single optimization target for balanced binary prediction quality | Exported directly from the package root |
deflated_sharpe_ratio |
Per-bar Sharpe probability corrected for trial selection and return moments | Exported at the package root; see the canonical selection methodology |
probability_of_backtest_overfitting |
CSCV probability from a synchronous trial-by-bar return matrix | Exported at the package root; see the canonical selection methodology |
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/├── README.md├── __init__.py├── balanced_metric.py├── binary_metrics.py├── continuous_metrics.py├── deflated_sharpe_ratio.py├── multiclass_metrics.py├── probability_of_backtest_overfitting.py├── rule_based_metrics.py└── safe_ovr_auc.pyMerged source PR · 87894eb8Package layout · Limen 6.0.1 · current package validation · package source
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. Reindex probability columns before calling it if a fold omits an intermediate class.balanced_metricis Limen-specific and should not be described as a standard sklearn metric.