How to specify the criterion for sequentialfs?

2 Ansichten (letzte 30 Tage)
maria
maria am 26 Mai 2015
Beantwortet: Tsinghua THU am 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

Antworten (1)

Tsinghua THU
Tsinghua THU am 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.

Kategorien

Mehr zu Parallel Computing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by