comparison phase2/treeLinkFeatures.m @ 10:686d1f9b8698

bug fixes for treeLinkFeatures, to allow full traversing of a tree, and producing relevant features at each crossing pointWq
author DaveM
date Fri, 10 Feb 2017 12:04:23 +0000
parents 699c769b76da
children 29304e7bfead
comparison
equal deleted inserted replaced
9:699c769b76da 10:686d1f9b8698
1 function linkList = treeLinkFeatures(data) 1 function featureList = treeLinkFeatures(data)
2 %% linkList = treeLinkFeatures(data)
3 % given a dataset, a hierarchical cluster of the data is produced, and then
4 % the data is traversed, such that, for each split in the data, a set of
5 % features are produced, which are the ranked features that can be used to
6 % separate the given dataset at that point.
7
2 8
3 linkList = aglomCluster(data); 9 linkList = aglomCluster(data);
10 listSize = size(data,1);
4 11
5 linkList(:,4) = 0; 12 % linkList(:,4) = 0;
6 listSize = size(data,1); 13 featureList = cell(listSize-1,1);
7 currentRow = [size(linkList,1)]; 14 currentRow = [2*listSize-1];
8 15
9 16
10 while (linkList(currentRow(1),1) > listSize && linkList(currentRow(1),2) > listSize) 17 while (length(currentRow) > 0)
11 classList = traceLinkageToBinary(linkList, currentRow); 18 currentRow
12 linkList(:,4) = rfFeatureSelection(data(classList>0,:), classList(classList>0)); 19 if(currentRow(1) > listSize-1)
13 currentRow = [currentRow(2:end); currentRow(1),1; currentRow(1),2]; 20 row = currentRow(1) - listSize;
21 classList = traceLinkageToBinary(linkList, row);
22 featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0))
23 currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)];
24 else
25 currentRow = currentRow(2:end);
26 end
14 end 27 end
15 28
16 end 29 end