How to specify the criterion for sequentialfs?

5 views (last 30 days)
maria
maria on 26 May 2015
Answered: Tsinghua THU on 28 Nov 2017
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

Answers (1)

Tsinghua THU
Tsinghua THU on 28 Nov 2017
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.

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!