How to specify the criterion for sequentialfs?

2 次查看(过去 30 天)
Hi everyone,
i need some help for the use of the function sequential, i've 28 features and i want to select the subset that minimizes the classification error. I follow the example in the guide of the function
%Applying Sequential Feature Selection
%First we generate a stratified 10-fold partition for the training set:
tenfoldCVP = cvpartition(Y,'kfold',10);
opts = statset('display','iter');
fun = @(XT,yT,Xt,yt)...
(sum(~strcmp(yt,classify(Xt,XT,yT,'quadratic'))));
%We apply forward sequential feature selection on the selected features
inmodel = sequentialfs(fun,Xfea,Y,'cv',tenfoldCVP, 'options',opts);
but the subset that i obtain is of only one feature and the error i obtain is worst of the whole subset features..where am i wrong? i can't find the mistake? i think is the criterion but maybe not..can someone please help me? is very important
Thank you in advance

回答(1 个)

Tsinghua THU
Tsinghua THU 2017-11-28
Do you kown what meaning the sentence starting from fun is.I also meet this question.Strcmp is used to compare two character data.But,my data is data type.Then, I modify strcmp to eq and successfully solve this problem.I hope my example can give you inspiration.

类别

Help CenterFile Exchange 中查找有关 Parallel Computing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by