Making the Design Matrix

Adding the constant term:

$$ (X^T X)^{-1} X^T y $$

Solving the Linear System

The exact math from lecture.

$$ (X^T X)^{-1} X^T y $$

More numerically stable and computationally efficient.

$$ A\theta = b $$$$ X^T X \theta = X^T y $$

Using a software package:

Making Predictions

Examining the Residuals

Root Mean Squared Error

$$ \sqrt{\frac{1}{n} \sum_{i=1}^n \left(y_i - \hat{y}_i\right)^2 } $$

Improving the Model

What can we say about the magnitudes of the weights?

Rescaling the features

Residual Analysis

Computing $R^2$