Rana Maninder Singh
Lesson 3 of 7Time Series Forecasting

Baselines (Naive, Seasonal Naive, Drift)

Lesson opener

In one line: Why every forecast project starts with honest baselines.

Why it matters: Baselines quantify the skill you must exceed - and they are trivial to audit in a readout.

Before this lesson: Decomposition and seasonality

Before you start


What you will learn

  • Why every forecast project starts with honest baselines
  • Naive, seasonal naive, and drift forecasts in code
  • Measuring MAE / RMSE / MAPE against a chronological holdout
  • When a fancy model fails to beat last-week seasonal naive

Pinned libraries for this course

pip install -r docs/timeseries/requirements.txt

Pinned in docs/timeseries/requirements.txt:

numpy==2.1.3
pandas==2.2.3
statsmodels==0.14.4
scipy==1.14.1

Baselines need only numpy and pandas. We still pin statsmodels and scipy with the course so later lessons share one environment file.


Beat the boring forecast first

A Mumbai fintech PM wants a "ML forecast" for daily UPI success counts. Before Holt-Winters or ARIMA, ship three baselines:

  1. Naive — tomorrow equals today.
  2. Seasonal naive — tomorrow equals the same weekday last week (period 7).
  3. Drift — project the average historical change forward.

If a complex model cannot beat seasonal naive on a clean holdout, do not put it in the ops dashboard.

WHY Baselines quantify the skill you must exceed — and they are trivial to audit in a readout.

WHEN Immediately after KPI definition and chronological split; before hyperparameter hunts.

Demo 1 — Chronological holdout split

# Offline demo: last 7 days as holdout for daily KPI
import numpy as np
import pandas as pd

rng = np.random.default_rng(4)
n = 42
idx = pd.date_range("2026-05-04", periods=n, freq="D")
y = pd.Series(
    500 + np.arange(n) * 0.8 + 20 * np.sin(2 * np.pi * np.arange(n) / 7) + rng.normal(0, 5, n),
    index=idx,
    name="upi_ok",
)
train, test = y.iloc[:-7], y.iloc[-7:]
print("train", train.index.min().date(), "->", train.index.max().date())
print("test ", test.index.min().date(), "->", test.index.max().date())
assert len(test) == 7
assert train.index.max() < test.index.min()

Naive and seasonal naive

Naive: \(\hat{y}_{T+h} = y_T\) for all horizons (flat line from last train point).

Seasonal naive: \(\hat{y}_{T+h} = y_{T+h-m}\) where \(m\) is the season length (copy the last full season forward).

WHY For strongly seasonal Indian consumer KPIs, seasonal naive is often shockingly hard to beat at short horizons.

WHEN Horizon ≤ a few seasons and weekly shape dominates trend.

Demo 2 — Naive forecast vector

# Offline demo: naive forecast equals last observed level
import numpy as np
import pandas as pd


def naive_forecast(train: pd.Series, horizon: int) -> pd.Series:
    last = float(train.iloc[-1])
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(np.repeat(last, horizon), index=idx, name="naive")


train = pd.Series(
    [10, 12, 11, 13, 12],
    index=pd.date_range("2026-01-01", periods=5, freq="D"),
)
fc = naive_forecast(train, 3)
print(fc.tolist())
assert (fc == 12).all()

Demo 3 — Seasonal naive for period 7

# Offline demo: seasonal naive copies last week
import numpy as np
import pandas as pd


def seasonal_naive(train: pd.Series, horizon: int, period: int = 7) -> pd.Series:
    hist = train.to_numpy(dtype=float)
    out = []
    for h in range(1, horizon + 1):
        out.append(hist[-period + ((h - 1) % period)])
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(out, index=idx, name="seasonal_naive")


vals = [10, 11, 12, 13, 18, 20, 9] * 3
train = pd.Series(vals, index=pd.date_range("2026-02-02", periods=len(vals), freq="D"))
fc = seasonal_naive(train, 7, 7)
print(fc.round(1).tolist())
assert fc.tolist() == vals[-7:]

Drift forecast

Drift draws a line from the first to the last training point and extends that slope:

\(\hat{y}_{T+h} = y_T + h \cdot \frac{y_T - y_1}{T-1}\)

Useful when the KPI has steady growth (or decline) and weak seasonality — e.g. slowly rising weekly active schools for a Noida edtech.

Demo 4 — Drift implementation

# Offline demo: drift baseline
import numpy as np
import pandas as pd


def drift_forecast(train: pd.Series, horizon: int) -> pd.Series:
    y = train.to_numpy(dtype=float)
    slope = (y[-1] - y[0]) / (len(y) - 1)
    preds = y[-1] + slope * np.arange(1, horizon + 1)
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(preds, index=idx, name="drift")


train = pd.Series(
    np.linspace(100, 130, 16),
    index=pd.date_range("2026-03-01", periods=16, freq="D"),
)
fc = drift_forecast(train, 4)
print(fc.round(2).tolist())
assert fc.iloc[-1] > train.iloc[-1]
assert abs(fc.iloc[0] - (train.iloc[-1] + (130 - 100) / 15)) < 1e-6

Error metrics on the holdout

Report MAE (easy to explain in orders), RMSE (penalises big misses), and MAPE (scale-free — careful near zeros). Always compare models on the same chronological test window.

WHY Leadership hears MAE in "orders missed per day"; MAPE alone hides absolute pain on large KPIs.

WHEN Every bakeoff table in the forecast doc.

Demo 5 — Score three baselines

# Offline demo: MAE/RMSE/MAPE bakeoff on synthetic daily orders
import numpy as np
import pandas as pd


def naive_forecast(train, horizon):
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(np.repeat(float(train.iloc[-1]), horizon), index=idx)


def seasonal_naive(train, horizon, period=7):
    hist = train.to_numpy(dtype=float)
    out = [hist[-period + ((h - 1) % period)] for h in range(1, horizon + 1)]
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(out, index=idx)


def drift_forecast(train, horizon):
    y = train.to_numpy(dtype=float)
    slope = (y[-1] - y[0]) / (len(y) - 1)
    preds = y[-1] + slope * np.arange(1, horizon + 1)
    idx = pd.date_range(train.index[-1] + train.index.freq, periods=horizon, freq=train.index.freq)
    return pd.Series(preds, index=idx)


def scores(actual: pd.Series, pred: pd.Series) -> dict:
    e = actual.to_numpy() - pred.to_numpy()
    mae = float(np.mean(np.abs(e)))
    rmse = float(np.sqrt(np.mean(e**2)))
    mape = float(np.mean(np.abs(e) / np.clip(np.abs(actual.to_numpy()), 1e-6, None)) * 100)
    return {"mae": round(mae, 2), "rmse": round(rmse, 2), "mape": round(mape, 2)}


rng = np.random.default_rng(8)
n = 49
idx = pd.date_range("2026-06-01", periods=n, freq="D")
season = np.tile([0, 1, 0, 2, 5, 8, -4], 7)
y = pd.Series(400 + np.arange(n) * 0.3 + season + rng.normal(0, 2, n), index=idx)
train, test = y.iloc[:-7], y.iloc[-7:]
h = len(test)
table = {
    "naive": scores(test, naive_forecast(train, h)),
    "seasonal_naive": scores(test, seasonal_naive(train, h)),
    "drift": scores(test, drift_forecast(train, h)),
}
print(table)
assert table["seasonal_naive"]["mae"] <= table["naive"]["mae"] + 5

Demo 6 — Decision helper: did we beat seasonal naive?

# Offline demo: gate for promoting a candidate model
def promote(candidate_mae: float, seasonal_naive_mae: float, tol: float = 0.0) -> str:
    if candidate_mae + tol < seasonal_naive_mae:
        return "promote_candidate"
    if abs(candidate_mae - seasonal_naive_mae) <= tol:
        return "keep_seasonal_naive_simpler"
    return "reject_candidate"


assert promote(12.0, 15.0) == "promote_candidate"
assert promote(15.0, 15.0) == "keep_seasonal_naive_simpler"
assert promote(18.0, 15.0) == "reject_candidate"
print(promote(11.5, 14.0))

Indian workplace framing

Warehouse leads in Bengaluru rarely need a neural net on day one. A seasonal naive "same weekday last week" plus a written note for festival overrides often runs the shift roster. Use baselines in the weekly readout so finance sees you tried the cheap model. If leadership insists on "AI," still publish the baseline column beside the fancy model — trust rises when you show the gap.

WHY Transparency beats mystique when staffing costs real INR.

WHEN Every forecast review meeting.


Failure modes

  1. Tuning on the test week until ARIMA "wins" — leakage; freeze the holdout.
  2. MAPE on near-zero returns days — explodes; use MAE or exclude closed days.
  3. Seasonal naive with wrong period — copies the wrong weekday.
  4. Reporting only train error — baselines look perfect in-sample by construction for naive.

Hyndman's forecasting texts emphasise baselines; official pandas docs cover date ranges. Keep pins so CI matches.


Explaining this to a workplace stakeholder

In Indian product and ops teams the forecast is a staffing and cash decision, not a notebook trophy. Walk the stakeholder through three questions before any chart: what KPI is defined in the dictionary, what timezone and calendar the daily bucket uses, and what happens on known closure days. If those answers are fuzzy, stop modelling and fix the definition. A crisp definition plus seasonal naive often beats a glamorous model on a muddy series.

When you present numbers, lead with units the listener already uses — paid orders, tickets, settlements — and put the baseline column first. Only then show the candidate. If the candidate wins by a thin margin, say so out loud and recommend keeping the simpler method until the edge is stable across several origins. Document the pinned library versions (numpy==2.1.3, pandas==2.2.3, statsmodels==0.14.4, scipy==1.14.1) in the same ticket so a teammate in another city can reproduce the table next Monday without guessing which wheel file you had installed.

Watch for process failure modes that look like model failure: a marketing push that was not flagged, a payment-rail outage labelled as demand drop, or a festival week treated as ordinary seasonality. Write those caveats next to the MAE. The goal of this course lesson is judgment under workplace constraints — reproducible pins, chronological validation, and a decision rule you can defend in a standup without inventing accuracy.

For remote-friendly handoffs, paste the decision rule and the latest rolling means into the ticket description. Link the official docs you relied on. Avoid pasting secrets, live warehouse credentials, or hard-coded FX rates. Keep the script offline-friendly so continuous integration can re-run every code fence the same way learners do on a laptop in Pune or Hyderabad.

Finally, schedule an owner for the Monday re-run. Models without owners quietly rot after the first festival. A one-page readout with KPI, pins, origins, control MAE, candidate MAE, and the ship-or-keep decision is enough for most Bengaluru and Mumbai ops leads if the numbers are honest.

Verified against numpy 2.1.3, pandas 2.2.3, statsmodels 0.14.4 (+1 more) documentation, September 2026.

Test yourself

  1. What does the naive forecast predict for every horizon?
  2. How does seasonal naive differ when period is 7?
  3. What slope does the drift method use?
  4. True or false: a model that loses to seasonal naive should still ship if it is more complex.
  5. Why must the holdout be chronological?
  6. Name one reason MAPE can mislead.
  7. Which baseline often wins on strong weekly Indian consumer KPIs?
  8. What does MAE mean in "orders per day"?
  9. Which pinned numpy version does this course use?
  10. True or false: you should tune model choices on the final test week until you win.