# HG changeset patch # User DaveM # Date 1486717385 0 # Node ID 699c769b76da6e34bd9291555af20537f6a25dab # Parent b177d57ac0bd9d8169defafda942ee2cfc568b28 initial implementation of treeLinkFeatures, to be tested diff -r b177d57ac0bd -r 699c769b76da phase2/aglomCluster.m --- a/phase2/aglomCluster.m Fri Feb 10 08:28:22 2017 +0000 +++ b/phase2/aglomCluster.m Fri Feb 10 09:03:05 2017 +0000 @@ -1,4 +1,4 @@ -function aglomCluster(data, clusterMethod, distanceMetric, numClusters) +function linkList = aglomCluster(data, clusterMethod, distanceMetric, numClusters) %% aglomCluster(data, clusterMethod, distanceMetric, numClusters) % This function performs aglomerative clustering on a given data set, % allowing the interpretation of a hierarchical data, and plotting a @@ -56,7 +56,7 @@ distMap = pdist(data, distanceMetric); linkList = linkage(distMap, clusterMethod); -[~,T] = dendrogram(linkList,numClusters); +% [~,T] = dendrogram(linkList,numClusters); end \ No newline at end of file diff -r b177d57ac0bd -r 699c769b76da phase2/treeLinkFeatures.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phase2/treeLinkFeatures.m Fri Feb 10 09:03:05 2017 +0000 @@ -0,0 +1,16 @@ +function linkList = treeLinkFeatures(data) + +linkList = aglomCluster(data); + +linkList(:,4) = 0; +listSize = size(data,1); +currentRow = [size(linkList,1)]; + + +while (linkList(currentRow(1),1) > listSize && linkList(currentRow(1),2) > listSize) + classList = traceLinkageToBinary(linkList, currentRow); + linkList(:,4) = rfFeatureSelection(data(classList>0,:), classList(classList>0)); + currentRow = [currentRow(2:end); currentRow(1),1; currentRow(1),2]; +end + +end \ No newline at end of file