Skip to content
Predict.ai

Accuracy & evaluation

How to backtest a forecasting model

Backtesting asks the model to forecast a past window it was not trained on, then scores the miss. Walk the window forward so you see many 'futures,' not one lucky test month.

Updated Aug 21, 2026·9 min read

Why a single test month lies

One holdout is a story. If that month contained your only heatwave, the model that memorized heat looks like a genius. If it did not, the model that ignores weather looks fine until July. Walk the origin forward. Average the pain.

Walk-forward folds

Walk-forward backtest foldsFold 1Fold 2Fold 3Fold 4Train (past)Test = live horizon
Each row is a fake 'today.' Gray is what the model may see. Lime is the horizon it must predict. Slide forward so you are not grading one lucky month.

Walk-forward, pictured

Train on the past. Predict the next horizon — the same length you will serve. Slide the origin. Repeat. Expanding windows keep more history each time. Sliding windows forget a distant regime on purpose. Both are legal. Random k-fold is not.

Match refit cadence. A model you would retrain weekly should not be scored as if it were fit once in January. That gap is how notebooks beat production.

Leakage to hunt

  • Rolling stats that include the day you are predicting.
  • A covariate you will not have at 6am (tomorrow’s temperature, not this morning’s forecast).
  • Target leakage through a slowly-arriving ‘daily sales’ file that actually settles three days later.
  • Standardizing with the whole series, including the test window.

How to read the results

Report the same metric the business will feel, versus a naive baseline, with grain and horizon in the sentence. Look at folds individually. Four lovely folds and one disaster is a seasonal hole, not an average to round away.

Plot error against volume. Models that only win on tiny SKUs are winning a trivia contest. Slice promotions on vs off. If the model only wins when nothing happens, you have a rest-day forecaster.

How often to rerun

Whenever you change features, horizon, or the data contract — and on a schedule anyway. Tournaments that run themselves are how you notice a champion dying in week three instead of at the QBR.

FAQ

What is backtesting in forecasting?
You hide a slice of history, train on what came before it, forecast that slice, and score the error. Then you slide the slice forward and do it again. The average of those scores is closer to live error than a single holdout.
What is walk-forward validation?
A backtest that keeps time's arrow. Train up to t, predict t+1…t+h, then move t forward. You never train on a Tuesday to predict the Monday before it.
How many folds do I need?
Enough to cover the seasons you care about. Four folds that all sit in Q4 will bless a holiday-happy model. Spread them, and keep the fold horizon equal to the live horizon.

Keep going

Try it on your data.

Connect an outcome and its history. Predict.ai finds the drivers, races the models, and keeps the forecast live — in the workspace, over the API, and through agents.