This notebook uses the house price dataset from Kaggle and models the house prices using linear regression. 2 main concepts are used:
- Least Squares: Linear models work by trying to fit a line that can predict the output variable such that the deviation from actual output variable values is the least. This minimization is usually carried out by defining an error function that can account for the amount of errors made while fitting a line to the output variable model. The easiest way to do this is to take the difference of the predicted value and the actual value. However, when the differences could be negative and positive, they can cancel each other out and show a good fit even when the fit is bad. Therefore we need that the error function somehow give us only positive values. A solution to this is using the absolute value of the difference. However, minimizing a value requires its gradient to be known, and derivating an absolute value function is difficult. Therefore the commonly used way to get positive values is to square the difference. This is also helpful because it ends up making an error matter much more than just the value, thereby helping the model evaluate an error more seriously. Finally, it is common to take the mean of all the errors made by the model to evaluate the overall errors it has made. This is known as the Least Sqaures (LS) linear model.
- Least Mean Squares: In an online learning environment, we do not have access to all the error terms beforehand. Therefore for online learning, Least Mean Squares (LMS) linear model are more commonly used.