2026-09-24 02:00:56 -07:00
|
|
|
"""
|
|
|
|
|
Candidate models.
|
|
|
|
|
|
|
|
|
|
A model is any object with a `name` and a
|
|
|
|
|
`forecast(history: pd.DataFrame, horizons: np.ndarray) -> Forecast` method.
|
|
|
|
|
`history` holds every row up to and including the forecast origin and nothing
|
|
|
|
|
after it; the harness guarantees that, so models can use all of it freely.
|
2026-09-24 02:30:38 -07:00
|
|
|
Most models are a Composite of a drift and a volatility component.
|
2026-09-24 02:00:56 -07:00
|
|
|
"""
|
|
|
|
|
|
2026-09-24 02:30:38 -07:00
|
|
|
from .base import Composite
|
|
|
|
|
from .drift import CycleDrift, PowerLawDrift, TrailingMeanDrift, ZeroDrift
|
|
|
|
|
from .volatility import TrailingVol
|
|
|
|
|
|
|
|
|
|
BASELINE = "random_walk"
|
2026-09-24 02:00:56 -07:00
|
|
|
|
|
|
|
|
# Order is fixed: it sets each model's colour in every chart.
|
2026-09-24 02:30:38 -07:00
|
|
|
MODELS = {
|
|
|
|
|
m.name: m
|
|
|
|
|
for m in (
|
|
|
|
|
# "It stays about here, give or take."
|
|
|
|
|
Composite(BASELINE, ZeroDrift(), TrailingVol()),
|
|
|
|
|
# "It keeps doing what it did last cycle."
|
|
|
|
|
Composite("drift_rw", TrailingMeanDrift(), TrailingVol()),
|
|
|
|
|
# The 2024 model, distilled.
|
|
|
|
|
Composite("cycle", CycleDrift(), TrailingVol()),
|
|
|
|
|
# "Growth keeps slowing, like it always has." Passed the diminishing-returns A/B.
|
|
|
|
|
Composite("powerlaw", PowerLawDrift(), TrailingVol()),
|
|
|
|
|
)
|
|
|
|
|
}
|