limen.scalers
Fit train-only feature scaling and apply it consistently across validation and test data.
Canonical docs
What this package owns
Owns fitted scaler classes, the scaler registry, and the rule-based logic that decides how columns should be transformed. Does not own raw feature creation or the experiment loop itself.
Key entry points
| Entry point | Use it when | Notes |
|---|---|---|
LinearScaler | You want rule-based scaling over mixed market-data columns | Exported at the package root |
LogRegScaler | You want the standard scaler used by logistic-regression SFDs | Exported at the package root |
RobustScaler | You want median and IQR scaling for outlier-heavy data | Exported at the package root |
CausalRollingRobustScaler | You want robust scaling that adapts to drift, with no look-ahead | Exported at the package root |
RankGaussScaler | You want rank-based Gaussianization | Exported at the package root |
SCALER_REGISTRY | You want to resolve scalers by manifest parameter name | Used by set_scaler_from_params() |
build_rules, inverse_transform | You need to customize or interpret LinearScaler behavior | Available from the module-level implementations |
Adjacent modules
limen.experiment.Manifestis the main consumer of this package.limen.transformshandles stateless transforms, which is a different stage from fitted scaling.limen.featuresandlimen.indicatorsproduce the columns that scalers later operate on.
Quick orientation
scalers/
├── linear_scaler.py # LinearScaler, rule helpers, inverse transform
├── logreg_scaler.py # Logistic-regression tuned scaling
├── robust_scaler.py # Median and IQR scaling
├── causal_rolling_robust_scaler.py # Causal trailing-window median and IQR scaling
├── rank_gauss_scaler.py # Rank-based Gaussianization
└── registry.py # SCALER_REGISTRY
Things to know
- Scalers are fit on the training split and then reused on validation and test splits. That fit/apply discipline is part of why this package stays separate from
limen.transforms. LinearScaleruses ordered regex rules. The first matching rule wins.- Unrecognized columns fall through to the catch-all
nonerule and stay unchanged. - Zero-variance columns are passed through rather than exploding the fit step.