comparison 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
comparison
equal deleted inserted replaced
15:0718e03cb36d 16:4a8ec6c461a0
1 function linkList = depthCheck(linkList)
2
3 listSize = size(linkList,1)+1;
4
5 linkList = cat(2,linkList, zeros(size(linkList,1),1));
6 currentRow = size(linkList,1);
7 r = [0;0];
8 % depth = 1;
9
10 linkList(currentRow,end) = 1;
11 % depth = depth + 1;
12 %%
13 while (~isempty(currentRow))
14 row = currentRow(1);
15 for i = 1:2
16 r(i) = linkList(row,i);
17 if(r(i) > listSize)
18 r(i) = linkList(row,i) - listSize;
19 linkList(r(i),end) = linkList(currentRow(1),end)+1;
20 currentRow = [currentRow; r(i)];
21 end
22 end
23 currentRow = currentRow(2:end);
24 end
25 end
26
27
28
29 % linkList = aglomCluster(data);
30 % listSize = size(data,1);
31 %
32 % % linkList(:,4) = 0;
33 % featureList = cell(listSize-1,1);
34 % currentRow = [2*listSize-1];
35 %
36 % %%
37 % while (~isempty(currentRow))
38 % if(currentRow(1) > listSize)
39 % row = currentRow(1) - listSize
40 % classList = traceLinkageToBinary(linkList, row);
41 % featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0));
42 % currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)];
43 % else
44 % currentRow = currentRow(2:end);
45 % end
46 % end
47 %
48 % end