Stop 09 · Advanced Analytics & Predictive BasicsTopics · 8/8

Forecasting Fundamentals

Part of the Data Analyst Roadmap

In short

How many delivery partners for Diwali week? How much stock for next quarter? Forecasts drive real money. A good one isn't the fanciest model, it's honest about its error.

Projecting a metric into the future using historical patterns — from a simple moving average to more structured methods — always paired with an honest sense of the forecast's uncertainty.

The jaadu stacks colourful kites and string spools in a small shop.

Think of it like this

Stocking up before kite season

A kite seller stocks up weeks before the January kite festival. He looks at last year's sales, how the area has grown, and whether the weather looks windy. He doesn't know exactly, so he keeps a margin. That's forecasting: history, adjustments, and a range.

Watch it happen

A sensible forecasting process

History
Baseline
Model
Backtest
Range

1/5Gather at least two years of clean, regular data so seasons show up twice.

The big ideas

What you need to know

Always have a baseline

Last year's value or last month's value. If your model can't beat it, use the baseline.

Backtest honestly

Train only on data before the test period. Using future data in training gives fake accuracy.

Measure error

MAPE gives average percentage error. MAE gives average error in units. Report one alongside the forecast.

Give a range

'Between 9,000 and 11,000 orders' helps planning more than a falsely precise 10,000.

See it in code

Walk through the code

python
1monthly = df.set_index("date")["orders"].resample("MS").sum()2test = monthly[-6:]3 4baseline = monthly.shift(12)[-6:]5mape = ((test - baseline).abs() / test).mean()6print(f"Seasonal naive MAPE: {mape:.1%}")7 8from statsmodels.tsa.holtwinters import ExponentialSmoothing9train = monthly[:-6]10fit = ExponentialSmoothing(train, trend="add", seasonal="add", seasonal_periods=12).fit()11pred = fit.forecast(6)12print(f"Holt-Winters MAPE: {((test - pred).abs() / test).mean():.1%}")

1/4Monthly totals, with the last six months held back as the test period.

Backtest a seasonal naive baseline against Holt-Winters on the last six months. Use whichever is more accurate.

Save yourself the pain

Common mistakes

Oops

Presenting one exact number with no range.

Do this instead

Give a range and explain what could push it to either end.

Oops

Testing the model on months it was trained on.

Do this instead

Hold out the most recent months, train on earlier ones, and measure error only on the held-out part.

Your mission

Beat the baseline

~40 min

Quick check

Your fancy model has 12% MAPE on the test period. 'Same month last year' has 9%. What should you do?

Go deeper

  1. 1Build a simple forecast (e.g. next month's sales) using a moving average or basic trend line.
  2. 2Learn why every forecast should come with a confidence range, not a single number.
  3. 3Compare your forecast to what actually happened, if the data is available, and learn from the gap.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge