MeanForecaster

class omnicast.MeanForecaster[source]

Bases: BaseForecaster

Forecast the historical mean.

Examples

>>> import pandas as pd
>>> from omnicast import MeanForecaster
>>> y = pd.Series([10.0, 12.0, 11.0, 13.0, 15.0, 14.0])
>>> model = MeanForecaster().fit(y)
>>> model.predict(horizon=2).mean.round(2).tolist()
[12.5, 12.5]

Notes

When to use this model

Best for

A stability sanity check – does the series have a signal worth modeling at all?

Avoid when

The series has any trend or seasonality; it should almost always lose to a trend-aware model on a proper backtest

Handles trend

No

Handles seasonality

No

Extra dependencies

None

Min. observations

1

fit(y, X=None)
Return type:

BaseForecaster

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

ForecastResult

Parameters:
get_params()
Return type:

dict[str, object]

predict(horizon, X=None, level=(80, 95))
Return type:

ForecastResult

Parameters:

Forecasts the historical mean for every horizon step – flat, low-variance, and blind to trend or seasonality. Useful as a stability baseline (does the series even have a signal worth modeling?) and, via AutoForecaster’s leaderboard, as a sanity check that should almost always lose to anything trend-aware.

from omnicast import MeanForecaster

model = MeanForecaster().fit(y)
forecast = model.predict(horizon=6, level=[80, 95])
print(forecast.to_frame())
           mean  lower_80  upper_80  lower_95  upper_95
2026-01  151.02    111.98    190.07     91.32    210.73
2026-02  151.02    111.98    190.07     91.32    210.73
2026-03  151.02    111.98    190.07     91.32    210.73
2026-04  151.02    111.98    190.07     91.32    210.73
2026-05  151.02    111.98    190.07     91.32    210.73
2026-06  151.02    111.98    190.07     91.32    210.73

On this trending series 151.02 (the 4-year average) is a poor forecast for 2026, which is exactly why the AutoForecaster example ranks MeanForecaster last: the leaderboard scores are backtest RMSE, and a flat mean can’t track trend. The interval is constant across the horizon (sqrt(sigma2 * (1 + 1/n))) because every future point carries the same uncertainty about the estimated mean – there’s no compounding random-walk term to grow it with h.