annotate analysis/analysisWorkflow.m @ 33:74d123779d3b

create analysis script to prune and write the relevant features for each level - including an 80% classification threshold on the tree - perhaps this can be addressed
author DaveM
date Wed, 15 Mar 2017 16:33:54 +0000
parents
children 781ebde125cf
rev   line source
DaveM@33 1 diary('AnalysisOutput.txt');
DaveM@33 2 dendrogram(linkList);
DaveM@33 3 currentRow = [2*listSize-1];
DaveM@33 4
DaveM@33 5 while (~isempty(currentRow))
DaveM@33 6 if(currentRow(1) > listSize)
DaveM@33 7 row = currentRow(1) - listSize
DaveM@33 8 if(~isempty(featureList{row,1}))
DaveM@33 9 % featureList{row,4} = calcLoss(linkList,featureList, row);
DaveM@33 10 classList = traceLinkageToBinary(linkList,row);
DaveM@33 11 X = data(classList>0,featureList{row,1});
DaveM@33 12 Y = classList(classList>0);
DaveM@33 13
DaveM@33 14 [L,se] = loss(featureList{row,3},X,Y);
DaveM@33 15 featureList{row,4} = [L, se];
DaveM@33 16
DaveM@33 17 pDepth = max(featureList{row,3}.PruneList);
DaveM@33 18
DaveM@33 19 lossVal = 1;
DaveM@33 20 while (lossVal > 0.2 && pDepth > 1)
DaveM@33 21 pDepth = pDepth - 1;
DaveM@33 22 T1 = prune(featureList{row,3},'Level',pDepth);
DaveM@33 23 lossVal = loss(T1,X,Y);
DaveM@33 24 end
DaveM@33 25 fprintf('Row: %d, pDepth = %d, loss = %f\n',row,pDepth,lossVal);
DaveM@33 26 view(T1);
DaveM@33 27 currentRow = [currentRow; linkList(row,1); linkList(row,2)];
DaveM@33 28 end
DaveM@33 29 end
DaveM@33 30 currentRow = currentRow(2:end);
DaveM@33 31 end
DaveM@33 32
DaveM@33 33 diary off
DaveM@33 34 %%
DaveM@33 35