Gradient descent, anything better than golden section line search

In summary, the person is working on a project that involves finding a matrix defined by a third degree polynomial. They are using a gradient descent technique, specifically the golden section line search implemented in MATLAB. However, this method sometimes gets stuck in local minima. The person has tried using a Quasi-Newton method but it resulted in MATLAB getting stuck due to memory issues. They then tried a stochastic approach, simulated annealing, but are having trouble determining when to stop the search. They have tried using iterations and a time limit, but the annealing process sometimes randomizes its trusted region and may not be close to the minimum when stopped. The code for the simulated annealing is also included.
  • #1
alecrimi
18
0
Hi
This is a long story, I make it short:
I am working in a project where I need to find a matrix defined by a third degree polynomial, the solution can be found iteratively using a gradient descent technique, I am using the golden section line search already implemented in MATLAB (with the code described below).
The algorithm looks powerful (it finds automatically the perfect step), but unfortunately the golden section line search does not avoid being stuck in local minima. How can I implement more efficiently this. The problem is that sometime it converges and sometimes no (sometimes is not science :-).

%Initial third degree polynomial
Cest = initial_guess;
normdev=inf ;
stepsize=inf;

%Stopping condition
stopping_condition = 10^(-5) *norm(X*X'/no_samples,'fro');

while abs(normdev*stepsize) > stopping_condition
%Third degree polynomial
dnew = Cest - 1/no_samples*(X*X' - 2/sigma^2 * (Cest*Cest'*Cest-Cest*B'*Cest));
%Find the best stepsize as a minimum using the goldensection line search
stepsize = fminbnd( @(stepsize) step(stepsize,Cest,dnew,X*X',B,sigma,no_samples),-.1,.1);

%Update
Cest = Cest + stepsize*dnew;
normdev = norm(dnew,'fro');
end

function error = step(stepsize,Cest,dnew,XX,B,sigma,no_samples)
Cest = Cest + stepsize*dnew;
error = norm(Cest - 1/no_samples*(XX - 2/sigma^2 * (Cest^3-Cest*B*Cest)),'fro');

I tried :
%Quasi-Newton
stepsize = fminunc( @(stepsize) step(stepsize,Cest,dnew,X*X',B,sigma,no_samples),dnew);
But MATLAB get stuck (no heap memory) probably due the fact that this function is suppose to be used when we don't have a trust region.

Any suggestions ?
 
Physics news on Phys.org
  • #2
So I moved to a stochastic approach (gradient descent approaches find only local minima, stochastic approaches can find global minima) like simulated annealing, now the problem is that with my objective function the default convergence never happens.
So I have to force annealing to stop. BUT WHEN ?
I tried after some iteration but the annealing has the defect that at some point it randomize his trusted region and maybe when I stop it, it is really far from the minima (I am using too many iterations). And I have the same problem with time limit. So when I should stop the minima the search ?

Code using the simulated annealing:
Cest = initial_point;

lb = -20*ones(size(Cest));
ub = 20*ones(size(Cest));

options = saoptimset('MaxIter',300) ;

Cest = simulannealbnd(@(funcobj) myfuncobj(Cest ,X*X',B,sigma,no_samples),Cest,lb,ub, options);


function error = myfuncobj( Cest, XX, B, sigma, no_samples)
error = norm(Cest - 1/no_samples*(XX - 2/sigma^2 * (Cest^3-Cest*B*Cest)),'fro');
 

1. What is gradient descent and how does it work?

Gradient descent is an optimization algorithm used in machine learning to minimize the error or loss function of a model. It works by iteratively adjusting the parameters of the model in the direction of steepest descent of the error surface, until the minimum error is reached.

2. What is the purpose of using gradient descent?

The purpose of using gradient descent is to find the optimal parameters of a model that will minimize the error or loss function. This allows the model to make more accurate predictions on new data.

3. What is the golden section line search method and how does it compare to gradient descent?

The golden section line search method is a one-dimensional optimization algorithm used to find the minimum of a function. It works by dividing the search interval into smaller intervals and evaluating the function at these points. While gradient descent is a more general optimization algorithm that can be used in higher dimensions, the golden section line search is specifically designed for one-dimensional optimization problems.

4. Is there anything better than the golden section line search method?

Yes, there are other optimization algorithms that can outperform the golden section line search method. For example, the Brent method, which combines the bisection method and parabolic interpolation, is often more efficient and accurate than the golden section line search method.

5. Can gradient descent be improved upon?

Yes, there are various techniques that can improve the performance of gradient descent. For example, using momentum or adaptive learning rates can help the algorithm converge faster and avoid getting stuck in local minima. Additionally, more advanced optimization algorithms like Adam or RMSprop can also be used to improve upon basic gradient descent.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
3K
  • Aerospace Engineering
Replies
2
Views
7K
Back
Top