how apply Sequential Feature Selection on 4 classes data?

1 view (last 30 days)
Hi
I have a data set from 4 classes. This data set includes 8 features for each person in every class. The data set also includes 180 persons from 4 classes, so the dimension of data set is 180*8.
I want to apply sequential feature selection on this database, but when I write this order in MATLAB I get an error:
Q(1:45)=0;
Q(46:90)=1;
Q(91:135)=2;
Q(136:180)=3;
Ptrain=[P(1:30,:); P(46:75,:); P(91:120,:); P(136:165,:)];
Ptest=[P(31:45,:); P(76:90,:); P(121:135,:); P(166:180,:)];
Qtrain=[Q(1:30,:); Q(46:75,:); Q(91:120,:); Q(136:165,:)];
Qtest=[Q(31:45,:); Q(76:90,:); Q(121:135,:); Q(166:180,:)];
Qpred = classify(Ptest, Ptrain, Qtrain);
sum=sum(Qtest ~= Qpred);
f = @(Ptrain,Qtrain, Ptest, Qtest) sum(Qtest ~= classify(Ptest, Ptrain, Qtrain));
inmodel = sequentialfs(f,P,Q);
Can anyone help me?

Answers (0)

Community Treasure Hunt

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

Start Hunting!