User Guide¶
ml4t-models is organized around model semantics, not around one generic trainer
abstraction.
The fastest way to understand the library is to ask four questions:
- what data contract does the model require?
- what object does it estimate?
- what is the native output?
- what still has to happen before you can trade or backtest it?
The core design choice is simple: do not force structurally different finance models through
one artificial fit/predict story. A latent-factor model, a stochastic discount factor
model, a direct supervised predictor, and an end-to-end portfolio learner may all use neural
networks, but they are not estimating the same object.
The Four Main Workflows¶
1. Latent-Factor Forecasting¶
Used by:
PCAModelRPPCAModelIPCAModelCAEModel
Workflow:
This is the right abstraction for models where:
- exposures and factor realizations are the structural objects
- expected returns come from a separate premium forecast
2. Stochastic Discount Factor Estimation¶
Used by:
StochasticDiscountFactorModel
Workflow:
This family is intentionally separate because the native object is a traded pricing-kernel proxy, not a latent factor plus a premium forecast.
3. Direct Asset Prediction¶
Used by:
SAEModel
Workflow:
This is where the library puts supervised models that predict asset-level signals directly.
4. End-To-End Portfolio Learning¶
Used by:
LinearFeaturePortfolioModelLSTMPortfolioModelDeepPortfolioModel
Workflow:
These models optimize allocation decisions directly rather than first estimating returns.
Design Rules¶
- Stable-ID panel models and ragged cross-sectional models use different contracts.
- Neural checkpoints are configurable rather than hard-coded.
- Forecasting is kept outside structural latent-factor estimation.
- Evaluation belongs in
ml4t-diagnostic, not in this library. - Execution belongs in
ml4t-backtest, not in this library.
A Good Reading Strategy¶
If you want the economic logic first:
If you want to wire the library into a workflow quickly: