diff Code/Classifiers/processKMeansResults.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Code/Classifiers/processKMeansResults.m	Wed Feb 13 11:02:39 2013 +0000
@@ -0,0 +1,35 @@
+
+function [ groupStats, orderedGroups ] = processKMeansResults( ID, idx, ...
+    groupingCriteria, masterFileOutputID, titleName, DEBUG )
+    
+    if( length( idx ) ~= length( groupingCriteria ) )
+        disp('EEEK!');
+        pause;
+    end
+
+    groupIDs = '';
+    groupStr = '';
+    for( i = 1 : length( idx ))
+%         fprintf( fileOutputID, '%s \t %d \n', groupingCriteria(i), idx(i) );
+        gID = [ groupingCriteria(i) num2str( idx(i) )];
+        groupIDs = [ groupIDs ; gID ];
+        groupStr = [ groupStr gID ];
+    end
+
+    % ------------- work out the confusion matrix -------------------------
+
+    groups = unique( groupIDs, 'rows' );
+    noOfGroups = length( groups );
+    orderedGroups = sort(cellstr(groups));
+    groupStats = [];
+    for( i = 1 : noOfGroups )
+        groupStats(i) = ((length( strfind( groupStr, char(orderedGroups(i)))))/length( idx ) ) * 100;
+    end
+    
+    if(DEBUG == 1)
+        figure(1);
+        bar( groupStats );
+        set( gca, 'XTickLabel', orderedGroups );
+        title([ titleName ' ' ID]);
+    end
+end
\ No newline at end of file