A grocery chain needs to know how much milk to order for each store next week. Its history shows patterns: a steady trend, weekly peaks on Saturdays, spikes before holidays. Time-series forecasting turns those patterns, plus related signals such as weather, promotions or price changes, into a prediction, ideally with a range (“between 900 and 1,100 cartons”) rather than one number. Utilities forecast power demand, cloud teams forecast server load, and finance teams forecast cash flow the same way.
Methods run from simple to complex. The first check is a naive baseline such as “same as last week” or “same as this week last year.” Classic statistical models such as exponential smoothing and ARIMA, documented in libraries like statsmodels, come next. Machine learning approaches include gradient boosting on engineered lag features (feature engineering), recurrent neural networks, and newer pretrained foundation models such as Google’s TimesFM, which forecast series they weren’t trained on.
Testing needs special care because time only runs one way. Training data must come before test data, which is why ordinary shuffled cross-validation is replaced with time-ordered splits; using future information is a classic form of data leakage. Forecasts also degrade when the world changes, as many demand models did abruptly in 2020, so production forecasts need monitoring like any other model (model drift). Flagging unusual points in a series, rather than predicting the next one, is anomaly detection.
Sources
- statsmodels: Time Series analysis (tsa) — Reference for classic forecasting models in Python, including autoregressive and ARIMA models and exponential smoothing; checked October 24, 2026.
- Google Machine Learning Glossary: time series analysis — Defines time series analysis as analyzing temporal data, with forecasting future demand as an example task; checked October 24, 2026.
- scikit-learn: TimeSeriesSplit — Documents a cross-validator in which each test set comes after its training data in time, unlike standard shuffled folds; checked October 24, 2026.
- Das et al.: A decoder-only foundation model for time-series forecasting — Introduces TimesFM, a pretrained model for zero-shot forecasting on new time series; checked October 24, 2026.