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!