How Normal Equation Works?
Solve for analytically.
Pros
- No need to choose
- No need feature scaling
- Don’t need to iterate
Cons
- Slow when having a lot of features (not using when )
Algorithm
- : Design matrix, takes all input data (including )
Algorithm:
set to 0
Result:
Non-invertible
In matlab/octave, pinv()
will handle the case.
Causes of non-invertible:
- Redundant features (linearly dependent)
- Delete one of the dependent feature
- Too many features (e.g. )
- Delete some features
- Regularization