Last updated on 2026-11-18 02:02:26 CET.
| Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
|---|---|---|---|---|---|---|
| r-devel-linux-x86_64-debian-clang | 1.0.0 | 40.87 | 577.18 | 618.05 | OK | |
| r-devel-linux-x86_64-debian-gcc | 1.0.0 | 26.76 | 429.74 | 456.50 | OK | |
| r-devel-linux-x86_64-fedora-clang | 1.0.0 | 31.00 | 381.46 | 412.46 | OK | |
| r-devel-linux-x86_64-fedora-gcc | 1.0.0 | 29.00 | 387.49 | 416.49 | OK | |
| r-devel-windows-x86_64 | 1.0.0 | 50.00 | 480.00 | 530.00 | OK | |
| r-patched-linux-x86_64 | 1.0.0 | 37.31 | 540.60 | 577.91 | OK | |
| r-release-linux-x86_64 | 1.0.0 | 35.51 | 540.57 | 576.08 | OK | |
| r-release-macos-arm64 | 1.0.0 | 9.00 | 99.00 | 108.00 | OK | |
| r-release-macos-x86_64 | 1.0.0 | 28.00 | 1092.00 | 1120.00 | OK | |
| r-release-windows-x86_64 | 1.0.0 | 59.00 | 379.00 | 438.00 | OK | |
| r-oldrel-macos-arm64 | 1.0.0 | 11.00 | 97.00 | 108.00 | ERROR | |
| r-oldrel-macos-x86_64 | 1.0.0 | 30.00 | 1085.00 | 1115.00 | OK | |
| r-oldrel-windows-x86_64 | 1.0.0 | 65.00 | 496.00 | 561.00 | OK |
Version: 1.0.0
Check: tests
Result: ERROR
Running ‘spelling.R’ [0s/0s]
Running ‘testthat.R’ [66s/49s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(sbm)
> library(aricode)
>
> test_check("sbm")
*** caught segfault ***
address 0x110, cause 'invalid permissions'
*** caught segfault ***
address 0x110, cause 'invalid permissions'
Traceback:
Traceback:
1: 1: FUN(X[[i]], ...)FUN(X[[i]], ...)
2: lapply(X = X, FUN = FUN, ...) 2: lapply(X = X, FUN = FUN, ...)
3: sapply(1:cardE, function(e) { 3: gr = matE[e, 1]sapply(1:cardE, function(e) { gc = matE[e, 2] gr = matE[e, 1] don = list_Mat[[e]] gc = matE[e, 2] maskNA = list_MaskNA[[e]] don = list_Mat[[e]] if (v_distrib[e] == "bernoulli") { maskNA = list_MaskNA[[e]] Unmdon = (1 - don) * maskNA } if (v_distrib[e] == "bernoulli") { Unmdon = (1 - don) * maskNA if (v_distrib[e] %in% c("laplace", "poisson", "gaussian", "ZIgaussian")) { } if (v_distrib[e] %in% c("laplace", "poisson", "gaussian", Unit <- maskNA "ZIgaussian")) { } Unit <- maskNA } if (v_distrib[e] == "ZIgaussian") { NonZerosdon <- (don != 0) Zerosdon <- (don == 0) * maskNA if (v_distrib[e] == "ZIgaussian") { } NonZerosdon <- (don != 0) Zerosdon <- (don == 0) * maskNA facteur = 1 if (gc < 1) { } facteur = 1 if (gc == 0) facteur = 1/2 if (gc < 1) { gc = gr if (gc == 0) } facteur = 1/2 gc = gr if (v_distrib[e] == "bernoulli") { } prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) if (v_distrib[e] == "bernoulli") { prov1m = (tau[[gr]]) %*% log(1 - list_theta[[e]]) %*% prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) t(tau[[gc]]) prov1m = (tau[[gr]]) %*% log(1 - list_theta[[e]]) %*% t(tau[[gc]]) return((sum(don * prov) + sum((Unmdon) * prov1m)) * facteur) return((sum(don * prov) + sum((Unmdon) * prov1m)) * facteur) } } if (v_distrib[e] == "poisson") { prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) if (v_distrib[e] == "poisson") { prov2 = (tau[[gr]]) %*% list_theta[[e]] %*% t(tau[[gc]]) prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) return((sum(don * prov) - sum(Unit * prov2)) * facteur) prov2 = (tau[[gr]]) %*% list_theta[[e]] %*% t(tau[[gc]]) } return((sum(don * prov) - sum(Unit * prov2)) * facteur) if (v_distrib[e] == "laplace") { } prov = (tau[[gr]]) %*% log(2 * list_theta[[e]]) %*% t(tau[[gc]]) if (v_distrib[e] == "laplace") { prov2 = (tau[[gr]]) %*% (1/list_theta[[e]]) %*% t(tau[[gc]]) prov = (tau[[gr]]) %*% log(2 * list_theta[[e]]) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don * prov2)) * facteur) prov2 = (tau[[gr]]) %*% (1/list_theta[[e]]) %*% t(tau[[gc]]) } return((-sum(Unit * prov) - sum(don * prov2)) * facteur) if (v_distrib[e] == "gaussian") { } prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + if (v_distrib[e] == "gaussian") { list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) t(tau[[gc]]) return((-sum(Unit * prov) - sum(don^2 * prov2) + sum(don * return((-sum(Unit * prov) - sum(don^2 * prov2) + sum(don * prov3)) * facteur) prov3)) * facteur) } } if (v_distrib[e] == "ZIgaussian") { if (v_distrib[e] == "ZIgaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) t(tau[[gc]]) P1 <- sum((-Unit * prov - don^2 * prov2 + don * prov3) * P1 <- sum((-Unit * prov - don^2 * prov2 + don * prov3) * (1 - Zerosdon)) (1 - Zerosdon)) prov4 = (tau[[gr]]) %*% log(list_theta[[e]]$p0 + (list_theta[[e]]$p0 == prov4 = (tau[[gr]]) %*% log(list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 0)) %*% t(tau[[gc]]) 0)) %*% t(tau[[gc]]) prov4m = (tau[[gr]]) %*% log(1 - list_theta[[e]]$p0 + prov4m = (tau[[gr]]) %*% log(1 - list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 1)) %*% t(tau[[gc]]) P2 <- sum(Zerosdon * prov4) + sum((1 - Zerosdon) * prov4m) (list_theta[[e]]$p0 == 1)) %*% t(tau[[gc]]) return((P1 + P2) * facteur) P2 <- sum(Zerosdon * prov4) + sum((1 - Zerosdon) * prov4m) } return((P1 + P2) * facteur)}) }
}) 4:
compLikICLInt(tau, list_theta, list_pi, matE, list_Mat, list_MaskNA, 4: n_q, v_K, v_distrib)
compLikICLInt(tau, list_theta, list_pi, matE, list_Mat, list_MaskNA, 5: n_q, v_K, v_distrib)varEMMBM(self, classif, tau = tau, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
5: 6: varEMMBM(self, classif, tau = tau, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE,
maxiterVEM = maxiterVEM) 6:
dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, 7: maxiterVEM = maxiterVEM)FUN(X[[i]], ...)
7: 8: FUN(X[[i]], ...)
lapply(X = S, FUN = FUN, ...) 8:
lapply(X = S, FUN = FUN, ...) 9:
doTryCatch(return(expr), name, parentenv, handler) 9:
doTryCatch(return(expr), name, parentenv, handler)10:
tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])11:
tryCatchList(expr, classes, parentenv, handlers)11:
tryCatchList(expr, classes, parentenv, handlers)12:
tryCatch(expr, error = function(e) {12: tryCatch(expr, error = function(e) { call <- conditionCall(e) call <- conditionCall(e) if (!is.null(call)) { if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") prefix <- paste("Error in", dcall, ": ") LONG <- 75L LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) type = "b") prefix <- paste0(prefix, "\n ") } if (w > LONG) else prefix <- "Error : " prefix <- paste0(prefix, "\n ") msg <- paste0(prefix, conditionMessage(e), "\n") } .Internal(seterrmessage(msg[1L])) else prefix <- "Error : " if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(printDeferredWarnings()) .Internal(seterrmessage(msg[1L])) } if (!silent && isTRUE(getOption("show.error.messages"))) { invisible(structure(msg, class = "try-error", condition = e)) cat(msg, file = outFile)}) .Internal(printDeferredWarnings())
}13: invisible(structure(msg, class = "try-error", condition = e))try(lapply(X = S, FUN = FUN, ...), silent = TRUE)})
14: 13: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
15:
FUN(X[[i]], ...)14:
sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))16:
lapply(seq_len(cores), inner.do)15:
17: FUN(X[[i]], ...)
mclapply(1:L, function(l) {16: estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, lapply(seq_len(cores), inner.do) maxiterVEM = maxiterVEM)
}, mc.cores = nbCores)17:
mclapply(1:L, function(l) {18: estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, maxiterVEM = maxiterVEM) Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, }, mc.cores = nbCores)
maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)18:
searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, 19: Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE,
maxiterVEM = maxiterVEM)19:
dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, 20: pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib, maxiterVEM = maxiterVEM) namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL,
initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, 20: maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib,
namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL, initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, 21: maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)myMBM$optimize(estimOptions)
21: 22: myMBM$optimize(estimOptions)eval(code, test_env)
22: 23: eval(code, test_env)eval(code, test_env)
23: eval(code, test_env)24:
withCallingHandlers({24: withCallingHandlers({ eval(code, test_env) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { if (snapshot_skipped) { skip("On CRAN") skip("On CRAN") } else if (!new_expectations && skip_on_empty) { } skip_empty() else if (!new_expectations && skip_on_empty) { } skip_empty()}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { }}, expectation = handle_expectation, packageNotFoundError = function(e) { skip(paste0("{", e$package, "} is not installed.")) if (on_cran()) { }}, snapshot_on_cran = function(cnd) { skip(paste0("{", e$package, "} is not installed.")) snapshot_skipped <<- TRUE }}, snapshot_on_cran = function(cnd) { invokeRestart("muffle_cran_snapshot") snapshot_skipped <<- TRUE}, skip = handle_skip, warning = handle_warning, message = handle_message, invokeRestart("muffle_cran_snapshot") error = handle_error, interrupt = handle_interrupt)}, skip = handle_skip, warning = handle_warning, message = handle_message,
error = handle_error, interrupt = handle_interrupt)25:
doTryCatch(return(expr), name, parentenv, handler)
25: 26: doTryCatch(return(expr), name, parentenv, handler)tryCatchOne(expr, names, parentenv, handlers[[1L]])
26: 27: tryCatchOne(expr, names, parentenv, handlers[[1L]])tryCatchList(expr, classes, parentenv, handlers)
27: 28: tryCatchList(expr, classes, parentenv, handlers)tryCatch(withCallingHandlers({
eval(code, test_env)28: new_expectations <- the$test_expectations > starting_expectationstryCatch(withCallingHandlers({ if (snapshot_skipped) { eval(code, test_env) skip("On CRAN") new_expectations <- the$test_expectations > starting_expectations } if (snapshot_skipped) { else if (!new_expectations && skip_on_empty) { skip_empty() skip("On CRAN") } }}, expectation = handle_expectation, packageNotFoundError = function(e) { else if (!new_expectations && skip_on_empty) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) skip_empty() } }}, expectation = handle_expectation, packageNotFoundError = function(e) {}, snapshot_on_cran = function(cnd) { if (on_cran()) { snapshot_skipped <<- TRUE skip(paste0("{", e$package, "} is not installed.")) invokeRestart("muffle_cran_snapshot") }}, skip = handle_skip, warning = handle_warning, message = handle_message, }, snapshot_on_cran = function(cnd) { error = handle_error, interrupt = handle_interrupt), error = handle_fatal) snapshot_skipped <<- TRUE
invokeRestart("muffle_cran_snapshot")29: doWithOneRestart(return(expr), restart)}, skip = handle_skip, warning = handle_warning, message = handle_message,
error = handle_error, interrupt = handle_interrupt), error = handle_fatal)30:
withOneRestart(expr, restarts[[1L]])29:
31: doWithOneRestart(return(expr), restart)withRestarts(tryCatch(withCallingHandlers({
eval(code, test_env)30: new_expectations <- the$test_expectations > starting_expectationswithOneRestart(expr, restarts[[1L]]) if (snapshot_skipped) {
skip("On CRAN")31: }withRestarts(tryCatch(withCallingHandlers({ else if (!new_expectations && skip_on_empty) { skip_empty() eval(code, test_env) } new_expectations <- the$test_expectations > starting_expectations}, expectation = handle_expectation, packageNotFoundError = function(e) { if (snapshot_skipped) { if (on_cran()) { skip("On CRAN") skip(paste0("{", e$package, "} is not installed.")) } } else if (!new_expectations && skip_on_empty) {}, snapshot_on_cran = function(cnd) { skip_empty() snapshot_skipped <<- TRUE } invokeRestart("muffle_cran_snapshot")}, expectation = handle_expectation, packageNotFoundError = function(e) {}, skip = handle_skip, warning = handle_warning, message = handle_message, if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { } })
}, snapshot_on_cran = function(cnd) {32: snapshot_skipped <<- TRUEtest_code(code, parent.frame()) invokeRestart("muffle_cran_snapshot")
33: }, skip = handle_skip, warning = handle_warning, message = handle_message, test_that("initializing Multipartite SBM works", { error = handle_error, interrupt = handle_interrupt), error = handle_fatal), if (Sys.info()["sysname"] != "Windows") { end_test = function() { set.seed(2) }) npc <- 30
Q <- 3 n <- npc * Q32: Z <- diag(Q) %x% matrix(1, npc, 1)test_code(code, parent.frame()) P <- matrix(runif(Q * Q), Q, Q)
A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z))33: B <- matrix(rpois(npc * Q * 20, 2), npc * Q, 20)test_that("initializing Multipartite SBM works", { netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, if (Sys.info()["sysname"] != "Windows") { dimLabels = c("Actor")) set.seed(2) netB <- defineSBM(B, "poisson", type = "bipartite", dimLabels = c("Actor", npc <- 30 "Stuff")) Q <- 3 myMBM <- MultipartiteSBM_fit$new(list(netA, netB)) n <- npc * Q expect_true(inherits(myMBM, "SBM")) Z <- diag(Q) %x% matrix(1, npc, 1) expect_true(inherits(myMBM, "MultipartiteSBM")) expect_true(inherits(myMBM, "MultipartiteSBM_fit")) P <- matrix(runif(Q * Q), Q, Q) expect_equal(myMBM$modelName, c("bernoulli", "poisson")) A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) expect_true(is.character(myMBM$modelName)) B <- matrix(rpois(npc * Q * 20, 2), npc * Q, 20) expect_equal(unname(myMBM$nbNodes), c(Q * npc, 20)) expect_equal(myMBM$directed, c(TRUE, NA)) netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, expect_equal(myMBM$nbNetworks, 2) dimLabels = c("Actor")) expect_equal(unname(myMBM$networkData[[1]]$nbNodes), netB <- defineSBM(B, "poisson", type = "bipartite", dimLabels = c("Actor", Q * npc) "Stuff")) expect_equal(unname(myMBM$networkData[[2]]$nbNodes), myMBM <- MultipartiteSBM_fit$new(list(netA, netB)) c(Q * npc, 20)) expect_true(inherits(myMBM, "SBM")) expect_equal(unname(myMBM$architecture), matrix(c(1, expect_true(inherits(myMBM, "MultipartiteSBM")) 1, 1, 2), 2, 2)) expect_true(inherits(myMBM, "MultipartiteSBM_fit")) if (packageVersion("purrr") >= "1.0.0") { test_list <- vector("list", 2) expect_equal(myMBM$modelName, c("bernoulli", "poisson")) test_list[[1]] = numeric(0) expect_true(is.character(myMBM$modelName)) test_list[[2]] = list(Actor = numeric(0), Stuff = numeric(0)) expect_equal(unname(myMBM$nbNodes), c(Q * npc, 20)) expect_equal(myMBM$blockProp, test_list) expect_equal(myMBM$directed, c(TRUE, NA)) } expect_equal(myMBM$nbNetworks, 2) expect_equal(myMBM$connectParam, list(list(mean = matrix(0, expect_equal(unname(myMBM$networkData[[1]]$nbNodes), 0, 0)), list(mean = matrix(0, 0, 0)))) Q * npc) expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) expect_equal(unname(myMBM$networkData[[2]]$nbNodes), expect_equal(coef(myMBM, "block"), myMBM$blockProp) c(Q * npc, 20)) estimOptions = list(initBM = FALSE, verbosity = 0, nbCores = 2) expect_equal(unname(myMBM$architecture), matrix(c(1, myMBM$optimize(estimOptions) 1, 1, 2), 2, 2)) expect_equal(length(myMBM$networkData[[1]]$memberships), if (packageVersion("purrr") >= "1.0.0") { npc * Q) test_list <- vector("list", 2) expect_equal(is.list(myMBM$networkData[[2]]$memberships), TRUE) test_list[[1]] = numeric(0) expect_equal(length(myMBM$networkData[[1]]$blockProp), test_list[[2]] = list(Actor = numeric(0), Stuff = numeric(0)) length(unique(myMBM$networkData[[1]]$memberships))) expect_equal(myMBM$blockProp, test_list) expect_equal(myMBM$networkData[[1]]$blockProp, myMBM$networkData[[2]]$blockProp[[1]]) } expect_equal(length(myMBM$networkData[[1]]$blockProp), expect_equal(myMBM$connectParam, list(list(mean = matrix(0, nrow(myMBM$networkData[[1]]$connectParam$mean)) 0, 0)), list(mean = matrix(0, 0, 0)))) expect_equal(ncol(myMBM$networkData[[1]]$connectParam$mean), expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) nrow(myMBM$networkData[[1]]$connectParam$mean)) expect_equal(coef(myMBM, "block"), myMBM$blockProp) muAS <- myMBM$networkData[[2]]$connectParam$mean estimOptions = list(initBM = FALSE, verbosity = 0, nbCores = 2) expect_equal(ifelse(is.matrix(muAS), nrow(muAS), length(muAS)), nrow(myMBM$networkData[[1]]$connectParam$mean)) myMBM$optimize(estimOptions) expect_equal(lengths(myMBM$blockProp), myMBM$nbBlocks) expect_equal(length(myMBM$networkData[[1]]$memberships), expect_equal(length(myMBM$blockProp), length(myMBM$dimLabels)) npc * Q) expect_equal(length(myMBM$connectParam), myMBM$nbNetworks) expect_equal(is.list(myMBM$networkData[[2]]$memberships), expect_equal(lengths(myMBM$memberships), myMBM$nbNodes) TRUE) expect_lt(myMBM$loglik, 0) expect_lt(myMBM$ICL, 0) expect_equal(length(myMBM$networkData[[1]]$blockProp), expect_lt(myMBM$ICL, myMBM$loglik) length(unique(myMBM$networkData[[1]]$memberships))) expect_silent(plot(myMBM, type = "data")) expect_equal(myMBM$networkData[[1]]$blockProp, myMBM$networkData[[2]]$blockProp[[1]]) expect_silent(plot(myMBM, type = "meso")) expect_equal(length(myMBM$networkData[[1]]$blockProp), expect_silent(plot(myMBM, type = "expected")) expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) nrow(myMBM$networkData[[1]]$connectParam$mean)) expect_equal(coef(myMBM, "block"), myMBM$blockProp) expect_equal(ncol(myMBM$networkData[[1]]$connectParam$mean), expect_lt(rmse(myMBM$connectParam[[1]]$mean, netA$connectParam$mean), nrow(myMBM$networkData[[1]]$connectParam$mean)) 0.01) muAS <- myMBM$networkData[[2]]$connectParam$mean expect_lt(rmse(myMBM$connectParam[[2]]$mean, netB$connectParam$mean), expect_equal(ifelse(is.matrix(muAS), nrow(muAS), length(muAS)), 0.01) nrow(myMBM$networkData[[1]]$connectParam$mean)) expect_lt(1 - aricode::ARI(myMBM$memberships$Actor, netA$memberships), expect_equal(lengths(myMBM$blockProp), myMBM$nbBlocks) 0.05) } expect_equal(length(myMBM$blockProp), length(myMBM$dimLabels)) expect_equal(length(myMBM$connectParam), myMBM$nbNetworks)}) expect_equal(lengths(myMBM$memberships), myMBM$nbNodes)
expect_lt(myMBM$loglik, 0)34: expect_lt(myMBM$ICL, 0)eval(code, test_env)
expect_lt(myMBM$ICL, myMBM$loglik)35: expect_silent(plot(myMBM, type = "data"))eval(code, test_env) expect_silent(plot(myMBM, type = "meso"))
expect_silent(plot(myMBM, type = "expected"))36: expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam)withCallingHandlers({ expect_equal(coef(myMBM, "block"), myMBM$blockProp) expect_lt(rmse(myMBM$connectParam[[1]]$mean, netA$connectParam$mean), eval(code, test_env) 0.01) new_expectations <- the$test_expectations > starting_expectations expect_lt(rmse(myMBM$connectParam[[2]]$mean, netB$connectParam$mean), if (snapshot_skipped) { skip("On CRAN") 0.01) } expect_lt(1 - aricode::ARI(myMBM$memberships$Actor, netA$memberships), else if (!new_expectations && skip_on_empty) { 0.05) skip_empty() } }})}, expectation = handle_expectation, packageNotFoundError = function(e) {
if (on_cran()) {34: eval(code, test_env) skip(paste0("{", e$package, "} is not installed."))
}35: }, snapshot_on_cran = function(cnd) {eval(code, test_env) snapshot_skipped <<- TRUE
invokeRestart("muffle_cran_snapshot")36: }, skip = handle_skip, warning = handle_warning, message = handle_message, withCallingHandlers({ error = handle_error, interrupt = handle_interrupt)
eval(code, test_env)37: new_expectations <- the$test_expectations > starting_expectationsdoTryCatch(return(expr), name, parentenv, handler)
if (snapshot_skipped) {38: skip("On CRAN") }tryCatchOne(expr, names, parentenv, handlers[[1L]]) else if (!new_expectations && skip_on_empty) {
skip_empty()39: }tryCatchList(expr, classes, parentenv, handlers)}, expectation = handle_expectation, packageNotFoundError = function(e) {
if (on_cran()) {40: skip(paste0("{", e$package, "} is not installed."))tryCatch(withCallingHandlers({ } eval(code, test_env)}, snapshot_on_cran = function(cnd) { new_expectations <- the$test_expectations > starting_expectations snapshot_skipped <<- TRUE if (snapshot_skipped) { invokeRestart("muffle_cran_snapshot") skip("On CRAN")}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt) else if (!new_expectations && skip_on_empty) { skip_empty() }
}, expectation = handle_expectation, packageNotFoundError = function(e) {37: if (on_cran()) {doTryCatch(return(expr), name, parentenv, handler) skip(paste0("{", e$package, "} is not installed."))
}38: }, snapshot_on_cran = function(cnd) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) snapshot_skipped <<- TRUE
invokeRestart("muffle_cran_snapshot")39: }, skip = handle_skip, warning = handle_warning, message = handle_message, tryCatchList(expr, classes, parentenv, handlers) error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
40: 41: tryCatch(withCallingHandlers({doWithOneRestart(return(expr), restart) eval(code, test_env)
new_expectations <- the$test_expectations > starting_expectations42: withOneRestart(expr, restarts[[1L]]) if (snapshot_skipped) {
skip("On CRAN") }43: else if (!new_expectations && skip_on_empty) {withRestarts(tryCatch(withCallingHandlers({ skip_empty() eval(code, test_env) } new_expectations <- the$test_expectations > starting_expectations}, expectation = handle_expectation, packageNotFoundError = function(e) { if (snapshot_skipped) { skip("On CRAN") if (on_cran()) { } skip(paste0("{", e$package, "} is not installed.")) else if (!new_expectations && skip_on_empty) { } skip_empty() }}, snapshot_on_cran = function(cnd) {}, expectation = handle_expectation, packageNotFoundError = function(e) { snapshot_skipped <<- TRUE if (on_cran()) { invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt), error = handle_fatal)}, snapshot_on_cran = function(cnd) {
41: snapshot_skipped <<- TRUEdoWithOneRestart(return(expr), restart)
invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, 42: error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() {withOneRestart(expr, restarts[[1L]]) })
44: 43: test_code(code = exprs, env = env, reporter = get_reporter() %||% withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) StopReporter$new()) new_expectations <- the$test_expectations > starting_expectations
if (snapshot_skipped) {45: source_file(path, env = env(env), desc = desc, shuffle = shuffle, skip("On CRAN") } error_call = error_call) else if (!new_expectations && skip_on_empty) { skip_empty()
}46: }, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) {FUN(X[[i]], ...) skip(paste0("{", e$package, "} is not installed."))
}47: }, snapshot_on_cran = function(cnd) {lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, snapshot_skipped <<- TRUE error_call = error_call) invokeRestart("muffle_cran_snapshot")
48: }, skip = handle_skip, warning = handle_warning, message = handle_message, doTryCatch(return(expr), name, parentenv, handler)
error = handle_error, interrupt = handle_interrupt), error = handle_fatal), 49: end_test = function() {tryCatchOne(expr, names, parentenv, handlers[[1L]]) })
50:
tryCatchList(expr, classes, parentenv, handlers)44:
test_code(code = exprs, env = env, reporter = get_reporter() %||% 51: StopReporter$new())tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n")
NULL45: })source_file(path, env = env(env), desc = desc, shuffle = shuffle,
52: error_call = error_call)with_reporter(reporters$multi, lapply(test_paths, test_one_file,
env = env, desc = desc, shuffle = shuffle, error_call = error_call))46:
FUN(X[[i]], ...)53:
test_files_serial(test_dir = test_dir, test_package = test_package, 47: test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, error_call = error_call) desc = desc, load_package = load_package, shuffle = shuffle,
error_call = error_call)48:
54: doTryCatch(return(expr), name, parentenv, handler)test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env,
stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 49: tryCatchOne(expr, names, parentenv, handlers[[1L]]) load_package = load_package, parallel = parallel, shuffle = shuffle)
55: 50: test_dir("testthat", package = package, reporter = reporter, tryCatchList(expr, classes, parentenv, handlers) ..., load_package = "installed")
51: 56: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n")test_check("sbm")
NULL})An irrecoverable exception occurred. R is aborting now ...
52: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call))
53: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call)
54: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle)
55: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed")
56: test_check("sbm")
An irrecoverable exception occurred. R is aborting now ...
Saving _problems/test-MultipartiteSBM-50.R
*** caught segfault ***
address 0x110, cause 'invalid permissions'
Traceback:
1: FUN(X[[i]], ...)
2: lapply(X = X, FUN = FUN, ...)
3: sapply(1:cardE, function(e) { gr = matE[e, 1] gc = matE[e, 2] don = list_Mat[[e]] maskNA = list_MaskNA[[e]] if (v_distrib[e] == "bernoulli") { Unmdon = (1 - don) * maskNA } if (v_distrib[e] %in% c("laplace", "poisson", "gaussian", "ZIgaussian")) { Unit <- maskNA } if (v_distrib[e] == "ZIgaussian") { NonZerosdon <- (don != 0) Zerosdon <- (don == 0) * maskNA } facteur = 1 if (gc < 1) { if (gc == 0) facteur = 1/2 gc = gr } if (v_distrib[e] == "bernoulli") { prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov1m = (tau[[gr]]) %*% log(1 - list_theta[[e]]) %*% t(tau[[gc]]) return((sum(don * prov) + sum((Unmdon) * prov1m)) * facteur) } if (v_distrib[e] == "poisson") { prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov2 = (tau[[gr]]) %*% list_theta[[e]] %*% t(tau[[gc]]) return((sum(don * prov) - sum(Unit * prov2)) * facteur) } if (v_distrib[e] == "laplace") { prov = (tau[[gr]]) %*% log(2 * list_theta[[e]]) %*% t(tau[[gc]]) prov2 = (tau[[gr]]) %*% (1/list_theta[[e]]) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don * prov2)) * facteur) } if (v_distrib[e] == "gaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don^2 * prov2) + sum(don * prov3)) * facteur) } if (v_distrib[e] == "ZIgaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) P1 <- sum((-Unit * prov - don^2 * prov2 + don * prov3) * (1 - Zerosdon)) prov4 = (tau[[gr]]) %*% log(list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 0)) %*% t(tau[[gc]]) prov4m = (tau[[gr]]) %*% log(1 - list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 1)) %*% t(tau[[gc]]) P2 <- sum(Zerosdon * prov4) + sum((1 - Zerosdon) * prov4m) return((P1 + P2) * facteur) }})
4: compLikICLInt(tau, list_theta, list_pi, matE, list_Mat, list_MaskNA, n_q, v_K, v_distrib)
5: varEMMBM(self, classif, tau = tau, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
6: dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
7: FUN(X[[i]], ...)
8: lapply(X = S, FUN = FUN, ...)
9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
13: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
14: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
15: FUN(X[[i]], ...)
16: lapply(seq_len(cores), inner.do)
17: mclapply(1:L, function(l) { estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)}, mc.cores = nbCores)
18: searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
19: dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
20: GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib, namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL, initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
21: super$optimize(estimOptions)
22: myMultiplexFitindep$optimize(estimOptions = currentOptions)
23: eval(code, test_env)
24: eval(code, test_env)
25: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)
26: doTryCatch(return(expr), name, parentenv, handler)
27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
28: tryCatchList(expr, classes, parentenv, handlers)
29: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
30: doWithOneRestart(return(expr), restart)
31: withOneRestart(expr, restarts[[1L]])
32: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { })
33: test_code(code, parent.frame())
34: test_that("Inference for Multiplex networks", { if (Sys.info()["sysname"] != "Windows") { set.seed(2) npc <- 30 Q <- 3 n <- npc * Q Z <- diag(Q) %x% matrix(1, npc, 1) P <- matrix(runif(Q * Q), Q, Q) A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) type <- "simple" netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, dimLabels = c("Actor")) B <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) netB <- defineSBM(B, "bernoulli", type = "simple", dimLabels = c("Actor")) myMultiplex <- MultiplexSBM_fit$new(list(netA, netB)) netC <- defineSBM(B * 4, "poisson", type = "simple", dimLabels = c("Actor")) expect_equal(myMultiplex$directed, c(TRUE, TRUE)) expect_equal(myMultiplex$nbNetworks, 2) expect_equal(myMultiplex$dependentNetwork, FALSE) expect_equal(MultiplexSBM_fit$new(list(netA, netB), TRUE)$dependentNetwork, TRUE) expect_error(MultiplexSBM_fit$new(list(netA, netC), TRUE)) expect_error(MultiplexSBM_fit$new(list(netA, netB, netB), TRUE)) expect_warning(defineSBM(B, "poisson", type = "simple", dimLabels = c("Actor")), "binary") currentOptions <- list(verbosity = 0, plot = FALSE, nbBlocksRange = list(c(1, 10)), nbCores = 2, maxiterVE = 100, maxiterVEM = 100, initBM = TRUE) myMultiplexFitindep <- MultiplexSBM_fit$new(list(netA, netB, netC)) myMultiplexFitindep$optimize(estimOptions = currentOptions) expect_equal(length(myMultiplexFitindep$connectParam), 3) myMultiplexFitdep <- MultiplexSBM_fit$new(list(netA, netB), dependentNet = TRUE) currentOptions <- list(verbosity = 0, plot = FALSE, explorFactor = 1.5, nbBlocksRange = c(4, Inf), nbCores = 2, fast = TRUE) myMultiplexFitdep$optimize(estimOptions = currentOptions) myMultiplexFitdep$probMemberships expect_equal(class(myMultiplexFitdep$memberships), "list") expect_equal(length(myMultiplexFitdep$connectParam), 4) expect_equal(myMultiplexFitdep$dependentNetwork, TRUE) set.seed(2) npc1 <- 30 npc2 <- 20 Q1 <- 2 Q2 <- 3 n1 <- npc1 * Q1 n2 <- npc2 * Q2 Z1 <- diag(Q1) %x% matrix(1, npc1, 1) Z2 <- diag(Q2) %x% matrix(1, npc2, 1) P <- matrix(runif(Q1 * Q2), Q1, Q2) A <- 1 * (matrix(runif(n1 * n2), n1, n2) < Z1 %*% P %*% t(Z2)) netA <- defineSBM(A, "bernoulli", type = "bipartite", directed = TRUE, dimLabels = c("Actor", "Object")) B <- 1 * (matrix(runif(n1 * n2), n1, n2) < Z1 %*% P %*% t(Z2)) netB <- defineSBM(B, "bernoulli", type = "bipartite", dimLabels = c("Actor", "Object")) myMultiplexFitindep <- MultiplexSBM_fit$new(list(netA, netB)) currentOptions <- list(verbosity = 0, nbBlocksRange = list(c(1, 10), c(1, 10)), nbCores = 2, maxiterVE = 100, maxiterVEM = 100, initBM = FALSE) names(currentOptions$nbBlocksRange) = c("Actor", "Object") myMultiplexFitindep$optimize(currentOptions) expect_equal(length(myMultiplexFitindep$connectParam), 2) }})
35: eval(code, test_env)
36: eval(code, test_env)
37: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)
38: doTryCatch(return(expr), name, parentenv, handler)
39: tryCatchOne(expr, names, parentenv, handlers[[1L]])
40: tryCatchList(expr, classes, parentenv, handlers)
41: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
42: doWithOneRestart(return(expr), restart)
43: withOneRestart(expr, restarts[[1L]])
44: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { })
45: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new())
46: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call)
47: FUN(X[[i]], ...)
48: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)
49: doTryCatch(return(expr), name, parentenv, handler)
50: tryCatchOne(expr, names, parentenv, handlers[[1L]])
51: tryCatchList(expr, classes, parentenv, handlers)
52: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL})
53: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call))
54: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call)
55: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle)
56: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed")
57: test_check("sbm")
An irrecoverable exception occurred. R is aborting now ...
*** caught segfault ***
address 0x110, cause 'invalid permissions'
Traceback:
1: FUN(X[[i]], ...)
2: lapply(X = X, FUN = FUN, ...)
3: sapply(1:cardE, function(e) { gr = matE[e, 1] gc = matE[e, 2] don = list_Mat[[e]] maskNA = list_MaskNA[[e]] if (v_distrib[e] == "bernoulli") { Unmdon = (1 - don) * maskNA } if (v_distrib[e] %in% c("laplace", "poisson", "gaussian", "ZIgaussian")) { Unit <- maskNA } if (v_distrib[e] == "ZIgaussian") { NonZerosdon <- (don != 0) Zerosdon <- (don == 0) * maskNA } facteur = 1 if (gc < 1) { if (gc == 0) facteur = 1/2 gc = gr } if (v_distrib[e] == "bernoulli") { prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov1m = (tau[[gr]]) %*% log(1 - list_theta[[e]]) %*% t(tau[[gc]]) return((sum(don * prov) + sum((Unmdon) * prov1m)) * facteur) } if (v_distrib[e] == "poisson") { prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov2 = (tau[[gr]]) %*% list_theta[[e]] %*% t(tau[[gc]]) return((sum(don * prov) - sum(Unit * prov2)) * facteur) } if (v_distrib[e] == "laplace") { prov = (tau[[gr]]) %*% log(2 * list_theta[[e]]) %*% t(tau[[gc]]) prov2 = (tau[[gr]]) %*% (1/list_theta[[e]]) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don * prov2)) * facteur) } if (v_distrib[e] == "gaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don^2 * prov2) + sum(don * prov3)) * facteur) } if (v_distrib[e] == "ZIgaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% t(tau[[gc]]) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) P1 <- sum((-Unit * prov - don^2 * prov2 + don * prov3) * (1 - Zerosdon)) prov4 = (tau[[gr]]) %*% log(list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 0)) %*% t(tau[[gc]]) prov4m = (tau[[gr]]) %*% log(1 - list_theta[[e]]$p0 + (list_theta[[e]]$p0 == 1)) %*% t(tau[[gc]]) P2 <- sum(Zerosdon * prov4) + sum((1 - Zerosdon) * prov4m) return((P1 + P2) * facteur) }})
4: compLikICLInt(tau, list_theta, list_pi, matE, list_Mat, list_MaskNA, n_q, v_K, v_distrib)
5: varEMMBM(self, classif, tau = tau, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
6: dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
7: FUN(X[[i]], ...)
8: lapply(X = S, FUN = FUN, ...)
9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
13: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
14: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
15: FUN(X[[i]], ...)
16: lapply(seq_len(cores), inner.do)
17: mclapply(1:L, function(l) { estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)}, mc.cores = nbCores)
18: searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
19: dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
20: GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib, namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL, initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM)
21: super$optimize(estimOptions)
22: myMultiplexFitindep$optimize(estimOptions = currentOptions)
23: eval(code, test_env)
24: eval(code, test_env)
25: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)
26: doTryCatch(return(expr), name, parentenv, handler)
27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
28: tryCatchList(expr, classes, parentenv, handlers)
29: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
30: doWithOneRestart(return(expr), restart)
31: withOneRestart(expr, restarts[[1L]])
32: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { })
33: test_code(code, parent.frame())
34: test_that("Inference for Multiplex networks", { if (Sys.info()["sysname"] != "Windows") { set.seed(2) npc <- 30 Q <- 3 n <- npc * Q Z <- diag(Q) %x% matrix(1, npc, 1) P <- matrix(runif(Q * Q), Q, Q) A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) type <- "simple" netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, dimLabels = c("Actor")) B <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) netB <- defineSBM(B, "bernoulli", type = "simple", dimLabels = c("Actor")) myMultiplex <- MultiplexSBM_fit$new(list(netA, netB)) netC <- defineSBM(B * 4, "poisson", type = "simple", dimLabels = c("Actor")) expect_equal(myMultiplex$directed, c(TRUE, TRUE)) expect_equal(myMultiplex$nbNetworks, 2) expect_equal(myMultiplex$dependentNetwork, FALSE) expect_equal(MultiplexSBM_fit$new(list(netA, netB), TRUE)$dependentNetwork, TRUE) expect_error(MultiplexSBM_fit$new(list(netA, netC), TRUE)) expect_error(MultiplexSBM_fit$new(list(netA, netB, netB), TRUE)) expect_warning(defineSBM(B, "poisson", type = "simple", dimLabels = c("Actor")), "binary") currentOptions <- list(verbosity = 0, plot = FALSE, nbBlocksRange = list(c(1, 10)), nbCores = 2, maxiterVE = 100, maxiterVEM = 100, initBM = TRUE) myMultiplexFitindep <- MultiplexSBM_fit$new(list(netA, netB, netC)) myMultiplexFitindep$optimize(estimOptions = currentOptions) expect_equal(length(myMultiplexFitindep$connectParam), 3) myMultiplexFitdep <- MultiplexSBM_fit$new(list(netA, netB), dependentNet = TRUE) currentOptions <- list(verbosity = 0, plot = FALSE, explorFactor = 1.5, nbBlocksRange = c(4, Inf), nbCores = 2, fast = TRUE) myMultiplexFitdep$optimize(estimOptions = currentOptions) myMultiplexFitdep$probMemberships expect_equal(class(myMultiplexFitdep$memberships), "list") expect_equal(length(myMultiplexFitdep$connectParam), 4) expect_equal(myMultiplexFitdep$dependentNetwork, TRUE) set.seed(2) npc1 <- 30 npc2 <- 20 Q1 <- 2 Q2 <- 3 n1 <- npc1 * Q1 n2 <- npc2 * Q2 Z1 <- diag(Q1) %x% matrix(1, npc1, 1) Z2 <- diag(Q2) %x% matrix(1, npc2, 1) P <- matrix(runif(Q1 * Q2), Q1, Q2) A <- 1 * (matrix(runif(n1 * n2), n1, n2) < Z1 %*% P %*% t(Z2)) netA <- defineSBM(A, "bernoulli", type = "bipartite", directed = TRUE, dimLabels = c("Actor", "Object")) B <- 1 * (matrix(runif(n1 * n2), n1, n2) < Z1 %*% P %*% t(Z2)) netB <- defineSBM(B, "bernoulli", type = "bipartite", dimLabels = c("Actor", "Object")) myMultiplexFitindep <- MultiplexSBM_fit$new(list(netA, netB)) currentOptions <- list(verbosity = 0, nbBlocksRange = list(c(1, 10), c(1, 10)), nbCores = 2, maxiterVE = 100, maxiterVEM = 100, initBM = FALSE) names(currentOptions$nbBlocksRange) = c("Actor", "Object") myMultiplexFitindep$optimize(currentOptions) expect_equal(length(myMultiplexFitindep$connectParam), 2) }})
35: eval(code, test_env)
36: eval(code, test_env)
37: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)
38: doTryCatch(return(expr), name, parentenv, handler)
39: tryCatchOne(expr, names, parentenv, handlers[[1L]])
40: tryCatchList(expr, classes, parentenv, handlers)
41: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
42: doWithOneRestart(return(expr), restart)
43: withOneRestart(expr, restarts[[1L]])
44: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { })
45: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new())
46: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call)
47: FUN(X[[i]], ...)
48: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)
49: doTryCatch(return(expr), name, parentenv, handler)
50: tryCatchOne(expr, names, parentenv, handlers[[1L]])
51: tryCatchList(expr, classes, parentenv, handlers)
52: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL})
53: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call))
54: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call)
55: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle)
56: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed")
57: test_check("sbm")
An irrecoverable exception occurred. R is aborting now ...
Saving _problems/test-MultiplexSBM_fit-39.R
[1] "use of sampleMultipartite"
[1] "use of sampleMultipartite"
[ FAIL 2 | WARN 2 | SKIP 0 | PASS 1480 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-MultipartiteSBM.R:50:5'): initializing Multipartite SBM works ──
Error in `which(sapply(R, function(u) { u$convergence }))`: argument to 'which' is not logical
Backtrace:
▆
1. └─myMBM$optimize(estimOptions) at test-MultipartiteSBM.R:50:5
2. └─GREMLINS::multipartiteBM(...)
3. └─dataR6$searchNbClusters(...)
4. └─GREMLINS:::searchKQ(...)
5. └─dataR6$cleanResults(allEstim)
6. └─GREMLINS:::cleanEstim(self, R)
7. └─base::which(...)
── Error ('test-MultiplexSBM_fit.R:39:5'): Inference for Multiplex networks ────
Error in `which(sapply(R, function(u) { u$convergence }))`: argument to 'which' is not logical
Backtrace:
▆
1. └─myMultiplexFitindep$optimize(estimOptions = currentOptions) at test-MultiplexSBM_fit.R:39:5
2. └─super$optimize(estimOptions)
3. └─GREMLINS::multipartiteBM(...)
4. └─dataR6$searchNbClusters(...)
5. └─GREMLINS:::searchKQ(...)
6. └─dataR6$cleanResults(allEstim)
7. └─GREMLINS:::cleanEstim(self, R)
8. └─base::which(...)
[ FAIL 2 | WARN 2 | SKIP 0 | PASS 1480 ]
Error:
! Test failures.
Execution halted
Flavor: r-oldrel-macos-arm64