changeset 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
files phase2/treeLinkFeatures.m
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/phase2/treeLinkFeatures.m	Fri Feb 10 09:03:05 2017 +0000
+++ b/phase2/treeLinkFeatures.m	Fri Feb 10 12:04:23 2017 +0000
@@ -1,16 +1,29 @@
-function linkList = treeLinkFeatures(data)
+function featureList = treeLinkFeatures(data)
+%% linkList = treeLinkFeatures(data)
+% given a dataset, a hierarchical cluster of the data is produced, and then
+% the data is traversed, such that, for each split in the data, a set of
+% features are produced, which are the ranked features that can be used to
+% separate the given dataset at that point.
+
 
 linkList = aglomCluster(data);
+listSize = size(data,1);
 
-linkList(:,4) = 0;
-listSize = size(data,1);
-currentRow = [size(linkList,1)];
+% linkList(:,4) = 0;
+featureList = cell(listSize-1,1);
+currentRow = [2*listSize-1];
 
 
-while (linkList(currentRow(1),1) > listSize && linkList(currentRow(1),2) > listSize)
-    classList = traceLinkageToBinary(linkList, currentRow);
-    linkList(:,4) = rfFeatureSelection(data(classList>0,:), classList(classList>0));
-    currentRow = [currentRow(2:end); currentRow(1),1; currentRow(1),2];
+while (length(currentRow) > 0)
+    currentRow
+    if(currentRow(1) > listSize-1) 
+        row = currentRow(1) - listSize;
+        classList = traceLinkageToBinary(linkList, row);
+        featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0))
+        currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)];
+    else
+        currentRow = currentRow(2:end);
+    end
 end
 
 end
\ No newline at end of file