Getting a new error when running sequential forward selection function

1 view (last 30 days)
I am attempting to run the forward feature selection algorithm as follows:
X=combine_6_non;
y=target;
%to avoid random partition
rng(1)
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);
end
But I am getting the error message
Error using crossval>evalFun (line 480)
The function 'fun' generated the following
error:
Attempt to execute SCRIPT
optimfun\private\optimoptioncheckfield as a
function:
C:\Program
Files\MATLAB\R2013b\toolbox\matlab\optimfun\private\optimoptioncheckfield.m
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 =
crossval(fun,x,other_data{:},...
Error in sequentialfs (line 353)
crit(k) =
callfun(fun,x,other_data,cv,mcreps,ParOptions);
Error in feature_selection (line 22)
[fs,history] =
sequentialfs(@fun,X,y,'cv',c,'options',opts)
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)

Community Treasure Hunt

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

Start Hunting!