Index Ai Academy
Phase 3 · Machine learning · Models

Linear regression

Fit a line, and predict numbers from features.

About 30 minutes · Free account required

Open this lesson Create a free account

Why it matters

Linear regression is the workhorse of prediction and the clearest model to learn from. It predicts a number as a weighted sum of features, so each weight is directly readable: "each extra order adds about $X of lifetime value, holding the rest fixed". It's also exactly what one neuron computes before its activation, so everything here carries straight into neural networks.

What you'll be able to do

  • Write the linear regression model and read its coefficients
  • Fit it by least squares, by hand and with scikit-learn
  • Measure fit with R² and look at residuals
  • Know its limits: straight-line assumptions, outliers and extrapolation

Before this lesson

Next in this phase: Loss functions