Problem with optimization using fminunc

조회 수: 7 (최근 30일)
Christos Papadimitriou
Christos Papadimitriou 2016년 8월 10일
댓글: John BG 2016년 8월 11일
Using fminunc for optimization matlab show me the message
"Computing finite-difference Hessian using user-supplied objective function."
The options I use in fminunc are:
options=optimset('Display','notify','MaxIter',10^6,'MaxFunEvals',10^6,'TolX',10^-30,'TolFun',10^-30, 'GradObj','off','Hessian','off','LargeScale','off','LinesearchType','cubicpoly','InitialHessType','user-supplied','InitialHessMatrix',1,'HessUpdate','steepdesc')
The objective function is:
function val = custom_pdf(A,data);
n=3; m=2;
sigma=A(m+2);esi=exp(sigma); lamda=A(m+3);ela=exp(lamda);
dep=data(1:n,1); regs=data(1:n,2:m+2); beta=A(1:m+1)'; ee=dep-regs*beta; fact=ee./esi;
val=(2./esi).*(normpdf(fact)).*(normcdf(-ela.*fact));
What I must to do to solve this problem?

채택된 답변

John BG
John BG 2016년 8월 10일
If you remove the 'LinesearchType' option, the error disappears, just a warning
options=optimset('Display','notify','MaxIter',10^6,'MaxFunEvals',10^6,'TolX',10^-30,'TolFun',10^-30, 'GradObj','off','Hessian','off','LargeScale','off','LinesearchType','cubicpoly','InitialHessType','user-supplied','InitialHessMatrix',1,'HessUpdate','steepdesc')
Error using optimset (line 209)
The LineSearchType option is no longer valid. It was only used by the
Gauss-Newton algorithm, which is no longer used in Optimization toolbox
solvers.
but you still have to define the variable 'data' to avoid further errors.
I tried random data values, but again, A and the function custom_pdf() are not defined either which makes any further answering difficult.
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG
  댓글 수: 1
Christos Papadimitriou
Christos Papadimitriou 2016년 8월 11일
I remove the 'LinesearchType' option but the problem still remains.
The data I use are random from standard normal, and the custom_pdf(A,data)=val=(2./esi).*(normpdf(fact)).*normcdf(-ela.*fact)) Is it possible the problem in optimization occurs because I have the version 7 of Matlab.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Alan Weiss
Alan Weiss 2016년 8월 11일
Your options make no sense to me. Remove all your options and I suspect that your problems will vanish.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 3
Alan Weiss
Alan Weiss 2016년 8월 11일
Yes, you have an old version of MATLAB, but you should still be able to use it to minimize. Take a look at the documentation sections about what to do when the solver fails and what to do when the solver might have succeeded or when the solver takes too long.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
John BG
John BG 2016년 8월 11일
Herr Weiss MATLAB does not get old, Christos just has an outdated version, he only needs to drive test R2016a

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by