view phase2/traceLinkageToBinary.m @ 13:b398be42561d

analysing test data, making sense of the treeLinkFeature output and identifying large number of results with features 1 2 3 4 5
author DaveM
date Fri, 10 Feb 2017 18:13:29 +0000
parents b177d57ac0bd
children 8613ec5ab369
line wrap: on
line source
function classList = traceLinkageToBinary(linkList, rowIndex)
%% class = traceLinkageToBinary(linkList, rowIndex)
% This function accepts a linkList and a rowIndex, and performs a transform
% to provide a classification list for all the data points in the original
% list. From a row index, if the data falls under column 1 (lower number)
% then it is given a class of 1, if it falls under column 2 (higher number)
% then it is given a class of 2. Any data not included in that branch of
% the hierarchy is given a class of 0
% linkList - the input result from linkages
% rowIndex - the row on which to split the data

listSize = size(linkList,1)+1;
c(1) = linkList(rowIndex,1);
c(2) = linkList(rowIndex,2);

leafList1 = traverseDownOneStep(linkList,[],c(1));
leafList2 = traverseDownOneStep(linkList,[],c(2));

classList = zeros(listSize,1);
classList(leafList1) = 1;
classList(leafList2) = 2;


end