DaveM@25: function [linkList, featureList]= treeLinkFeatures(data, depthThresh, featureNames) DaveM@10: %% linkList = treeLinkFeatures(data) DaveM@10: % given a dataset, a hierarchical cluster of the data is produced, and then DaveM@10: % the data is traversed, such that, for each split in the data, a set of DaveM@10: % features are produced, which are the ranked features that can be used to DaveM@10: % separate the given dataset at that point. DaveM@10: DaveM@9: DaveM@25: if(nargin < 3) DaveM@25: featureNames = 1:size(data,2); DaveM@25: end DaveM@16: if(nargin < 2) DaveM@19: depthThresh = 999; DaveM@16: end DaveM@9: linkList = aglomCluster(data); DaveM@16: linkList = depthCheck(linkList); DaveM@10: listSize = size(data,1); DaveM@9: DaveM@10: % linkList(:,4) = 0; DaveM@24: featureList = cell(listSize-1,3); DaveM@10: currentRow = [2*listSize-1]; DaveM@9: DaveM@12: %% DaveM@15: while (~isempty(currentRow)) DaveM@16: if(currentRow(1) > listSize) DaveM@22: row = currentRow(1) - listSize; DaveM@17: % rD = linkList(row,4); DaveM@16: if(linkList(row,4) < depthThresh) DaveM@16: classList = traceLinkageToBinary(linkList, row); DaveM@23: featureList{row,1} = rfFeatureSelection(data(classList>0,:), classList(classList>0)); DaveM@17: featureList{row,2} = linkList(row,4); DaveM@24: featureList{row,3} = fitctree(data(classList>0,featureList{row,1}),classList(classList>0),'PredictorNames',featureNames(featureList{row,1})); DaveM@16: end DaveM@17: currentRow = [currentRow; linkList(row,1); linkList(row,2)]; DaveM@10: end DaveM@17: currentRow = currentRow(2:end); DaveM@9: end DaveM@9: DaveM@9: end