Gradient Descent
Why We Need Gradient Descent
Gradient descent is the optimization engine behind most modern machine learning algorithms.
In the linear regression lesson, we predicted a house price from the house area, number of bedrooms, number of toilets, and number of balconies. We had a dataset of samples:
Each is -dimensional, and each is a real value.
We then put all the samples into a matrix , where each row is one data sample. This made the vector of predicted outputs. Our objective was to minimize the squared error:
We can also divide this by to get the mean squared error, and minimize that instead:
Solving the objective directly gave us:
This has two problems. has to be invertible, or else we need the pseudo-inverse. And for a large dataset, the computation is highly expensive.