### simulated data
parent.clustering <- c(rep("B1", 5), rep("B2", 10), rep("B3", 10))
# replace the branch 'B2' by its children 'B4' and 'B5'
children.clustering <- c(rep("B1", 5), rep("B4", 3), rep("B5", 7),
rep("B3", 10))
flat.clustering <- c(rep(1, 6), rep(2, 6), rep(3, 4), rep(4, 9))
# the ordering of flat clusters is '1','2','3' and '4'.
parent.weights <- table(parent.clustering, flat.clustering)
children.weights <- table(children.clustering, flat.clustering)
descendant.cross <- dyn.cross(children.weights[c('B4', 'B5'), ])
score.crossing(parent.weights, children.weights, descendant.cross)
## better score for the parent.tree
Run the code above in your browser using DataLab