# Prognozowanie modelami ML na cechach opóźnień

EN: **Machine-learning forecasting with lag features** · id `mlforecasting` · aliases: global forecasting models, lag-feature forecasting, cross-learning forecasting

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) › Prognozowanie modelami ML na cechach opóźnień

## Description

- PL: Prognozowanie przez regresję na cechach opóźnień, statystykach okien i kalendarzu, zwykle jednym globalnym modelem drzew gradient boosting dla wielu serii.
- EN: Forecasting by regression on lag, rolling-window and calendar features, usually with one global gradient-boosted tree model across many series.

## In one sentence

- PL: Zamiana historii pomiarów w tabelę wskazówek, takich jak wczoraj, tydzień temu czy dzień tygodnia, z której zwykły model uczy się przewidywać.
- EN: Turning measurement history into a table of clues, such as yesterday, last week or weekday, from which an ordinary model learns to predict.

## Problem it solves

- PL: Masz tysiące powiązanych serii i wiele czynników, jak ceny czy święta, których klasyczne modele jednej serii nie umieją łatwo uwzględnić.
- EN: You have thousands of related series and many drivers, like prices or holidays, that classic single-series models struggle to use.

## What it does

- PL: Jeden wspólny model uczy się naraz na wszystkich seriach, więc produkt z krótką historią korzysta z wzorców podobnych produktów.
- EN: One shared model learns from all series at once, so a product with a short history borrows patterns from similar products.

## Everyday example

- PL: Sieć sklepów przewiduje sprzedaż każdego produktu w każdym sklepie, biorąc pod uwagę ostatnie tygodnie, planowane promocje i nadchodzące święta.
- EN: A store chain predicts sales of every product in every store, taking into account recent weeks, planned promotions and upcoming holidays.

## This concerns you if you…

- PL: prognozujesz sprzedaż wielu produktów lub lokalizacji
- PL: znasz z góry ceny, promocje lub kalendarz wydarzeń
- PL: umiesz już trenować modele na danych tabelarycznych
- EN: forecast sales for many products or locations
- EN: know prices, promotions or event calendars in advance
- EN: can already train models on tabular data

## Keywords

LightGBM · lag features · rolling window features · global models · exogenous variables · recursive strategy · direct multi-step forecasting · mlforecast · M5 competition · skforecast

## How it works

- PL: Z szeregu buduje się cechy: wartości opóźnione, średnie kroczące, cechy kalendarza i znane zmienne zewnętrzne; cel bywa wcześniej zróżnicowany lub skalowany. Model regresyjny, często drzewa gradient boosting, trenuje się na wszystkich seriach naraz. Dalsze kroki prognozuje się rekurencyjnie, podstawiając własne prognozy, albo osobnym modelem dla każdego horyzontu.
- EN: Features are built from the series: lagged values, rolling means, calendar features and known exogenous variables; the target is often differenced or scaled first. A regression model, often gradient-boosted trees, is trained on all series at once. Later steps are forecast recursively by feeding back predictions, or with a separate model per horizon.

## Limits

- PL: Łatwo o wyciek informacji z przyszłości przy budowie cech i podziale danych. Drzewa nie ekstrapolują trendu poza zakres treningu, więc często trzeba różnicować cel. Wymaga starannej walidacji w czasie i inżynierii cech.
- EN: Future-information leakage easily creeps into feature building and data splits. Trees do not extrapolate trends beyond the training range, so the target often needs differencing. Requires careful time-based validation and feature engineering.

## Key terms

- PL: **cecha opóźnienia (lag)**: Wartość szeregu sprzed określonej liczby kroków użyta jako wejście.
- PL: **model globalny**: Jeden model trenowany na wielu seriach zamiast osobnego dla każdej.
- PL: **strategia rekurencyjna / bezpośrednia**: Podstawianie własnych prognoz albo osobny model dla każdego horyzontu.
- EN: **lag feature**: A series value from a fixed number of steps ago used as input.
- EN: **global model**: One model trained on many series instead of one per series.
- EN: **recursive / direct strategy**: Feeding back own forecasts versus a separate model per horizon.

## Know first

- [Gradient boosting (XGBoost, LightGBM) (Gradient-boosted trees)](https://aiatlasgraph.com/t/gradientboosting.md)
- [Przygotowanie cech (feature engineering) (Feature engineering and preprocessing)](https://aiatlasgraph.com/t/featureeng.md)

## Sources

- [M5 accuracy competition: Results, findings, and conclusions](<https://statmodeling.stat.columbia.edu/wp-content/uploads/2021/10/M5_accuracy_competition.pdf>) `makridakis-m5-accuracy-2022` · by Spyros Makridakis, Evangelos Spiliotis, Vassilios Assimakopoulos
- [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/mlforecasting · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-03
