Files

31 lines
1.1 KiB
Python
Raw Permalink Normal View History

"""
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.
Most models are a Composite of a drift and a volatility component.
"""
from .base import Composite
from .drift import CycleDrift, PowerLawDrift, TrailingMeanDrift, ZeroDrift
from .volatility import TrailingVol
BASELINE = "random_walk"
# Order is fixed: it sets each model's colour in every chart.
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()),
)
}