annotate phase2/depthCheck.m @ 16:4a8ec6c461a0

adding depth checking for recursive tree - feature search - though has a bug where it sometimes get stuck in an infinite loop and I dont know why
author DaveM
date Thu, 16 Feb 2017 10:07:42 +0000
parents
children 203626c7e0af
rev   line source
DaveM@16 1 function linkList = depthCheck(linkList)
DaveM@16 2
DaveM@16 3 listSize = size(linkList,1)+1;
DaveM@16 4
DaveM@16 5 linkList = cat(2,linkList, zeros(size(linkList,1),1));
DaveM@16 6 currentRow = size(linkList,1);
DaveM@16 7 r = [0;0];
DaveM@16 8 % depth = 1;
DaveM@16 9
DaveM@16 10 linkList(currentRow,end) = 1;
DaveM@16 11 % depth = depth + 1;
DaveM@16 12 %%
DaveM@16 13 while (~isempty(currentRow))
DaveM@16 14 row = currentRow(1);
DaveM@16 15 for i = 1:2
DaveM@16 16 r(i) = linkList(row,i);
DaveM@16 17 if(r(i) > listSize)
DaveM@16 18 r(i) = linkList(row,i) - listSize;
DaveM@16 19 linkList(r(i),end) = linkList(currentRow(1),end)+1;
DaveM@16 20 currentRow = [currentRow; r(i)];
DaveM@16 21 end
DaveM@16 22 end
DaveM@16 23 currentRow = currentRow(2:end);
DaveM@16 24 end
DaveM@16 25 end
DaveM@16 26
DaveM@16 27
DaveM@16 28
DaveM@16 29 % linkList = aglomCluster(data);
DaveM@16 30 % listSize = size(data,1);
DaveM@16 31 %
DaveM@16 32 % % linkList(:,4) = 0;
DaveM@16 33 % featureList = cell(listSize-1,1);
DaveM@16 34 % currentRow = [2*listSize-1];
DaveM@16 35 %
DaveM@16 36 % %%
DaveM@16 37 % while (~isempty(currentRow))
DaveM@16 38 % if(currentRow(1) > listSize)
DaveM@16 39 % row = currentRow(1) - listSize
DaveM@16 40 % classList = traceLinkageToBinary(linkList, row);
DaveM@16 41 % featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0));
DaveM@16 42 % currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)];
DaveM@16 43 % else
DaveM@16 44 % currentRow = currentRow(2:end);
DaveM@16 45 % end
DaveM@16 46 % end
DaveM@16 47 %
DaveM@16 48 % end