MATLAB Answers

Getting a new error when running sequential forward selection function

2 views (last 30 days)
Rishika Sen
Rishika Sen on 19 Aug 2016
Commented: Brendan Hamm on 19 Aug 2016
I am attempting to run the forward feature selection algorithm as follows:
%to avoid random partition
c = cvpartition(y,'k',10);
opts = statset('display','iter');
[fs,history] = sequentialfs(@fun,X,y,'cv',c,'options',opts)
The function fun is as follows:
function err = fun(XT,yT,Xt,yt)
model = svmtrain(XT,yT,'Kernel_Function', 'rbf', 'boxconstraint', 1);
err = sum(svmclassify(model, Xt) ~= yt);
But I am getting the error message
Error using crossval>evalFun (line 480)
The function 'fun' generated the following
Attempt to execute SCRIPT
optimfun\private\optimoptioncheckfield as a
Error in crossval>getFuncVal (line 497)
funResult = evalFun(funorStr,arg(:));
Error in crossval (line 343)
funResult = getFuncVal(1, nData, cvp,
data, funorStr, []);
Error in sequentialfs>callfun (line 485)
funResult =
Error in sequentialfs (line 353)
crit(k) =
Error in feature_selection (line 22)
[fs,history] =
Previously This program was executing at ease. I did not face any problem while executing the same program before. But now I am. My MATLAB version is R2013b. This error appeared suddenly one fine day. I have used the command
which fun -all
It has showed me only one file and that is the file I want to execute. I tried changing the name of the file. But to no avail. Now I am unable to execute other functions too. What should I do?

  1 Comment

Brendan Hamm
Brendan Hamm on 19 Aug 2016
Look at the file:
C:\Program Files\MATLAB\R2013b\toolbox\matlab\optimfun\private\optimoptioncheckfield.m
It seems for some reason this is not a function but a script. This leads me to believe this file may have been edited. Best case scenario you accidentally deleted a letter from the function declaration. If not, you may need to contact support to have them provide you with a new copy of this file.

Sign in to comment.

Answers (0)

Sign in to answer this question.