Notes

Time Series Forecasting

Forecasting a time series is what you do when the thing you want to predict arrives in order: tomorrow’s demand, next week’s sales, the next hour’s energy load. The key twist is that the past isn’t just “more data” — it’s structured history, and that structure carries signal.

What it is and what makes it different

Time series forecasting predicts future values of a variable indexed by time. Unlike standard regression, you can’t freely shuffle rows: the model must respect time order to avoid leaking future information into training. Forecasting problems typically involve patterns like:

  • Trend (a long-term rise or fall, like growing subscribers)
  • Seasonality (repeating cycles, like weekly shopping peaks)
  • Autocorrelation (recent values influencing near-future values)
  • External drivers (promotions, holidays, weather)
How supervised learning fits in

In supervised ML, forecasting is commonly turned into a “predict the next value” dataset by creating lag features (yesterday’s value, last week’s value), rolling statistics (7-day average), and calendar features (day-of-week). The target might be one-step-ahead (t+1) or multi-step (t+1…t+H). A typical baseline is a linear model; stronger tabular approaches include gradient boosting (e.g., XGBoost) trained on engineered time features.

Why it matters in practice

Many pipeline decisions depend on treating time correctly:

  • Use time-based splits (train on past, validate on later periods), not random cross-validation.
  • Choose metrics that match business cost (MAE, RMSE, MAPE) and horizon.
  • Handle missing timestamps, outliers, and changing behavior (concept drift).

Examples include forecasting call-center volume to staff shifts, predicting product demand to set inventory, or estimating future fraud rates to allocate review capacity.

Time Series Forecasting is a supervised learning task that predicts future values of a variable from its past observations and related covariates, while respecting temporal order and dependencies (e.g., forecasting next week’s demand from historical sales and promotions). It matters because many real-world decisions depend on accurate forward-looking estimates, and ignoring time structure causes leakage, biased evaluation, and unreliable deployment performance.

Think of keeping a diary of something that changes over time—like daily temperatures, your step count, or a store’s sales. After a while, you start to notice patterns: weekends look different from weekdays, summers look different from winters. Time Series Forecasting is when an AI system uses a history like that to predict what comes next.

It’s used for things like predicting tomorrow’s electricity demand, next month’s product sales, or whether traffic will be heavy at 8 a.m. The key idea is that the order of the data matters, because yesterday and last week can help explain what happens next.