quantlab.model.base#
Model layer: the training lifecycle shared by every model head.
A head is one concrete predictive model, for example a torch network or an XGBoost
regressor. It reads features (factor values) and learns labels (the
targets to predict, typically forward returns). Both arrive as panels: an
xarray.Dataset indexed by timestamp and symbol, with one data
variable per feature or label.
The model layer is a three-level class hierarchy; this module holds its root. BaseModel holds
everything that does not depend on the training framework: config
validation, requesting the factor and label panels over the model’s date
range and collecting them into one dataset, the public train /
train_cv / load / predict / predict_panel methods, and
the directory layout of a training run, whose files are written and read
through quantlab.runs.trained_run. The fold boundaries of rolling
cross-validation come from quantlab.model.split. It imports no training
framework. The two variants live in the model layer:
quantlab.model.torch_model.TorchModel (PyTorch: one cross-section of
symbols per training step, each with its own window of past bars, .pth
checkpoints) and quantlab.model.library_model.LibraryModel (tree models and
other libraries that train themselves, .joblib checkpoints), which share
the training target of quantlab.model.training_target. Both take one
ModelConfig; the reserved keys of its hyperparameters are listed in
RESERVED_HYPERPARAMETERS. Shipped heads live in quantlab/model/predefined.
Classes
Framework-agnostic base class of every model head. |
Functions
Run |