Samuel Rivera Notes: auto gets labels for features usking k-means clustering syntax: labels = autoLabel( featureVect ) Inputs: featureVect: (d by N) column vector of trials Outputs: labels: (1 by N) vector of all labels (0 or 1 )
0001 % Samuel Rivera 0002 % Notes: auto gets labels for features usking k-means clustering 0003 % 0004 % syntax: labels = autoLabel( featureVect ) 0005 % 0006 % Inputs: 0007 % featureVect: (d by N) column vector of trials 0008 % 0009 % Outputs: 0010 % labels: (1 by N) vector of all labels (0 or 1 ) 0011 0012 function labels = autoLabel( featureVect ) 0013 0014 numSamples =size(featureVect,2); 0015 0016 featureVect = featureVect - repmat( min( featureVect,[],2), [1,numSamples]); 0017 M = max( featureVect,[],2); 0018 featureVect( M~= 0,:) = featureVect( M~= 0,:)./repmat( M(M~=0), [1,numSamples ] ); 0019 0020 labels = kmeans(featureVect',2)-1; 0021 labels = labels'; 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031