# Backtesting prognoz i walidacja w czasie

EN: **Forecast backtesting and time-series cross-validation** · id `tsbacktesting` · aliases: rolling-origin evaluation, time-series cross-validation, walk-forward validation

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Uczenie maszynowe](https://aiatlasgraph.com/t/ml.md) › [Szeregi czasowe: prognozy, anomalie i klasyfikacja](https://aiatlasgraph.com/t/timeseries.md) › Backtesting prognoz i walidacja w czasie

## Description

- PL: Ocena prognoz na wielu kolejnych punktach startowych (rolling origin) z miarami błędu dobranymi do skali danych i horyzontu.
- EN: Evaluating forecasts over many successive starting points (rolling origin) with error measures suited to data scale and horizon.

## In one sentence

- PL: Sprawdzanie prognozy tak, jakby robiono ją wielokrotnie w przeszłości, za każdym razem tylko na danych dostępnych w tamtym momencie.
- EN: Testing a forecast as if it had been made many times in the past, each time using only data available at that moment.

## Problem it solves

- PL: Model wyglądał świetnie w testach, a po wdrożeniu się myli, bo podejrzał przyszłość albo sprawdzono go tylko raz.
- EN: A model looked great in testing but errs after launch, because it peeked at the future or was checked only once.

## What it does

- PL: Przesuwa punkt startu krok po kroku, za każdym razem prognozuje to, co było dalej, i uśrednia trafność osobno dla każdego horyzontu.
- EN: It moves the starting point step by step, each time forecasting what came next, and averages accuracy separately for each horizon.

## Everyday example

- PL: Zanim firma zmieni sposób planowania grafików, sprawdza, jak nowa prognoza poradziłaby sobie w każdym z ostatnich dwunastu miesięcy.
- EN: Before changing how it plans staff rotas, a company checks how a new forecast would have done in each of the last twelve months.

## This concerns you if you…

- PL: wybierasz między kilkoma metodami prognozy
- PL: chcesz wiedzieć, jak traci trafność dalsza prognoza
- PL: porównujesz serie o bardzo różnej skali
- EN: are choosing between several forecasting methods
- EN: want to know how accuracy drops further ahead
- EN: compare series on very different scales

## Keywords

rolling origin · expanding window · walk-forward validation · MASE · RMSSE · sMAPE · MAPE · forecast horizon · TimeSeriesSplit

## How it works

- PL: Zbiór treningowy rośnie albo przesuwa się oknem; dla każdego punktu startu prognozuje się h kroków i liczy błąd na późniejszych danych, a wyniki uśrednia dla każdego horyzontu. Miary zależne od skali (MAE, RMSE), procentowe (MAPE) i skalowane (MASE, RMSSE) służą innym celom; MASE odnosi błąd do prognozy naiwnej.
- EN: The training set expands or slides as a window; from each origin h steps are forecast and errors computed on later data, then averaged per horizon. Scale-dependent (MAE, RMSE), percentage (MAPE) and scaled (MASE, RMSSE) measures serve different purposes; MASE relates errors to a naive forecast.

## Limits

- PL: Wymaga wielokrotnego trenowania, więc bywa kosztowny. MAPE zawodzi przy wartościach bliskich zera. Ostatnie okna mogą nie przypominać przyszłości, a strojenie na tych samych oknach zawyża wyniki.
- EN: Requires repeated training, so it can be costly. MAPE breaks down near zero values. Recent windows may not resemble the future, and tuning on the same windows inflates results.

## Key terms

- PL: **punkt startu prognozy (origin)**: Moment, do którego model zna dane, tworząc prognozę.
- PL: **MASE**: Błąd prognozy podzielony przez błąd prostej prognozy naiwnej.
- PL: **walk-forward**: Kolejne testy z przesuwanym naprzód końcem danych treningowych.
- EN: **forecast origin**: The point up to which the model knows data when forecasting.
- EN: **MASE**: Forecast error divided by the error of a simple naive forecast.
- EN: **walk-forward**: Repeated tests with the training cut-off moved forward.

## Know first

- [Walidacja krzyżowa (Cross-validation)](https://aiatlasgraph.com/t/crossval.md)
- [Strategie podziału: losowy, czasowy, grupowy (Split strategies: random, temporal, grouped)](https://aiatlasgraph.com/t/splitstrategies.md)

## Sources

- [Forecasting: Principles and Practice (3rd ed.), ch. 5: The forecaster's toolbox (accuracy evaluation, time-series cross-validation)](<https://otexts.com/fpp3/toolbox.html#sec-tscv>) `fpp3-ch5-toolbox-evaluation` · by Rob J Hyndman, George Athanasopoulos
- [MLForecast – End to end walkthrough (documentation)](<https://nixtlaverse.nixtla.io/mlforecast/docs/getting-started/end_to_end_walkthrough.html>) `nixtla-mlforecast-walkthrough` · by Nixtla

---

AI Atlas revision 126 (2026-11-03) · HTML: https://aiatlasgraph.com/t/tsbacktesting · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-03
