I understood that gradient descent is needed to find the local extremum of any function, but how is it applied to the linear classifier (single matrix, two classes case, for example)? How does it step by step modify the elements of this matrix?
Let us break this down into a few steps for better understanding:
Your linear classifier let us represent it with an equation y :
y = m1x1 + m2x2 + m3x3 + .....where y takes into account all the features you have provided, multiplies it with random weights
Now you need to find the ideal values of
min order for you to get maximum accuracy. You could ofcourse brute force your way but there are optimized ways to do this. This is where gradient descent comes into play.
Gradient descent optimizes the values of
mby taking into account the final output and understanding which features are important and which are not.
The loss function determines what is to be compared. In your example you are talking about two classes, in this case, the loss function will be a simple cross entropy loss function, that tells you how far you are from the actual values.
The loss is the difference in the predicted value vs actual value.
The only way you can minimize this loss is by playing around with weights. In order to understand which weights to play around with, you use simple first order derivatives to associate impact of output with each feature multiple by its weight.
Gradient descent is then used to compute the next set of weights that helps you reduce the loss by looking at the direction of weights to be used.
When you run this thru multiple epochs and steps, it stabilizes this weight matrix thereby improving performance of your model.
Hope this clears your question, would be happy to elaborate in case you need it.