Time Series

Forecasting, trend and seasonality, horizon, anomaly detection — and validation that respects time, because a random split on temporal data is leakage.

Forecasting

The target is a future value of the series you already have. Features are lags and windows that end at the forecast origin, the naive forecast is the baseline, and beating it is harder than it looks.

Q · When the thing to predict is the same series at a later time, what are the features, what is the baseline, and what does a model have to beat to be worth deploying?
Trend and Seasonality

Most series are a level, a trend, one or more seasonal cycles and calendar effects on top of noise. Model each explicitly or difference it away — and know that a model fitted to one regime is a bet that the trend continues.

Q · What are the components of a series, how does a model account for each, and what happens to a fitted model when the trend breaks?
The Forecast Horizon

One step ahead and twelve steps ahead are different problems with different errors. Direct and recursive strategies trade compounding error against training cost — and the horizon that matters is the one the decision needs.

Q · How far ahead does the decision need a forecast, how should a model produce a multi-step forecast, and how does error grow with distance from the origin?
Time-Series Anomaly Detection
▶ lab

Forecast the series, compare the actual to the forecast, and flag when the residual leaves a band. The band is a threshold with a false-alarm cost, the baseline must know about seasonality, labels are scarce, and an alert with no owner is noise.

Q · How do you flag that a series has done something it should not have, without paging someone every Monday morning — and what makes an alert worth sending?
Forecast Evaluation
▶ lab

Move the origin forward through time and score each forecast against what happened next; never shuffle. Report MAE or RMSE scaled against the naive forecast, per horizon and per segment — and treat MAPE with suspicion near zero.

Q · How do you produce a forecast error that predicts the error the forecast will have in production, and which error metric maps to the decision?