comparison phase2/treeLinkFeatures.m @ 11:29304e7bfead

develop treeLinkFeatures so it searched valid lines and stops at leaf nodes
author DaveM
date Fri, 10 Feb 2017 12:18:20 +0000
parents 686d1f9b8698
children d0bd98e7b6c9
comparison
equal deleted inserted replaced
10:686d1f9b8698 11:29304e7bfead
1 function featureList = treeLinkFeatures(data) 1 function [linkList, featureList]= treeLinkFeatures(data)
2 %% linkList = treeLinkFeatures(data) 2 %% linkList = treeLinkFeatures(data)
3 % given a dataset, a hierarchical cluster of the data is produced, and then 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 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 5 % features are produced, which are the ranked features that can be used to
6 % separate the given dataset at that point. 6 % separate the given dataset at that point.
13 featureList = cell(listSize-1,1); 13 featureList = cell(listSize-1,1);
14 currentRow = [2*listSize-1]; 14 currentRow = [2*listSize-1];
15 15
16 16
17 while (length(currentRow) > 0) 17 while (length(currentRow) > 0)
18 currentRow 18 if(currentRow(1) >= listSize)
19 if(currentRow(1) > listSize-1) 19 row = currentRow(1) - listSize
20 row = currentRow(1) - listSize;
21 classList = traceLinkageToBinary(linkList, row); 20 classList = traceLinkageToBinary(linkList, row);
22 featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0)) 21 featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0));
23 currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)]; 22 currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)];
24 else 23 else
25 currentRow = currentRow(2:end); 24 currentRow = currentRow(2:end);
26 end 25 end
27 end 26 end