Time series prediction
Time series prediction involves building models that forecast future values based on past observations in a time-ordered sequence. Unlike standard supervis...
Forecasting Ordered Sequential Data
Time series prediction involves building models that forecast future values based on past observations in a time-ordered sequence. Unlike standard supervised learning where observations are independent, time series data has temporal structure — each observation depends on those before it. Ignoring this structure leads to data leakage and unreliable models.
Classical statistical approaches include ARIMA (AutoRegressive Integrated Moving Average), which models linear relationships between a value and its past values and past forecast errors. SARIMA extends ARIMA to handle seasonal patterns. Exponential smoothing methods weight recent observations more heavily than older ones. These models are interpretable and require relatively little data.
Machine learning approaches treat time series forecasting as a supervised regression problem by creating lag features — past values as input features. A model predicting tomorrow's sales might use sales from the previous seven days as inputs. Feature engineering is crucial: relevant lag windows, rolling means, rolling standard deviations, and calendar features (day of week, month, holiday flags) can dramatically improve forecasts.
Deep learning architectures like LSTMs (Long Short-Term Memory networks) and Transformers capture long-range temporal dependencies and handle multivariate time series naturally. They require substantial data but outperform classical methods on complex, non-linear patterns.
Evaluation of time series models requires temporal validation: the model must always be tested on data from the future relative to its training window. Walk-forward validation simulates real deployment by repeatedly training on all available history up to time t and predicting time t plus one, stepping forward through the dataset.
A concrete example: a retailer predicts weekly demand for 500 products using a gradient boosting model with lag features, rolling averages, and calendar dummies. Walk-forward validation over 52 weeks shows a mean absolute percentage error of 9 percent, far below the 18 percent from a simple moving average baseline.
Exam tip: always emphasize that temporal validation (train on past, test on future) is non-negotiable for time series — random splits introduce future leakage.