DaveM@36: diary('Evaluation.txt'); DaveM@36: addpath('../code'); DaveM@36: DaveM@36: % dendrogram(linkList); DaveM@36: % listSize = size(data,1); DaveM@36: % currentRow = [2*listSize-1]; DaveM@36: DaveM@36: % currentRow = [8930; 8959; 8928; 8956; 8951; 8954; 8942; 8964; 8961; 8962; 8949; 8960]; DaveM@36: currentRow = [60;49;65;62;67;68;42;63;66]; DaveM@36: currentRow = currentRow + 8900; DaveM@36: [LU_all,occ_all] = countElementOccurences(catList); DaveM@36: DaveM@36: result = cell(0); DaveM@36: while (~isempty(currentRow)) DaveM@36: row = currentRow(1); DaveM@36: % featureList{row,4} = calcLoss(linkList,featureList, row); DaveM@36: classList = traceLinkageToBinary(linkList,row); DaveM@36: L = catList(classList>0); DaveM@36: [LU,occ] = countElementOccurences(L); DaveM@36: DaveM@36: fprintf('Row: %d\n',row); DaveM@36: fprintf('Row, \t Category, \t\t Percentage of cat \t percentage of row\n'); DaveM@36: rowTot = sum(occ); DaveM@36: for i = 1:length(LU) DaveM@36: occPercentage = occ(i)/ occ_all(find(strcmp(LU_all,LU{i}))); DaveM@36: occRowPercentage = occ(i)/ rowTot; DaveM@36: fprintf('%d, \t %s, \t \t %f, \t %f \n',row,LU{i},occPercentage, occRowPercentage); DaveM@36: DaveM@36: resultRow = size(result,1)+1; DaveM@36: result{resultRow,1} = row; DaveM@36: result{resultRow,2} = LU{i}; DaveM@36: result{resultRow,3} = occPercentage; DaveM@36: result{resultRow,4} = occRowPercentage; DaveM@36: end DaveM@36: DaveM@36: currentRow = currentRow(2:end); DaveM@36: end DaveM@36: DaveM@36: diary off DaveM@36: %% DaveM@36: DaveM@36: warning('off','MATLAB:legend:IgnoringExtraEntries') DaveM@36: diary('Evaluation2.txt'); DaveM@36: currentRow = [60;49;65;62;67;68;42;63;66]; DaveM@36: currentRow = currentRow + 8900; DaveM@36: LU_all = strrep(LU_all,'_',' ') DaveM@36: % currentRow = [8960; 8956; 8951; 8954; 8942; 8964; 8961; 8962; 8949; 8960]; DaveM@36: % imFolder = 'im/'; DaveM@36: % mkdir(imFolder) DaveM@36: thresh = 0.05; DaveM@36: ledList = {}; DaveM@36: DaveM@36: for i = 1:length(currentRow) DaveM@36: row = currentRow(i); DaveM@36: led = strrep(result([result{:,1}] == row,2),'_',' '); DaveM@36: toPlot = [result{[result{:,1}] == row,4}]; DaveM@36: useMap = toPlot>thresh; DaveM@36: toPlot = toPlot(useMap); DaveM@36: led = led(useMap); DaveM@36: ledList = [ledList;led(1:length(toPlot))]; DaveM@36: DaveM@36: end DaveM@36: DaveM@36: ledU_name = unique(ledList); DaveM@36: ledU = zeros(length(ledU_name),1); DaveM@36: for l = 1:length(ledU_name) DaveM@36: ledU(l) = find(strcmp(ledU_name(l),LU_all)); DaveM@36: end DaveM@36: DaveM@36: %% DaveM@36: % subplot(3,4) DaveM@36: currentRow = [60;49;65;62;67;68;42;63;66]; DaveM@36: currentRow = currentRow + 8900; DaveM@36: fig1 = figure('Position',[100 100 500 500]); DaveM@36: hold on; DaveM@36: set(gca,'color','none'); DaveM@36: tcm = colormap(jet(length(ledU))); DaveM@36: p = struct; DaveM@36: i = 1; DaveM@36: while (~isempty(currentRow)) DaveM@36: p(i).row = currentRow(1); DaveM@36: % M = result([result{:,1}] == row,:); DaveM@36: % test = strrep(L DaveM@36: p(i).led = strrep(result([result{:,1}] == p(i).row,2),'_',' '); DaveM@36: toPlot = [result{[result{:,1}] == p(i).row,4}]; DaveM@36: % toPlot = toPlot; DaveM@36: DaveM@36: p(i).useMap = toPlot>thresh; DaveM@36: p(i).toPlot = toPlot(p(i).useMap); DaveM@36: p(i).led = p(i).led(p(i).useMap); DaveM@36: xy = [mod(i-1,3)*0.3,0.66-(floor((i-1)/3)*0.33),0.3,0.3]; DaveM@36: p(i).plot = subplot('position',xy); DaveM@36: h = pie(p(i).toPlot); DaveM@36: title(['Cluster ' num2str(i)],'FontSize',12,'FontWeight','normal','Interpreter','tex'); DaveM@36: ht = findobj(h,'Type','text'); DaveM@36: for ii = 1:length(ht) DaveM@36: ht(ii).Visible = 'off'; DaveM@36: end DaveM@36: hp = findobj(h,'Type','patch'); DaveM@36: for ii = 1:length(hp) DaveM@36: % p(i).led(ii) DaveM@36: featName = find(strcmp(LU_all,p(i).led(ii))); DaveM@36: colToUse = find(featName==ledU); DaveM@36: hp(ii).FaceColor = tcm(colToUse,:); DaveM@36: end DaveM@36: p(i).h = h; DaveM@36: currentRow = currentRow(2:end); DaveM@36: i = i + 1; DaveM@36: DaveM@36: end DaveM@36: % hSub = subplot(4,1,4); plot(1,1,1,1,1,1,1,1); DaveM@36: % legend(led,'position',get(hSub,'position'),'Orientation','vertical','Box','off','FontSize',12); DaveM@36: saveas(gcf,'t1_5','fig'); DaveM@36: saveas(gcf,'t1_5','png'); DaveM@36: print('t1_5.eps','-depsc2'); DaveM@36: DaveM@36: % L_p = legend(led,'Location','bestoutside','Orientation','vertical','Box','off','FontSize',12); DaveM@36: DaveM@36: % saveas(gcf,'t2','fig'); DaveM@36: % saveas(gcf,'t2','png'); DaveM@36: diary off DaveM@36: %% DaveM@36: DaveM@36: figure; DaveM@36: temPlot = ones(length(ledU),1); DaveM@36: h = pie(temPlot); DaveM@36: DaveM@36: % led = strrep(result([result{:,1}] == p(i).row,2),'_',' '); DaveM@36: DaveM@36: set(h,'Visible','off'); DaveM@36: ht = findobj(h,'Type','text'); DaveM@36: for ii = 1:length(ht) DaveM@36: ht(ii).Visible = 'off'; DaveM@36: end DaveM@36: hp = findobj(h,'Type','patch'); DaveM@36: for ii = 1:length(hp) DaveM@36: hp(ii).FaceColor = tcm(ii,:); DaveM@36: end DaveM@36: legend(ledU_name,'Location','north','Orientation','vertical','Box','off','FontSize',14); DaveM@36: DaveM@36: saveas(gcf,'leg_5','fig'); DaveM@36: saveas(gcf,'leg_5','png'); DaveM@36: print('leg_5.eps','-depsc2'); DaveM@36: DaveM@36: DaveM@36: % %% DaveM@36: % row = 8930; DaveM@36: % % M = result([result{:,1}] == row,:); DaveM@36: % % test = strrep(L DaveM@36: % led = strrep(result([result{:,1}] == row,2),'_',' '); DaveM@36: % toPlot = [result{[result{:,1}] == row,4}]; DaveM@36: % toPlot = toPlot; DaveM@36: % DaveM@36: % toPlot = toPlot(toPlot>thresh); DaveM@36: % figure; DaveM@36: % h = pie(toPlot); DaveM@36: % DaveM@36: % ht = findobj(h,'Type','text'); DaveM@36: % for i = 1:length(ht) DaveM@36: % ht(i).Visible = 'off'; DaveM@36: % end DaveM@36: % DaveM@36: % % [result{[result{:,1}] == 8930,4}] DaveM@36: % legend(led,'Location','eastoutside','Orientation','vertical','Box','off','FontSize',12); DaveM@36: % tit_graph = ['Label Distribution for Cell ' num2str(row)]; DaveM@36: % title(tit_graph) DaveM@36: % tit_f = [imFolder 'pie_' num2str(row)]; DaveM@36: % set(gca,'color','none') DaveM@36: % saveas(gcf,tit_f,'fig'); DaveM@36: % saveas(gcf,tit_f,'png'); DaveM@36: % DaveM@36: % DaveM@36: % DaveM@36: % %% DaveM@36: % DaveM@36: % led = strrep(result([result{:,1}] == row,2),'_',' '); DaveM@36: % toPlot = [result{[result{:,1}] == row,4}]; DaveM@36: % toPlot = toPlot/100; DaveM@36: % toPlot = toPlot(toPlot>thresh); DaveM@36: % toPlot DaveM@36: % h = pie(toPlot) DaveM@36: % hp = findobj(h,'Type','patch'); DaveM@36: DaveM@36: DaveM@36: DaveM@36: