annotate phase2/treeLinkFeatures.m @ 24:8613ec5ab369

include output with decision tree output
author DaveM
date Wed, 08 Mar 2017 16:56:59 +0000
parents 30db29d5cf5c
children 2a77dd12582f
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@24 18 featureList = cell(listSize-1,3);
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@24 30 featureList{row,3} = fitctree(data(classList>0,featureList{row,1}),classList(classList>0),'PredictorNames',featureNames(featureList{row,1}));
DaveM@16 31 end
DaveM@17 32 currentRow = [currentRow; linkList(row,1); linkList(row,2)];
DaveM@10 33 end
DaveM@17 34 currentRow = currentRow(2:end);
DaveM@9 35 end
DaveM@9 36
DaveM@9 37 end