Closed mpadge closed 6 years ago
Nodes are assigned to different clusters, which they should not be. This function should return FALSE:
FALSE
check_nodes <- function (scl) { cl <- data.frame (node = c (scl$tree$from, scl$tree$to), cl = scl$tree$clnum) %>% dplyr::filter (!is.na (cl)) %>% dplyr::distinct () %>% dplyr::arrange (node) any (duplicated (cl$node)) }
Then try some sample data using all three linkages
set.seed (3) n <- 100 xy <- matrix (runif (2 * n), ncol = 2) dmat <- matrix (runif (n ^ 2), ncol = n) scl1 <- scl_redcap (xy, dmat, ncl = 16, linkage = "complete") scl2 <- scl_redcap (xy, dmat, ncl = 16, linkage = "single") scl3 <- scl_redcap (xy, dmat, ncl = 16, linkage = "average") check_nodes (scl1); check_nodes (scl2); check_nodes (scl3) # [1] TRUE # [1] TRUE # [1] TRUE
Nope, should be FALSE, FALSE, FALSE.
and the problem has to lie in src/cuttree
src/cuttree
Nodes are assigned to different clusters, which they should not be. This function should return
FALSE
:Then try some sample data using all three linkages
Nope, should be
FALSE
,FALSE
,FALSE
.