Chapter 10
2.7 Training linear regression: Normal equation
2.7 Training linear regression: Normal equation
![]()
Notes
Obtaining predictions as close as possible to target values requires the calculation of weights from the general LR equation. The feature matrix does not have an inverse because it is not square, so it is required to obtain an approximate solution, which can be obtained using the Gram matrix (multiplication of feature matrix () and its transpose ()). The vector of weights or coefficients obtained with this formula is the closest possible solution to the LR system.
Normal Equation:
=
Where:
is the Gram Matrix
The entire code of this project is available in this jupyter notebook.
