quantlab.model.predefined.smoothed#

Smooth a predictor’s predictions in time, causally.

A portfolio rule that trades every bar on the latest predictions trades their fast part as well as their slow part. SmoothedPredictor wraps any Predictor and replaces each bar’s prediction with an exponentially weighted mean of the symbol’s own predictions up to and including that bar, so a memoryless rule on it trades the slow part only. Bar t reads bars up to t and nothing later.

Each bar is first standardised over its symbols (a cross-sectional z-score), so a change of scale between bars, between the checkpoints of a walk-forward run for example, does not weigh one stretch of bars more than another; the smoothed panel is then on a standardised scale. standardize=False smooths the raw values in their own units instead.

The mean at a window’s first bars needs the predictions of the bars before it, the warm-up, which the wrapped predictor is asked for too. A model predicts them with its loaded checkpoint; a RecordedPredictor with history=True serves what the checkpoints live at those bars predicted there (in a run_cv, the earlier folds), the history a live account smoothing its own past predictions would hold.

Classes

SmoothedPredictor

A Predictor whose predictions are a causal exponential mean of the wrapped ones.

SmoothedPredictorConfig

What a SmoothedPredictor is rebuilt from.