Phase 02: ML Fundamentals

Time Series Fundamentals

Past performance does predict future results -- if you check for stationarity first. Language: Python Decompose a time series into trend, seasonality, and residual components and test for stationarity. Implement lag features and rolling statistics to convert a time series into a supervised learning problem. Build a walk-forward validation framework that prevents future data from leaking into training. Explain why random train/test splits are invalid for time series and demonstrate the performance gap versus proper temporal splits. You have data ordered by time. Daily sales, hourly temperature, per-minute CPU usage, weekly stock prices. You want to predict the next value, the next week, the next quarter. You reach for your standard ML toolkit: random train/test split, cross-validation, feature matrix in, prediction out. Every step is wrong. Time series breaks the assumptions that standard ML relies on. Samples are not independent -- today's temperature depends on yesterday's. Random splits leak future information into the past. Features that look great in backtest fail in production because they rely on patterns that shift over time. A model that gets 95% accuracy with random cross-validation might get 55% with proper time-based evaluation. The difference is not a technicality. It is the difference between a model that works on paper and one that works in production. This lesson covers the fundamentals: what makes time data…

Time Series Fundamentals: Past performance does predict future results -- if you check for stationarity first. Language: Python

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.