how to fix the below error

3 views (last 30 days)
khalil ur Rehman
khalil ur Rehman on 29 Apr 2019
Commented: khalil ur Rehman on 30 Apr 2019
[fs,history] = sequentialfs(fun, X_train, Y_train, 'cv',c, 'options', opts, 'nfeatures' ,2);
  2 Comments
KSSV
KSSV on 29 Apr 2019
Where/ what error?
khalil ur Rehman
khalil ur Rehman on 30 Apr 2019
THis is my Code:
Error using crossval>evalFun (line 488)
The function
'@(train_data,train_labels,test_data,test_labels)sum(predict(fitcsvm(train_data,train_labels,'KernelFunction','rbf'),test_data)~=test_labels)'
generated the following error:
You cannot train an SVM model for more than 2 classes.
Error in crossval>getFuncVal (line 505)
funResult = evalFun(funorStr,arg(:));
Error in crossval (line 351)
funResult = getFuncVal(1, nData, cvp, data, funorStr, []);
Error in sequentialfs>callfun (line 496)
funResult = crossval(fun,x,other_data{:},...
Error in sequentialfs (line 364)
crit(k) = callfun(fun,x,other_data,cv,mcreps,ParOptions);
Error in Transport_SVM (line 27)
[fs,history] = sequentialfs(fun, X_train, Y_train, 'cv',c, 'options', opts, 'nfeatures' ,2);
Below is error
Error using crossval>evalFun (line 488)
The function
'@(train_data,train_labels,test_data,test_labels)sum(predict(fitcsvm(train_data,train_labels,'KernelFunction','rbf'),test_data)~=test_labels)'
generated the following error:
You cannot train an SVM model for more than 2 classes.
Error in crossval>getFuncVal (line 505)
funResult = evalFun(funorStr,arg(:));
Error in crossval (line 351)
funResult = getFuncVal(1, nData, cvp, data, funorStr, []);
Error in sequentialfs>callfun (line 496)
funResult = crossval(fun,x,other_data{:},...
Error in sequentialfs (line 364)
crit(k) = callfun(fun,x,other_data,cv,mcreps,ParOptions);
Error in Transport_SVM (line 27)
[fs,history] = sequentialfs(fun, X_train, Y_train, 'cv',c, 'options', opts, 'nfeatures' ,2);

Sign in to comment.

Answers (0)

Categories

Find more on Standalone Applications in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!