mardi 27 juin 2017

Knowing best features in svm classification process using sequentials

I created a features vector of more than 100 elements then used multiclass SVM to classify (train,test) my samples. I do want to know which features where the most valuable and contributed the most in a successful identification so tried using sequentialfs and didn't understand the example given in Matlab documentation.

So I'll provide a simpler one bellow and would like to know how to add sequentialfs in it:

%% SVM Multiclass Example 
% SVM is inherently one vs one classification. 
% This is an example of how to implement multiclassification using the 
% one vs all approach. 

TrainingSet=[ 1 10;2 20;3 30;4 40;5 50;6 66;3 30;4.1 42]; 
TestSet=[3 34; 1 14; 2.2 25; 6.2 63]; 
GroupTrain=[1 1 2 2 3 3 2 2]; 
results = multisvm(TrainingSet, GroupTrain, TestSet); 
disp('multi class problem'); 
disp(results);

multisvm code:

numClasses=length(u);
result = zeros(length(TestSet(:,1)),1);
%build models
for k=1:numClasses
    %Vectorized statement that binarizes Group
    %where 1 is the current class and 0 is all other classes
    G1vAll=(GroupTrain==u(k));
    models(k) = svmtrain(TrainingSet,G1vAll);
end
%classify test cases
for j=1:size(TestSet,1)
    for k=1:numClasses
        if(svmclassify(models(k),TestSet(j,:))) 
            break;
        end
    end
    result(j) = k;
end

Aucun commentaire:

Enregistrer un commentaire