how to fix the below error

조회 수: 5 (최근 30일)
khalil ur Rehman
khalil ur Rehman 2019년 4월 29일
댓글: khalil ur Rehman 2019년 4월 30일
[fs,history] = sequentialfs(fun, X_train, Y_train, 'cv',c, 'options', opts, 'nfeatures' ,2);
  댓글 수: 2
KSSV
KSSV 2019년 4월 29일
Where/ what error?
khalil ur Rehman
khalil ur Rehman 2019년 4월 30일
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);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by