Minimizing l2 Norm with gradient descent with multiple variables
Show older comments
Hello, im kind of new to matlab. I want to minimize my l2 error with gradient descent. The l2 error depends on two variables g,h which i want to initialize at 0.5 , 0.5. Can someone help me? How do i put my l2-error and steepest gradient descent together?
1 Comment
Torsten
on 19 May 2022
Differentiate the l2-error with respect to g and h.
Then -gradient(l2_error) will be the descent direction for the method of steepest descent.
As soon as the distance between two subsequent values X_i = (g_i,h_i) and X_(i+1) = (g_(i+1),h_(i+1)) coming from the formula
X_(i+1) = X_(i) - r*gradient(l2_error)
for a constant r>0 is less than a small number eps chosen by you, stop the algorithm.
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!