TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
fisherCrit.m
Go to the documentation of this file.
1 function [listeFeatures, FC] = fisherCrit(features, labels, nbClasses)
2 
3 nbFeatures = size(features, 2);
4 nbSamples = size(features, 1);
5 
6 FC = zeros(nbFeatures,1);
7 
8 meanSamples = mean(features,1);
9 
10 %pour chaque feature on calcul son critere de fisher
11 for(iFeat = 1:nbFeatures)
12  inter = 0;
13  intra = 0;
14  for(iClass =1:nbClasses)
15  meanClass = mean(features(labels==iClass,iFeat));
16  inter = inter + sum(labels==iClass)*(meanClass - meanSamples(iFeat))^2;
17  for(spl = find(labels==iClass)')
18  intra = intra + (features(spl,iFeat) - meanClass)^2;
19  end
20  end
21  FC(iFeat) = inter / intra;
22 end
23 FC(isnan(FC)) = 0;
24 [FC listeFeatures] = sort(FC,'descend');
25 listeFeatures = listeFeatures';
fisherCrit
function fisherCrit(in features, in labels, in nbClasses)