annotate experiments/scripts/cnbh-syllables/results_plotting/plot_all_results.m @ 100:ae195c41c7bd

- Python results plotting (finally). - Proper results reporting script. - Test on ALL talkers. The results script then generates a summary based on all the various subsets. - Fixed chown users (hopefully sudos to be deleted entirely soon) - More...
author tomwalters
date Mon, 13 Sep 2010 18:34:23 +0000
parents 90eebc3c02ca
children f75123cf39ce
rev   line source
tomwalters@54 1 % Plot a figure based on recognition data from the HTK-AIM features
tomwalters@54 2 % experiments - a reworking of the 'spider plots' by Jess Monaghan,
tomwalters@54 3 % Nick Fyson and Martin Vestergaard.
tomwalters@54 4 % Copyright 2009 University of Cambridge
tomwalters@54 5 % Author: Tom Walters <tcw24@cam>
tomwalters@100 6 function plot_all_results(exp_path, iteration, plot_end_numbers)
tomwalters@100 7
tomwalters@100 8 plot_numbers = true;
tomwalters@100 9 if nargin < 3
tomwalters@100 10 plot_end_numbers = false;
tomwalters@100 11 end
tomwalters@54 12
tomwalters@54 13 % Load the results from the experimental directory
tomwalters@100 14 misclassified = load([exp_path 'misclassified_syllables_iteration_' num2str(iteration)]);
tomwalters@54 15
tomwalters@54 16 % The total number of syllables in the CNBH syllable database
tomwalters@54 17 num_points = 185;
tomwalters@54 18 target_VTL = 15;
tomwalters@54 19
tomwalters@100 20 misclassified(:, 1) = 1 - misclassified(:, 1) / num_points;
tomwalters@54 21
tomwalters@54 22 % The individual data points are plotted as spheres
tomwalters@54 23 sphere_size_x = 1.2;
tomwalters@54 24 sphere_size_y = 0.17;
tomwalters@54 25 sphere_size_z = 2.5;
tomwalters@54 26
tomwalters@54 27 % Get the location of the various points on the spoke pattern
tomwalters@54 28 [spokes, target] = get_spoke_points();
tomwalters@54 29 results = {};
tomwalters@54 30
tomwalters@54 31 % Fill the results vector
tomwalters@54 32 for i = 1:length(spokes)
tomwalters@54 33 results{i} = zeros(length(spokes{1}),1);
tomwalters@54 34 r=round(spokes{i}*10)/10;
tomwalters@54 35 for j = 1:length(spokes{i})
tomwalters@54 36 result = misclassified(misclassified(:,3) == r(j,2) ...
tomwalters@54 37 & misclassified(:,2) == r(j,1), 1);
tomwalters@54 38 if result
tomwalters@54 39 results{i}(j) = result;
tomwalters@54 40 else
tomwalters@54 41 results{i}(j) = 1.0;
tomwalters@54 42 end
tomwalters@54 43 end
tomwalters@54 44 results{i} = 100.0 * results{i};
tomwalters@54 45 spokes{i}(:,2) = target_VTL * target(2) ./ spokes{i}(:,2);
tomwalters@54 46 end
tomwalters@54 47
tomwalters@54 48 figure1 = figure;
tomwalters@54 49 axes1 = axes('Parent',figure1,'YScale','log','YMinorTick','on',...
tomwalters@54 50 'YMinorGrid','on',...
tomwalters@54 51 'XScale','log',...
tomwalters@54 52 'XMinorTick','on',...
tomwalters@54 53 'XMinorGrid','on');
tomwalters@54 54
tomwalters@54 55 shades = 50;
tomwalters@54 56 cmap = fliplr(autumn(shades));
tomwalters@54 57 for i=1:length(spokes)
tomwalters@54 58
tomwalters@54 59 hold on;
tomwalters@54 60 j=1;
tomwalters@54 61 x_pos = spokes{i}(j, 1);
tomwalters@54 62 y_pos = spokes{i}(j, 2);
tomwalters@54 63 z_pos = results{i}(j);
tomwalters@54 64 j=2;
tomwalters@54 65 x_pos_2 = spokes{i}(j, 1);
tomwalters@54 66 y_pos_2 = spokes{i}(j, 2);
tomwalters@54 67 z_pos_2 = results{i}(j);
tomwalters@54 68
tomwalters@100 69 j=1;
tomwalters@100 70
tomwalters@100 71 if (~plot_numbers && plot_end_numbers)
tomwalters@100 72 text(x_pos + 0.3*(x_pos - x_pos_2), y_pos + 0.3*(y_pos - y_pos_2), z_pos + 0.3*(z_pos - z_pos_2) , [num2str(results{i}(j), 3) '%']);
tomwalters@100 73 end
tomwalters@54 74 for j = 1:length(spokes{i})
tomwalters@100 75 if (plot_numbers)
tomwalters@100 76 text(spokes{i}(j,1), spokes{i}(j,2), results{i}(j), [num2str(results{i}(j), 3) '%']);
tomwalters@100 77 else
tomwalters@100 78 [X Y Z] = sphere(10);
tomwalters@100 79 X = sphere_size_x.*X + spokes{i}(j,1);
tomwalters@100 80 Y = sphere_size_y.*Y + spokes{i}(j,2);
tomwalters@100 81 Z = sphere_size_z.*Z + results{i}(j);
tomwalters@100 82 % C = zeros(size(X));
tomwalters@100 83 plot3([spokes{i}(j, 1) spokes{i}(j, 1)], ...
tomwalters@100 84 [spokes{i}(j, 2),spokes{i}(j, 2)], [0 results{i}(j)], '-k.', ...
tomwalters@100 85 'LineWidth', 1, 'Color', [0.8 0.8 0.8]);
tomwalters@100 86 surf(X, Y, Z, ones(size(Z)) .* (results{i}(j)), 'LineStyle', 'none');
tomwalters@100 87 end
tomwalters@54 88 end
tomwalters@100 89 if (~plot_numbers)
tomwalters@100 90 plot3(spokes{i}(:,1), spokes{i}(:,2), results{i}(:), '-', 'LineWidth', 2, ...
tomwalters@100 91 'Color', [0.2 0.2 0.2]);
tomwalters@100 92 end
tomwalters@54 93 end
tomwalters@54 94 % Plot a zero-sized sphere at zero to get the autoscaling of the colour bar
tomwalters@54 95 % correct
tomwalters@54 96 [X Y Z] = sphere(20);
tomwalters@54 97 X = zeros(size(X)) - 1;
tomwalters@54 98 surf(X, X, X, ones(size(Z)) .* 0, 'LineStyle', 'none');
tomwalters@54 99 %colorbar('WestOutside');
tomwalters@54 100 view([-80 60]);
tomwalters@54 101 grid('on');
tomwalters@54 102 xlim([132 224]);
tomwalters@54 103 zlim([0 100]);
tomwalters@54 104 ylim([10 22]);
tomwalters@54 105 set(gca, 'FontSize', 12);
tomwalters@54 106 %set(gca, 'FontName', 'Hoefler Text');
tomwalters@54 107 xlabel('GPR /Hz');
tomwalters@54 108 ylabel('VTL /cm');
tomwalters@54 109 zlabel('Percent correct');
tomwalters@54 110 set(axes1, 'YScale', 'log');
tomwalters@54 111 set(axes1, 'XScale', 'log');
tomwalters@54 112 set(axes1, 'XTick', [132 172 224]);
tomwalters@54 113 set(axes1, 'YTick', [10 15 22]);
tomwalters@54 114 set(axes1, 'YDir', 'reverse');
tomwalters@54 115 set(axes1, 'ZTick', [0 20 40 60 80 100]);
tomwalters@54 116 hold('all');
tomwalters@100 117 %print('-depsc', [exp_path 'results_plot_iteration_' num2str(iteration) '.eps']);
tomwalters@100 118 % saveas(gcf, [exp_path 'results_plot_iteration_' num2str(iteration) '.fig']);
tomwalters@100 119 %!open results_plot.eps
tomwalters@54 120
tomwalters@54 121
tomwalters@54 122