quantlab.backtest.base.label_specs#
- quantlab.backtest.base.label_specs(predictor)[source]#
Return the
LabelSpecof every prediction variable ofpredictor.One spec per variable name of each label, in the order of
labels: the name, its scale fromlabel_scales, the label’s delay fromlabel_delaysand itsspan_bars(), orNonefor a label without one (it is not aForwardlabel). These are what a portfolio construction rule is bound to and what a run’spredictions.zarrrecords.- Parameters:
- predictorPredictor
The model or ensemble whose labels are described.
- Returns:
- tuple[LabelSpec, …]
The specs, in the order of the prediction variables.
- Raises:
- ValueError
If
label_scaleshas no entry for a label variable.
Examples
With
modela model predicting the 5-bar forward returnret_5:>>> label_specs(model) (LabelSpec(name='ret_5', scale='raw', delay=1, span=5),)