annotate phase2/treeLinkFeatures.m @ 23:30db29d5cf5c

fixing the bug which stopped treeLinkFeatures from working
author DaveM
date Wed, 08 Mar 2017 13:17:07 +0000
parents e3a1a7d38a3a
children 8613ec5ab369
rev   line source
DaveM@16 1 function [linkList, featureList]= treeLinkFeatures(data, depthThresh)
DaveM@10 2 %% linkList = treeLinkFeatures(data)
DaveM@10 3 % given a dataset, a hierarchical cluster of the data is produced, and then
DaveM@10 4 % the data is traversed, such that, for each split in the data, a set of
DaveM@10 5 % features are produced, which are the ranked features that can be used to
DaveM@10 6 % separate the given dataset at that point.
DaveM@10 7
DaveM@9 8
DaveM@16 9
DaveM@16 10 if(nargin < 2)
DaveM@19 11 depthThresh = 999;
DaveM@16 12 end
DaveM@9 13 linkList = aglomCluster(data);
DaveM@16 14 linkList = depthCheck(linkList);
DaveM@10 15 listSize = size(data,1);
DaveM@9 16
DaveM@10 17 % linkList(:,4) = 0;
DaveM@17 18 featureList = cell(listSize-1,2);
DaveM@10 19 currentRow = [2*listSize-1];
DaveM@9 20
DaveM@12 21 %%
DaveM@15 22 while (~isempty(currentRow))
DaveM@16 23 if(currentRow(1) > listSize)
DaveM@22 24 row = currentRow(1) - listSize;
DaveM@17 25 % rD = linkList(row,4);
DaveM@16 26 if(linkList(row,4) < depthThresh)
DaveM@16 27 classList = traceLinkageToBinary(linkList, row);
DaveM@23 28 featureList{row,1} = rfFeatureSelection(data(classList>0,:), classList(classList>0));
DaveM@17 29 featureList{row,2} = linkList(row,4);
DaveM@16 30 end
DaveM@17 31 currentRow = [currentRow; linkList(row,1); linkList(row,2)];
DaveM@10 32 end
DaveM@17 33 currentRow = currentRow(2:end);
DaveM@9 34 end
DaveM@9 35
DaveM@9 36 end