Statistical Decision Theory and Bayesian Learning · Machine Learning

Linear Regression

Watch lectures

Linear Regression

1. Model

Predict continuous yy as linear function:

ypred=wTx+by_{pred} = w^{T} x + b

Stacked form with bias column: ypred=Xwy_{pred} = X w.

2. Least Squares + Normal Equation

Minimize sum of squared residuals. Gradient zero gives:

w=(XTX)−1XTyw = (X^{T} X)^{-1} X^{T} y

Geometrically: projection of yy onto column space of XX.

points (1,3),(2,5),(3,7) → y = 2x+1, zero residual
X has ones column; solve 2x2 system → w = [1,2]

3. Probabilistic View

Gaussian noise assumption makes least squares = maximum likelihood. Gauss-Markov: under 5 classical assumptions OLS is BLUE (best linear unbiased).

4. Fit Quality

R2=1−RSSTSSR² = 1 - \frac{RSS}{TSS}

R2=1R²=1 perfect, 00 = mean baseline. Adjusted R2R² penalizes junk features. Plot residuals vs predicted: funnel = heteroscedasticity, curve = nonlinearity.

5. Exam Points

  • Derive normal equation — 5 marks, asked nearly every year.
  • 3-point numerical (y=2x+1y=2x+1 style) — 5 marks.
  • R2R² + BLUE statement — 3-5 marks, frequent.
Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

← All Machine Learning modules