MATLAB Answers

0

how to fix the below error

Asked by khalil ur Rehman on 29 Apr 2019
Latest activity Commented on by khalil ur Rehman on 30 Apr 2019
[fs,history] = sequentialfs(fun, X_train, Y_train, 'cv',c, 'options', opts, 'nfeatures' ,2);

  2 Comments

KSSV
on 29 Apr 2019
Where/ what error?
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.

0 Answers