Azzera filtri
Azzera filtri

How to specify the criterion for sequentialfs?

2 visualizzazioni (ultimi 30 giorni)
maria
maria il 26 Mag 2015
Risposto: Tsinghua THU il 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

Risposte (1)

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

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by