annotate evaluation/evalWorkflow.m @ 37:d9a9a6b93026 tip

Add README
author DaveM
date Sat, 01 Apr 2017 17:03:14 +0100
parents 4af6fc2100e8
children
rev   line source
DaveM@36 1 diary('Evaluation.txt');
DaveM@36 2 addpath('../code');
DaveM@36 3
DaveM@36 4 % dendrogram(linkList);
DaveM@36 5 % listSize = size(data,1);
DaveM@36 6 % currentRow = [2*listSize-1];
DaveM@36 7
DaveM@36 8 % currentRow = [8930; 8959; 8928; 8956; 8951; 8954; 8942; 8964; 8961; 8962; 8949; 8960];
DaveM@36 9 currentRow = [60;49;65;62;67;68;42;63;66];
DaveM@36 10 currentRow = currentRow + 8900;
DaveM@36 11 [LU_all,occ_all] = countElementOccurences(catList);
DaveM@36 12
DaveM@36 13 result = cell(0);
DaveM@36 14 while (~isempty(currentRow))
DaveM@36 15 row = currentRow(1);
DaveM@36 16 % featureList{row,4} = calcLoss(linkList,featureList, row);
DaveM@36 17 classList = traceLinkageToBinary(linkList,row);
DaveM@36 18 L = catList(classList>0);
DaveM@36 19 [LU,occ] = countElementOccurences(L);
DaveM@36 20
DaveM@36 21 fprintf('Row: %d\n',row);
DaveM@36 22 fprintf('Row, \t Category, \t\t Percentage of cat \t percentage of row\n');
DaveM@36 23 rowTot = sum(occ);
DaveM@36 24 for i = 1:length(LU)
DaveM@36 25 occPercentage = occ(i)/ occ_all(find(strcmp(LU_all,LU{i})));
DaveM@36 26 occRowPercentage = occ(i)/ rowTot;
DaveM@36 27 fprintf('%d, \t %s, \t \t %f, \t %f \n',row,LU{i},occPercentage, occRowPercentage);
DaveM@36 28
DaveM@36 29 resultRow = size(result,1)+1;
DaveM@36 30 result{resultRow,1} = row;
DaveM@36 31 result{resultRow,2} = LU{i};
DaveM@36 32 result{resultRow,3} = occPercentage;
DaveM@36 33 result{resultRow,4} = occRowPercentage;
DaveM@36 34 end
DaveM@36 35
DaveM@36 36 currentRow = currentRow(2:end);
DaveM@36 37 end
DaveM@36 38
DaveM@36 39 diary off
DaveM@36 40 %%
DaveM@36 41
DaveM@36 42 warning('off','MATLAB:legend:IgnoringExtraEntries')
DaveM@36 43 diary('Evaluation2.txt');
DaveM@36 44 currentRow = [60;49;65;62;67;68;42;63;66];
DaveM@36 45 currentRow = currentRow + 8900;
DaveM@36 46 LU_all = strrep(LU_all,'_',' ')
DaveM@36 47 % currentRow = [8960; 8956; 8951; 8954; 8942; 8964; 8961; 8962; 8949; 8960];
DaveM@36 48 % imFolder = 'im/';
DaveM@36 49 % mkdir(imFolder)
DaveM@36 50 thresh = 0.05;
DaveM@36 51 ledList = {};
DaveM@36 52
DaveM@36 53 for i = 1:length(currentRow)
DaveM@36 54 row = currentRow(i);
DaveM@36 55 led = strrep(result([result{:,1}] == row,2),'_',' ');
DaveM@36 56 toPlot = [result{[result{:,1}] == row,4}];
DaveM@36 57 useMap = toPlot>thresh;
DaveM@36 58 toPlot = toPlot(useMap);
DaveM@36 59 led = led(useMap);
DaveM@36 60 ledList = [ledList;led(1:length(toPlot))];
DaveM@36 61
DaveM@36 62 end
DaveM@36 63
DaveM@36 64 ledU_name = unique(ledList);
DaveM@36 65 ledU = zeros(length(ledU_name),1);
DaveM@36 66 for l = 1:length(ledU_name)
DaveM@36 67 ledU(l) = find(strcmp(ledU_name(l),LU_all));
DaveM@36 68 end
DaveM@36 69
DaveM@36 70 %%
DaveM@36 71 % subplot(3,4)
DaveM@36 72 currentRow = [60;49;65;62;67;68;42;63;66];
DaveM@36 73 currentRow = currentRow + 8900;
DaveM@36 74 fig1 = figure('Position',[100 100 500 500]);
DaveM@36 75 hold on;
DaveM@36 76 set(gca,'color','none');
DaveM@36 77 tcm = colormap(jet(length(ledU)));
DaveM@36 78 p = struct;
DaveM@36 79 i = 1;
DaveM@36 80 while (~isempty(currentRow))
DaveM@36 81 p(i).row = currentRow(1);
DaveM@36 82 % M = result([result{:,1}] == row,:);
DaveM@36 83 % test = strrep(L
DaveM@36 84 p(i).led = strrep(result([result{:,1}] == p(i).row,2),'_',' ');
DaveM@36 85 toPlot = [result{[result{:,1}] == p(i).row,4}];
DaveM@36 86 % toPlot = toPlot;
DaveM@36 87
DaveM@36 88 p(i).useMap = toPlot>thresh;
DaveM@36 89 p(i).toPlot = toPlot(p(i).useMap);
DaveM@36 90 p(i).led = p(i).led(p(i).useMap);
DaveM@36 91 xy = [mod(i-1,3)*0.3,0.66-(floor((i-1)/3)*0.33),0.3,0.3];
DaveM@36 92 p(i).plot = subplot('position',xy);
DaveM@36 93 h = pie(p(i).toPlot);
DaveM@36 94 title(['Cluster ' num2str(i)],'FontSize',12,'FontWeight','normal','Interpreter','tex');
DaveM@36 95 ht = findobj(h,'Type','text');
DaveM@36 96 for ii = 1:length(ht)
DaveM@36 97 ht(ii).Visible = 'off';
DaveM@36 98 end
DaveM@36 99 hp = findobj(h,'Type','patch');
DaveM@36 100 for ii = 1:length(hp)
DaveM@36 101 % p(i).led(ii)
DaveM@36 102 featName = find(strcmp(LU_all,p(i).led(ii)));
DaveM@36 103 colToUse = find(featName==ledU);
DaveM@36 104 hp(ii).FaceColor = tcm(colToUse,:);
DaveM@36 105 end
DaveM@36 106 p(i).h = h;
DaveM@36 107 currentRow = currentRow(2:end);
DaveM@36 108 i = i + 1;
DaveM@36 109
DaveM@36 110 end
DaveM@36 111 % hSub = subplot(4,1,4); plot(1,1,1,1,1,1,1,1);
DaveM@36 112 % legend(led,'position',get(hSub,'position'),'Orientation','vertical','Box','off','FontSize',12);
DaveM@36 113 saveas(gcf,'t1_5','fig');
DaveM@36 114 saveas(gcf,'t1_5','png');
DaveM@36 115 print('t1_5.eps','-depsc2');
DaveM@36 116
DaveM@36 117 % L_p = legend(led,'Location','bestoutside','Orientation','vertical','Box','off','FontSize',12);
DaveM@36 118
DaveM@36 119 % saveas(gcf,'t2','fig');
DaveM@36 120 % saveas(gcf,'t2','png');
DaveM@36 121 diary off
DaveM@36 122 %%
DaveM@36 123
DaveM@36 124 figure;
DaveM@36 125 temPlot = ones(length(ledU),1);
DaveM@36 126 h = pie(temPlot);
DaveM@36 127
DaveM@36 128 % led = strrep(result([result{:,1}] == p(i).row,2),'_',' ');
DaveM@36 129
DaveM@36 130 set(h,'Visible','off');
DaveM@36 131 ht = findobj(h,'Type','text');
DaveM@36 132 for ii = 1:length(ht)
DaveM@36 133 ht(ii).Visible = 'off';
DaveM@36 134 end
DaveM@36 135 hp = findobj(h,'Type','patch');
DaveM@36 136 for ii = 1:length(hp)
DaveM@36 137 hp(ii).FaceColor = tcm(ii,:);
DaveM@36 138 end
DaveM@36 139 legend(ledU_name,'Location','north','Orientation','vertical','Box','off','FontSize',14);
DaveM@36 140
DaveM@36 141 saveas(gcf,'leg_5','fig');
DaveM@36 142 saveas(gcf,'leg_5','png');
DaveM@36 143 print('leg_5.eps','-depsc2');
DaveM@36 144
DaveM@36 145
DaveM@36 146 % %%
DaveM@36 147 % row = 8930;
DaveM@36 148 % % M = result([result{:,1}] == row,:);
DaveM@36 149 % % test = strrep(L
DaveM@36 150 % led = strrep(result([result{:,1}] == row,2),'_',' ');
DaveM@36 151 % toPlot = [result{[result{:,1}] == row,4}];
DaveM@36 152 % toPlot = toPlot;
DaveM@36 153 %
DaveM@36 154 % toPlot = toPlot(toPlot>thresh);
DaveM@36 155 % figure;
DaveM@36 156 % h = pie(toPlot);
DaveM@36 157 %
DaveM@36 158 % ht = findobj(h,'Type','text');
DaveM@36 159 % for i = 1:length(ht)
DaveM@36 160 % ht(i).Visible = 'off';
DaveM@36 161 % end
DaveM@36 162 %
DaveM@36 163 % % [result{[result{:,1}] == 8930,4}]
DaveM@36 164 % legend(led,'Location','eastoutside','Orientation','vertical','Box','off','FontSize',12);
DaveM@36 165 % tit_graph = ['Label Distribution for Cell ' num2str(row)];
DaveM@36 166 % title(tit_graph)
DaveM@36 167 % tit_f = [imFolder 'pie_' num2str(row)];
DaveM@36 168 % set(gca,'color','none')
DaveM@36 169 % saveas(gcf,tit_f,'fig');
DaveM@36 170 % saveas(gcf,tit_f,'png');
DaveM@36 171 %
DaveM@36 172 %
DaveM@36 173 %
DaveM@36 174 % %%
DaveM@36 175 %
DaveM@36 176 % led = strrep(result([result{:,1}] == row,2),'_',' ');
DaveM@36 177 % toPlot = [result{[result{:,1}] == row,4}];
DaveM@36 178 % toPlot = toPlot/100;
DaveM@36 179 % toPlot = toPlot(toPlot>thresh);
DaveM@36 180 % toPlot
DaveM@36 181 % h = pie(toPlot)
DaveM@36 182 % hp = findobj(h,'Type','patch');
DaveM@36 183
DaveM@36 184
DaveM@36 185
DaveM@36 186