annotate 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
rev   line source
Dawn@4 1
Dawn@4 2 function [ groupStats, orderedGroups ] = processKMeansResults( ID, idx, ...
Dawn@4 3 groupingCriteria, masterFileOutputID, titleName, DEBUG )
Dawn@4 4
Dawn@4 5 if( length( idx ) ~= length( groupingCriteria ) )
Dawn@4 6 disp('EEEK!');
Dawn@4 7 pause;
Dawn@4 8 end
Dawn@4 9
Dawn@4 10 groupIDs = '';
Dawn@4 11 groupStr = '';
Dawn@4 12 for( i = 1 : length( idx ))
Dawn@4 13 % fprintf( fileOutputID, '%s \t %d \n', groupingCriteria(i), idx(i) );
Dawn@4 14 gID = [ groupingCriteria(i) num2str( idx(i) )];
Dawn@4 15 groupIDs = [ groupIDs ; gID ];
Dawn@4 16 groupStr = [ groupStr gID ];
Dawn@4 17 end
Dawn@4 18
Dawn@4 19 % ------------- work out the confusion matrix -------------------------
Dawn@4 20
Dawn@4 21 groups = unique( groupIDs, 'rows' );
Dawn@4 22 noOfGroups = length( groups );
Dawn@4 23 orderedGroups = sort(cellstr(groups));
Dawn@4 24 groupStats = [];
Dawn@4 25 for( i = 1 : noOfGroups )
Dawn@4 26 groupStats(i) = ((length( strfind( groupStr, char(orderedGroups(i)))))/length( idx ) ) * 100;
Dawn@4 27 end
Dawn@4 28
Dawn@4 29 if(DEBUG == 1)
Dawn@4 30 figure(1);
Dawn@4 31 bar( groupStats );
Dawn@4 32 set( gca, 'XTickLabel', orderedGroups );
Dawn@4 33 title([ titleName ' ' ID]);
Dawn@4 34 end
Dawn@4 35 end