Error while using newpnn for classification and then fminunc for optimization.
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I am using newpnn for classification, where i have input vector X, target vector Tc and output vector Yc. I need to optimize the newpnn function by varying the spread value in it to get the maximum correct classifications.(newpnn is an inbuilt function and has spread in its code for output estimation). Here is the code i wrote for the same:
T=ind2vec(Tc);
net=newpnn(X,T,spread);
Y= net(X);
Yc=vec2ind(Y);
Penalty=@(spread, Tc)((Tc-Yc).^2);
out= Penalty(spread, Tc);
spread0= 1;
[spread, fval,exitflag,output]=fminunc(out,1);
On running the script, I am getting this error:
Error using optimfcnchk (line 288)
FUN must be a function, a valid string expression, or an inline function object.
Error in fminunc (line 240)
funfcn = optimfcnchk(FUN,'fminunc',length(varargin),funValCheck,gradflag,hessflag);
Error in join (line 20)
[spread, fval,exitflag,output]=fminunc(out,1);
Any help/guidance/suggestion would be appreciated.
댓글 수: 2
by varying the spread value in it to get the maximum correct classifications.
You cannot use fminunc to optimize an integer-valued function. fminunc is designed for functions f(x) that vary continuously (and differentiably) as a function of a continuously varying vector x.
Ritesh Kalbande
2015년 2월 20일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!