A seasonal naive forecast repeats the last observed value at the same phase of a known cycle.
Seasonal naive forecast: establish a baseline before fitting a model
Match the horizon
For a daily series with a weekly pattern, next Monday can use the previous Monday as a baseline. The baseline must use the value known at the forecast origin; if that previous Monday is incomplete or revised later, record the version actually available. A last-value baseline is also useful when no stable seasonality is evident. Calendar completeness matters more than a fancy estimator.
Compare against a real alternative
A trained model should beat simple rules on the same origins, target windows and missing-period policy. Report error by weekday and horizon, not merely a pooled average. A model that improves low-volume weekdays while failing a peak day may harm staffing. Metric slices expose that tradeoff.
Separate trend and seasonality
Repeating last week cannot respond to a sustained rise in submissions. A drift baseline projects recent change, but it can amplify an anomalous week. Before adding such a rule, plot observed data, report the history window and compare it to the simpler seasonal rule. Do not tune the baseline on the same final holdout used for model selection.
Build a tiny fixture
Use two complete weeks of daily counts. A Monday value of 47 in the previous week should yield 47 for the next Monday at a seven-day seasonal lag. Remove that earlier Monday and require a missing forecast or a declared fallback, not a silent lookup of Sunday.
Implementation
def seasonal_naive(history, target_index, season_length=7):
if season_length < 1 or target_index < 0:
raise ValueError("invalid season or target")
source_index = target_index - season_length
if source_index < 0 or source_index >= len(history):
return None
return history[source_index]Performance and operating cost
Each forecast is O(1) time and O(1) extra space after calendar alignment. Forecasting H positions is O(H). The baseline gives an inexpensive performance floor and exposes data-quality failures before a fitted model adds operational cost.
Common Mistakes
- Do not replace a missing seasonal source with the nearest row without a rule.
- Do not compare models on different origins or holdout periods.
- Do not assume weekly seasonality merely because data is daily.
