used function rankfeatures (consider sample as column)
====================================================
train = [trainFeature trainLabel];
[IDX ,Z] = rankfeatures(trainFeature' ,trainLabel' ,'Criterion', 'ttest');
trainFeature( :,IDX(1:topRankedFeature) ), trainLabel, ... 'diagquadratic' ) % liner/quadratic/diagquadratic etc
====================================================
train = [trainFeature trainLabel];
[IDX ,Z] = rankfeatures(trainFeature' ,trainLabel' ,'Criterion', 'ttest');
%ttest / entropy/ etc...
topRankedFeature = (size(trainLabel,1)) / 2 ;
classify( testFeature( :,IDX(1:topRankedFeature) ), ...
trainFeature( :,IDX(1:topRankedFeature) ), trainLabel, ... 'diagquadratic' ) % liner/quadratic/diagquadratic etc
% transpose as it takes sample as column vector
%ttest / entropy/ etc...
%IDX is the list of indices to the rows in X with the most significant features.
%Z is the absolute value of the criterion used (see below)
Comments
Post a Comment