AutoForecaster

class omnicast.AutoForecaster(models=None, seasonal_period=None, metric='rmse', validation_horizon=1, keep_all=False)[source]

Bases: BaseForecaster

Choose the model with the best rolling-origin validation score.

With keep_all=True every candidate is also fitted on the full series and kept in fitted_ (name -> fitted model).

Examples

>>> import pandas as pd
>>> from omnicast import AutoForecaster
>>> y = pd.Series([10.0, 12.0, 11.0, 13.0, 15.0, 14.0])
>>> model = AutoForecaster().fit(y)
>>> model.leaderboard_["model"].iloc[0]
'ThetaForecaster'
>>> model.predict(horizon=2).mean.round(2).tolist()
[14.05, 14.49]

Notes

When to use this model

Best for

The default entry point – backtests a panel of candidates and refits the winner, so you don’t have to pick a model by hand

Avoid when

You already know which model fits, need exogenous regressors (not yet supported here), or want a single deterministic model without a backtest step

Handles trend

Depends on which candidate wins the backtest

Handles seasonality

Yes, via seasonal_period (adds seasonal-aware candidates)

Extra dependencies

None by default; include LSTMForecaster explicitly via models=[...] to pull in torch

Min. observations

Whatever the strictest candidate in models requires; a failing candidate is skipped rather than aborting selection

Parameters:
fit(y, X=None)[source]
predict(horizon, X=None, level=(80, 95))[source]
plot_all(horizon=None, level=(80, 95), observed=None, intervals=False, **kwargs)[source]

Overlay every successful candidate’s forecast on one axes.

Refits each candidate on the full training series, unless the estimator was built with keep_all=True (then the stored fits are reused).

Parameters:
  • horizon (int, optional) – Steps to forecast. Defaults to validation_horizon.

  • level (float or sequence of float, default (80, 95)) – Prediction-interval coverage levels to compute.

  • observed (pd.Series, optional) – History to draw. Defaults to the full training series.

  • intervals (bool, default False) – Shade each candidate’s prediction bands. Off by default – with several candidates the overlapping bands get muddy.

  • **kwargs – Forwarded to the trajectory plot (title, ax, save_path, …).

fit_predict(y, horizon, **kwargs)
Return type:

ForecastResult

Parameters:
get_params()
Return type:

dict[str, object]