Mercurial > hg > sfx-subgrouping
diff phase2/treeLinkFeatures.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 | 0718e03cb36d |
children | c674bf769d82 |
line wrap: on
line diff
--- a/phase2/treeLinkFeatures.m Wed Feb 15 11:07:32 2017 +0000 +++ b/phase2/treeLinkFeatures.m Thu Feb 16 10:07:42 2017 +0000 @@ -1,4 +1,4 @@ -function [linkList, featureList]= treeLinkFeatures(data) +function [linkList, featureList]= treeLinkFeatures(data, depthThresh) %% 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 @@ -6,7 +6,12 @@ % separate the given dataset at that point. + +if(nargin < 2) + depthThresh = 9999999; +end linkList = aglomCluster(data); +linkList = depthCheck(linkList); listSize = size(data,1); % linkList(:,4) = 0; @@ -15,11 +20,13 @@ %% while (~isempty(currentRow)) - if(currentRow(1) > listSize) + if(currentRow(1) > listSize) 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)]; + if(linkList(row,4) < depthThresh) + classList = traceLinkageToBinary(linkList, row); + featureList{row} = rfFeatureSelection(data(classList>0,:), classList(classList>0)); + currentRow = [currentRow(2:end); linkList(row,1); linkList(row,2)]; + end else currentRow = currentRow(2:end); end