view 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
line wrap: on
line source
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
% features are produced, which are the ranked features that can be used to
% separate the given dataset at that point.



if(nargin < 2)
    depthThresh = 999;
end
linkList = aglomCluster(data);
linkList = depthCheck(linkList);
listSize = size(data,1);

% linkList(:,4) = 0;
featureList = cell(listSize-1,2);
currentRow = [2*listSize-1];

%%
while (~isempty(currentRow))
    if(currentRow(1) > listSize)
        row = currentRow(1) - listSize;
%         rD = linkList(row,4);
        if(linkList(row,4) < depthThresh)
            classList = traceLinkageToBinary(linkList, row);
            featureList{row,1} = rfFeatureSelection(data(classList>0,:), classList(classList>0));
            featureList{row,2} = linkList(row,4);
        end
        currentRow = [currentRow; linkList(row,1); linkList(row,2)];
    end
    currentRow = currentRow(2:end);
end

end