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