quantlab.runs.prediction_panel.LabelSpec#
- class quantlab.runs.prediction_panel.LabelSpec(name, scale, delay, span)[source]#
Bases:
objectWhat a portfolio construction rule may know about one prediction variable.
A rule is bound to the specs of the labels it is handed predictions of (
PortfolioConstructor.bind), never to the model that predicted them, so a rule can be rebuilt from a run directory without its model (quantlab.portfolio.decision_inputs.DecisionInputs.from_run). The backtester derives the specs of its predictor withquantlab.backtest.base.label_specs.- Parameters:
- namestr
The label’s variable name, the prediction variable it scores.
- scalestr
The prediction’s scale:
"raw"in the label’s own units,"standardized"when it only ranks the cross-section.- delayint
Bars between the bar a signal forms on and the first bar the label counts.
- spanint or None
Bars the label accumulates over, or
Nonefor a label that is not aForwardlabel.
Examples
>>> spec = LabelSpec(name="ret_5", scale="raw", delay=1, span=5) >>> spec.span, dataclasses.asdict(spec)["scale"] (5, 'raw')