Forecast with the seasonal naive method
Why it matters Seasonal naive is the standard benchmark for retail demand, traffic and support ticket forecasts, and the denominator of the MASE metric.
The seasonal naive forecast repeats the last observed season. It is the baseline every fancier forecaster must beat.
Write seasonal_naive(y, m, h). y is the history, m the season length and h the number of steps to forecast. Forecast step i (0-based) is y[n - m + (i % m)], where n = len(y). Raise ValueError if n < m. Return a float array of length h.
def seasonal_naive(y, m, h)Example
y [10, 20, 30, 12, 22, 33], m 3, h 5 gives [12, 22, 33, 12, 22].
Understand the idea
The simplest honest forecast for seasonal data is: next Monday will look like last Monday. The seasonal naive method copies the last full season forward, wrapping around as often as needed.
Worked example: quarterly-like data with m = 3: 10, 20, 30, then 12, 22, 33. The last season is 12, 22, 33. Forecasting 5 steps gives 12, 22, 33, then wraps: 12, 22. For daily data with a weekly pattern, use m = 7 and every forecast day copies the same weekday from the last week.
Rule: forecast_i = y[n - m + (i mod m)].
It sounds too simple to matter, but it is surprisingly strong for sales, website traffic and call volumes. Any model you build should be compared against it: if your model cannot beat seasonal naive, it is not ready. The MASE error metric uses this baseline's error as its yardstick.