|
| 1 | +% |
| 2 | +% Generate Some Nice Plots for my transpalette |
| 3 | +% |
| 4 | +clear all |
| 5 | +close all |
| 6 | +clc |
| 7 | + |
| 8 | +FontSize= 18; |
| 9 | + |
| 10 | + |
| 11 | +% |
| 12 | +% CSV formatted as follows: |
| 13 | +% |
| 14 | +% NCC,NSC2,NSC3,NSC5,NN,P-BP,P-MSE |
| 15 | +% line1: scores on original data |
| 16 | +% line2: execution times on original data |
| 17 | +% line3: scores on pca data |
| 18 | +% line4: execution times on pca data |
| 19 | +% |
| 20 | +performance_MNIST = dlmread('scores_and_times_MNIST.csv', ','); |
| 21 | +performance_ORL = dlmread('scores_and_times_ORL.csv', ','); |
| 22 | +performance_MNIST = performance_MNIST(:,1:end-1); |
| 23 | +performance_ORL = performance_ORL(:,1:end-1); |
| 24 | + |
| 25 | +% |
| 26 | +% CSV formatted as follows: |
| 27 | +% |
| 28 | +% line1: Labels |
| 29 | +% line2: Dimension 1 |
| 30 | +% line3: Dimension 2 |
| 31 | + |
| 32 | +%data_pca_MNIST = dlmread('/path/to/pca_data_MNIST',','); |
| 33 | +%data_pca_ORL = dlmread('/path/to/pca_data_ORL',','); |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +%% Performance Bar Plots |
| 39 | +% Original Data |
| 40 | +fig_MNIST = figure('units','normalized','outerposition',[0 0 1 1]); |
| 41 | +c = {'NC','NSC2','NSC3','NSC5','NN','P-BP','P-MSE'}; |
| 42 | +bar(performance_MNIST(1,:)) |
| 43 | +barvalues; |
| 44 | +ylim([0 120]); |
| 45 | +set(gca,'xticklabel',c) |
| 46 | +set(gca,'FontSize',FontSize); |
| 47 | +ylabel('Success Rate [%]','FontSize',FontSize) |
| 48 | +grid on |
| 49 | + |
| 50 | + |
| 51 | +fig_ORL = figure('units','normalized','outerposition',[0 0 1 1]); |
| 52 | +c = {'NC','NSC2','NSC3','NSC5','NN','P-BP','P-MSE'}; |
| 53 | +bar(performance_ORL(1,:)) |
| 54 | +barvalues; |
| 55 | +ylim([0 120]); |
| 56 | +set(gca,'xticklabel',c) |
| 57 | +set(gca,'FontSize',FontSize); |
| 58 | +ylabel('Success Rate [%]','FontSize',FontSize) |
| 59 | +grid on |
| 60 | + |
| 61 | +%% Performance Plots |
| 62 | +fig_performance = figure('units','normalized','outerposition',[0 0 1 1]); |
| 63 | + |
| 64 | +h=semilogy(performance_MNIST(1,:),performance_MNIST(2,:),'x',... |
| 65 | + performance_ORL(1,:),performance_ORL(2,:),'o'); |
| 66 | +lgd = legend('MNIST','ORL','Location','NW'); |
| 67 | +lgd.FontSize = FontSize; |
| 68 | +l = {'NC','NSC2','NSC3','NSC5','NN','P-BP','P-MSE'}; |
| 69 | +labelpoints(performance_MNIST(1,:),performance_MNIST(2,:),l,'N','FontSize',FontSize); |
| 70 | +labelpoints(performance_ORL(1,:),performance_ORL(2,:),l,'N','FontSize',FontSize); |
| 71 | +set(h(1),'MarkerSize',12,'Linewidth',3); |
| 72 | +set(h(2),'MarkerSize',12,'Linewidth',3); |
| 73 | +set(gca,'FontSize',FontSize); |
| 74 | +ylabel('Execution Time [ms]','FontSize',FontSize) |
| 75 | +xlabel('Success Rate [%]','Fontsize',FontSize) |
| 76 | +grid on |
| 77 | + |
| 78 | +fig_performance_pca = figure('units','normalized','outerposition',[0 0 1 1]); |
| 79 | + |
| 80 | +h=semilogy(performance_MNIST(3,:),performance_MNIST(4,:),'x',... |
| 81 | + performance_ORL(3,:),performance_ORL(4,:),'o'); |
| 82 | +lgd = legend('MNIST','ORL','Location','NW'); |
| 83 | +lgd.FontSize = FontSize; |
| 84 | +l = {'NC','NSC2','NSC3','NSC5','NN','P-BP','P-MSE'}; |
| 85 | +labelpoints(performance_MNIST(3,:),performance_MNIST(4,:),l,'N','FontSize',FontSize); |
| 86 | +labelpoints(performance_ORL(3,:),performance_ORL(4,:),l,'N','FontSize',FontSize); |
| 87 | +set(h(1),'MarkerSize',12,'Linewidth',3); |
| 88 | +set(h(2),'MarkerSize',12,'Linewidth',3); |
| 89 | +set(gca,'FontSize',FontSize); |
| 90 | +ylabel('Execution Time [ms]','FontSize',FontSize) |
| 91 | +xlabel('Success Rate [%]','Fontsize',FontSize) |
| 92 | +grid on |
| 93 | + |
| 94 | +%% PCA Data Plots |
| 95 | + |
| 96 | +% MNIST |
| 97 | +for i =1:10 |
| 98 | + % Split data into classes |
| 99 | + idx = find(data_pca_MNIST(1,:) == i-1); |
| 100 | + s{i} = data_pca_MNIST(2:3,idx); |
| 101 | +end |
| 102 | +fig_mnist_pca = figure('units','normalized','outerposition',[0 0 1 1]); |
| 103 | +plot(s{1}(1,:),s{1}(2,:),'+',... |
| 104 | + s{2}(1,:),s{2}(2,:),'o',... |
| 105 | + s{3}(1,:),s{3}(2,:),'*',... |
| 106 | + s{4}(1,:),s{4}(2,:),'.',... |
| 107 | + s{5}(1,:),s{5}(2,:),'x',... |
| 108 | + s{6}(1,:),s{6}(2,:),'s',... |
| 109 | + s{7}(1,:),s{7}(2,:),'d',... |
| 110 | + s{8}(1,:),s{8}(2,:),'^',... |
| 111 | + s{9}(1,:),s{9}(2,:),'v',... |
| 112 | + s{10}(1,:),s{10}(2,:),'>'); |
| 113 | +grid on |
| 114 | + |
| 115 | +% ORL |
| 116 | +for i =1:40 |
| 117 | + idx = find(data_pca_ORL(1,:) == i); |
| 118 | + s{i} = data_pca_ORL(2:3,idx); |
| 119 | +end |
| 120 | +fig_orl_pca = figure('units','normalized','outerposition',[0 0 1 1]); |
| 121 | + |
| 122 | +plot(s{1}(1,:),s{1}(2,:),'+',... |
| 123 | + s{2}(1,:),s{2}(2,:),'o',... |
| 124 | + s{3}(1,:),s{3}(2,:),'*',... |
| 125 | + s{4}(1,:),s{4}(2,:),'.',... |
| 126 | + s{5}(1,:),s{5}(2,:),'x',... |
| 127 | + s{6}(1,:),s{6}(2,:),'s',... |
| 128 | + s{7}(1,:),s{7}(2,:),'d',... |
| 129 | + s{8}(1,:),s{8}(2,:),'^',... |
| 130 | + s{9}(1,:),s{9}(2,:),'v',... |
| 131 | + s{10}(1,:),s{10}(2,:),'<',... |
| 132 | + s{11}(1,:),s{11}(2,:),'>',... |
| 133 | + s{12}(1,:),s{12}(2,:),'p',... |
| 134 | + s{13}(1,:),s{13}(2,:),'h',... |
| 135 | + s{14}(1,:),s{14}(2,:),'+',... |
| 136 | + s{15}(1,:),s{15}(2,:),'o',... |
| 137 | + s{16}(1,:),s{16}(2,:),'*',... |
| 138 | + s{17}(1,:),s{17}(2,:),'.',... |
| 139 | + s{18}(1,:),s{18}(2,:),'x',... |
| 140 | + s{19}(1,:),s{19}(2,:),'s',... |
| 141 | + s{20}(1,:),s{20}(2,:),'d',... |
| 142 | + s{21}(1,:),s{21}(2,:),'^',... |
| 143 | + s{22}(1,:),s{22}(2,:),'v',... |
| 144 | + s{23}(1,:),s{23}(2,:),'>',... |
| 145 | + s{24}(1,:),s{24}(2,:),'<',... |
| 146 | + s{25}(1,:),s{25}(2,:),'p',... |
| 147 | + s{26}(1,:),s{26}(2,:),'h',... |
| 148 | + s{27}(1,:),s{27}(2,:),'+',... |
| 149 | + s{28}(1,:),s{28}(2,:),'o',... |
| 150 | + s{29}(1,:),s{29}(2,:),'*',... |
| 151 | + s{30}(1,:),s{30}(2,:),'.',... |
| 152 | + s{31}(1,:),s{31}(2,:),'x',... |
| 153 | + s{32}(1,:),s{32}(2,:),'s',... |
| 154 | + s{33}(1,:),s{33}(2,:),'d',... |
| 155 | + s{34}(1,:),s{34}(2,:),'^',... |
| 156 | + s{35}(1,:),s{35}(2,:),'v',... |
| 157 | + s{36}(1,:),s{36}(2,:),'>',... |
| 158 | + s{37}(1,:),s{37}(2,:),'<',... |
| 159 | + s{38}(1,:),s{38}(2,:),'p',... |
| 160 | + s{39}(1,:),s{39}(2,:),'h',... |
| 161 | + s{40}(1,:),s{40}(2,:),'+'); |
| 162 | +grid on |
| 163 | + |
| 164 | + |
| 165 | +%% Save |
| 166 | +mkdir('plots') |
| 167 | +% Print to .eps file for nice latex integration |
| 168 | +print(fig_performance, 'plots/comparison_performance','-depsc'); |
| 169 | +print(fig_performance_pca, 'plots/comparison_performance_pca','-depsc'); |
| 170 | +print(fig_mnist_pca, 'plots/mnist_pca_plot','-depsc'); |
| 171 | +print(fig_orl_pca, 'plots/orl_pca_plot','-depsc'); |
0 commit comments