function show_rap_confusion(conf,nref,nameref,ntest,nametest,stats) % show_rap_confusion(conf,nref,nameref,ntest,nametest) % % conf - confusion matrix % nref - no of reference phonemes. % nameref - filename w/ reference labels (two col - index and name) % ntest - no of test phonemes. % nametest - filename w/ test labels (two col - index and name) % stats - filename w/ stats produces by the c-program ffrapalyzer % cols: num label, count, perc, hits, perchits. Only perc and perdhits % are shown % % setting BW-colormap. Showing MINUS of the entries, as we now work with -log % let the image out ! %imagesc(conf); % if we want the image w/o silence, must do this: %conf = conf(1:(nref-1),1:(ntest-1)) %conf = [conf zeros(nref-1,1); zeros(1,ntest)]; %for pcolor, must complete by some junk last col and row ... conf = [conf zeros(nref,1); zeros(1,ntest+1)]; pcolor(conf); axis ij; c=colormap('gray'); colormap(flipud(c)); colorbar; brighten(-0.3); % a bit of darkening ... %%%%%%%%%%%% labels - ref. - complete with stats. list_phn_ref=[]; ff=fopen(nameref,'r'); for ii=1:nref, dummy=fscanf(ff,'%s',[1 1]); str=fscanf(ff,'%s',[1 1]); % num2str of a string is a wild hack ! str = [str ' ' num2str(round(stats(ii,3)),'%02d') ' ' num2str(round(stats(ii,5)),'%02d')]; if ii==1, list_phn_ref=str; else list_phn_ref=str2mat(list_phn_ref, str); end end fclose(ff); % put them on axis h=gca; set (h,'fontsize',8); %set (h,'fontweight','bold'); set(h,'ytick', (1:nref) + 0.5); set (h,'yticklabel', list_phn_ref) %%%%%%%%%%%%%% labels - test. list_phn_test=[]; ff=fopen(nametest,'r'); for ii=1:ntest, dummy=fscanf(ff,'%s',[1 1]); str=fscanf(ff,'%s',[1 1]); if ii==1, list_phn_test=str; else list_phn_test=str2mat(list_phn_test, str); end end fclose(ff); % put them on axis + some settings h=gca; %set (h,'fontsize',6); %set (h,'fontname','Courier'); set(h,'xtick', (1:ntest) + 0.5); set (h,'xticklabel', list_phn_test)