How to specify the criterion for sequentialfs?

조회 수: 2 (최근 30일)
maria
maria 2015년 5월 26일
답변: Tsinghua THU 2017년 11월 28일
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