Why fminsearch does not find the global minimum?
6 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
José-Luis
2014-1-27
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 个评论
Walter Roberson
2014-1-27
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
2014-1-27
编辑:Matt J
2014-1-27
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!