Azzera filtri
Azzera filtri

Why fminsearch does not find the global minimum?

4 visualizzazioni (ultimi 30 giorni)
MRC
MRC il 27 Gen 2014
Modificato: Matt J il 27 Gen 2014
Hi all, I want to minimize the function fun below and I know that it has a global minimum which is par=[1 2 2 3] but fminsearch is not able to find it. Can you help me?
clear all
rho=0.3;
T=100;
load X
%%Build the expected log-likelihood function
mu=zeros(1,n); %vector 1 x n
sigma=[1 rho; rho 1]; %matrix n x n
%alpha_1=par(1)
%alpha_2=par(2)
%beta_1=par(3)
%beta_2=par(4)
fun=@(par) -sum((mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma)...
.* log(mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma)))...
+ ((1-mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma))...
.*log(1-mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma))));
par_guess = [1.3 2.4 2.5 3.6];
par_min = fminsearch(fun, par_guess);

Risposte (1)

José-Luis
José-Luis il 27 Gen 2014
There is no optimizer that can absolutely guarantee that it will find the global optimum. They are all more or less adapted to certain sorts of problems. You could try modifying your starting value.
  3 Commenti
Walter Roberson
Walter Roberson il 27 Gen 2014
That kind of behaviour is typical in functions that have many local minima, or in which the global minimum is in a narrow valley.
Suppose for example you start with sin(10^10 * x) and add to that a small amount of noise such as U[-1,1] / 10^12 . Is there a global minima? Yes. How much effort would be required to find it? More than 10^10 function calls per unit of "x".
If you were to supply gradients for your function you might be able to get something more effective.
Matt J
Matt J il 27 Gen 2014
Modificato: Matt J il 27 Gen 2014
mvncdf(z,mu,sigma), and hence also your overall loglikelihood, has low gradient when abs(z-mu) is large compared to sigma. You need to make sure that the initial values of
z=kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))
do not lie in this low gradient region for all/most z(i). Otherwise, it will be hard for the algorithm to make progress within the MaxIter that you've set.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by