CRAN Package Check Results for Package sbm

Last updated on 2026-11-26 18:59:19 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.0.0 41.38 592.65 634.03 OK
r-devel-linux-x86_64-debian-gcc 1.0.0 26.65 441.71 468.36 OK
r-devel-linux-x86_64-fedora-clang 1.0.0 32.00 400.34 432.34 OK
r-devel-linux-x86_64-fedora-gcc 1.0.0 30.00 403.32 433.32 OK
r-devel-windows-x86_64 1.0.0 51.00 447.00 498.00 OK
r-patched-linux-x86_64 1.0.0 39.08 567.98 607.06 OK
r-release-linux-x86_64 1.0.0 36.58 568.90 605.48 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 48.00 379.00 427.00 OK
r-oldrel-macos-arm64 1.0.0 10.00 130.00 140.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 61.00 480.00 541.00 OK

Check Details

Version: 1.0.0
Check: tests
Result: ERROR Running ‘spelling.R’ [0s/0s] Running ‘testthat.R’ [64s/47s] 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: 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: Traceback: doTryCatch(return(expr), name, parentenv, handler) 1: FUN(X[[i]], ...)10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 2: lapply(X = X, FUN = FUN, ...)11: tryCatchList(expr, classes, parentenv, handlers) 3: 12: sapply(1:cardE, function(e) {tryCatch(expr, error = function(e) { gr = matE[e, 1] call <- conditionCall(e) gc = matE[e, 2] if (!is.null(call)) { don = list_Mat[[e]] if (identical(call[[1L]], quote(doTryCatch))) maskNA = list_MaskNA[[e]] call <- sys.call(-4L) if (v_distrib[e] == "bernoulli") { dcall <- deparse(call, nlines = 1L) Unmdon = (1 - don) * maskNA prefix <- paste("Error in", dcall, ": ") } LONG <- 75L if (v_distrib[e] %in% c("laplace", "poisson", "gaussian", sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") "ZIgaussian")) { if (is.na(w)) Unit <- maskNA w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], } type = "b") if (w > LONG) if (v_distrib[e] == "ZIgaussian") { prefix <- paste0(prefix, "\n ") NonZerosdon <- (don != 0) } Zerosdon <- (don == 0) * maskNA else prefix <- "Error : " } msg <- paste0(prefix, conditionMessage(e), "\n") facteur = 1 if (gc < 1) { .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { if (gc == 0) cat(msg, file = outFile) facteur = 1/2 .Internal(printDeferredWarnings()) gc = gr } } invisible(structure(msg, class = "try-error", condition = e)) if (v_distrib[e] == "bernoulli") {}) prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov1m = (tau[[gr]]) %*% log(1 - list_theta[[e]]) %*% 13: t(tau[[gc]])try(lapply(X = S, FUN = FUN, ...), silent = TRUE) return((sum(don * prov) + sum((Unmdon) * prov1m)) * facteur) }14: if (v_distrib[e] == "poisson") {sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) prov = (tau[[gr]]) %*% log(list_theta[[e]]) %*% t(tau[[gc]]) prov2 = (tau[[gr]]) %*% list_theta[[e]] %*% t(tau[[gc]])15: return((sum(don * prov) - sum(Unit * prov2)) * facteur) }FUN(X[[i]], ...) 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]])16: return((-sum(Unit * prov) - sum(don * prov2)) * facteur)lapply(seq_len(cores), inner.do) } if (v_distrib[e] == "gaussian") {17: prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + mclapply(1:L, function(l) { list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]]) estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% maxiterVEM = maxiterVEM) t(tau[[gc]])}, mc.cores = nbCores) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]]) return((-sum(Unit * prov) - sum(don^2 * prov2) + sum(don * 18: searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, prov3)) * facteur) maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) } if (v_distrib[e] == "ZIgaussian") { prov = 0.5 * (tau[[gr]]) %*% (log(2 * pi * list_theta[[e]]$var) + 19: list_theta[[e]]$mean^2/list_theta[[e]]$var) %*% t(tau[[gc]])dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, prov2 = 0.5 * (tau[[gr]]) %*% (1/list_theta[[e]]$var) %*% pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, t(tau[[gc]]) maxiterVEM = maxiterVEM) prov3 = (tau[[gr]]) %*% (list_theta[[e]]$mean/list_theta[[e]]$var) %*% t(tau[[gc]])20: P1 <- sum((-Unit * prov - don^2 * prov2 + don * prov3) * (1 - Zerosdon))GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib, prov4 = (tau[[gr]]) %*% log(list_theta[[e]]$p0 + (list_theta[[e]]$p0 == namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL, 0)) %*% t(tau[[gc]]) prov4m = (tau[[gr]]) %*% log(1 - list_theta[[e]]$p0 + initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, (list_theta[[e]]$p0 == 1)) %*% t(tau[[gc]]) P2 <- sum(Zerosdon * prov4) + sum((1 - Zerosdon) * prov4m) maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) return((P1 + P2) * facteur) }21: })myMBM$optimize(estimOptions) 4: 22: compLikICLInt(tau, list_theta, list_pi, matE, list_Mat, list_MaskNA, n_q, v_K, v_distrib)eval(code, test_env) 23: 5: eval(code, test_env)varEMMBM(self, classif, tau = tau, maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) 24: 6: withCallingHandlers({dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, eval(code, test_env) maxiterVEM = maxiterVEM) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { 7: skip("On CRAN")FUN(X[[i]], ...) } else if (!new_expectations && skip_on_empty) { 8: skip_empty()lapply(X = S, FUN = FUN, ...) } }, expectation = handle_expectation, packageNotFoundError = function(e) { 9: if (on_cran()) {doTryCatch(return(expr), name, parentenv, handler) skip(paste0("{", e$package, "} is not installed.")) }10: }, snapshot_on_cran = function(cnd) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")11: }, skip = handle_skip, warning = handle_warning, message = handle_message, tryCatchList(expr, classes, parentenv, handlers) error = handle_error, interrupt = handle_interrupt) 12: tryCatch(expr, error = function(e) {25: call <- conditionCall(e)doTryCatch(return(expr), name, parentenv, handler) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) 26: call <- sys.call(-4L)tryCatchOne(expr, names, parentenv, handlers[[1L]]) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ")27: LONG <- 75LtryCatchList(expr, classes, parentenv, handlers) sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) 28: w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], tryCatch(withCallingHandlers({ type = "b") eval(code, test_env) if (w > LONG) new_expectations <- the$test_expectations > starting_expectations prefix <- paste0(prefix, "\n ") if (snapshot_skipped) { } skip("On CRAN") else prefix <- "Error : " } msg <- paste0(prefix, conditionMessage(e), "\n") else if (!new_expectations && skip_on_empty) { .Internal(seterrmessage(msg[1L])) skip_empty() if (!silent && isTRUE(getOption("show.error.messages"))) { } cat(msg, file = outFile)}, expectation = handle_expectation, packageNotFoundError = function(e) { .Internal(printDeferredWarnings()) if (on_cran()) { } invisible(structure(msg, class = "try-error", condition = e)) skip(paste0("{", e$package, "} is not installed."))}) } }, snapshot_on_cran = function(cnd) {13: snapshot_skipped <<- TRUEtry(lapply(X = S, FUN = FUN, ...), silent = TRUE) invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, 14: error = handle_error, interrupt = handle_interrupt), error = handle_fatal)sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) 15: FUN(X[[i]], ...)29: doWithOneRestart(return(expr), restart) 16: 30: withOneRestart(expr, restarts[[1L]])lapply(seq_len(cores), inner.do) 31: 17: withRestarts(tryCatch(withCallingHandlers({mclapply(1:L, function(l) { estim.c.l <- dataR6$estime(list_classif_init[[l]], maxiterVE = maxiterVE, eval(code, test_env) maxiterVEM = maxiterVEM) new_expectations <- the$test_expectations > starting_expectations}, mc.cores = nbCores) if (snapshot_skipped) { skip("On CRAN")18: }searchKQ(dataR6 = self, classifInit = classifInit, pastICL = pastICL, else if (!new_expectations && skip_on_empty) { Kmin = Kmin, Kmax = Kmax, nbCores = nbCores, verbose = verbose, skip_empty() maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) } }, expectation = handle_expectation, packageNotFoundError = function(e) {19: if (on_cran()) {dataR6$searchNbClusters(classifInit, Kmin = v_Kmin, Kmax = v_Kmax, skip(paste0("{", e$package, "} is not installed.")) } pastICL = c(), verbose = verbose, nbCores = nbCores, maxiterVE = maxiterVE, }, snapshot_on_cran = function(cnd) { maxiterVEM = maxiterVEM) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")20: }, skip = handle_skip, warning = handle_warning, message = handle_message, GREMLINS::multipartiteBM(list_Net = listNetG, v_distrib = vdistrib, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), namesFG = namesFG, v_Kmin = v_Kmin, v_Kmax = v_Kmax, v_Kinit = NULL, end_test = function() { initBM = initBM, keep = TRUE, verbose = verbose, nbCores = nbCores, }) maxiterVE = maxiterVE, maxiterVEM = maxiterVEM) 32: 21: test_code(code, parent.frame())myMBM$optimize(estimOptions) 33: 22: test_that("initializing Multipartite SBM works", {eval(code, test_env) if (Sys.info()["sysname"] != "Windows") { set.seed(2)23: npc <- 30eval(code, test_env) Q <- 3 n <- npc * Q24: Z <- diag(Q) %x% matrix(1, npc, 1)withCallingHandlers({ P <- matrix(runif(Q * Q), Q, Q) eval(code, test_env) A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) new_expectations <- the$test_expectations > starting_expectations B <- matrix(rpois(npc * Q * 20, 2), npc * Q, 20) netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, if (snapshot_skipped) { dimLabels = c("Actor")) skip("On CRAN") netB <- defineSBM(B, "poisson", type = "bipartite", dimLabels = c("Actor", } "Stuff")) else if (!new_expectations && skip_on_empty) { myMBM <- MultipartiteSBM_fit$new(list(netA, netB)) skip_empty() expect_true(inherits(myMBM, "SBM")) expect_true(inherits(myMBM, "MultipartiteSBM")) } expect_true(inherits(myMBM, "MultipartiteSBM_fit"))}, expectation = handle_expectation, packageNotFoundError = function(e) { expect_equal(myMBM$modelName, c("bernoulli", "poisson")) if (on_cran()) { expect_true(is.character(myMBM$modelName)) skip(paste0("{", e$package, "} is not installed.")) } expect_equal(unname(myMBM$nbNodes), c(Q * npc, 20))}, snapshot_on_cran = function(cnd) { expect_equal(myMBM$directed, c(TRUE, NA)) snapshot_skipped <<- TRUE expect_equal(myMBM$nbNetworks, 2) invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, expect_equal(unname(myMBM$networkData[[1]]$nbNodes), error = handle_error, interrupt = handle_interrupt) Q * npc) expect_equal(unname(myMBM$networkData[[2]]$nbNodes), 25: c(Q * npc, 20))doTryCatch(return(expr), name, parentenv, handler) expect_equal(unname(myMBM$architecture), matrix(c(1, 1, 1, 2), 2, 2))26: if (packageVersion("purrr") >= "1.0.0") {tryCatchOne(expr, names, parentenv, handlers[[1L]]) test_list <- vector("list", 2) test_list[[1]] = numeric(0)27: test_list[[2]] = list(Actor = numeric(0), Stuff = numeric(0))tryCatchList(expr, classes, parentenv, handlers) expect_equal(myMBM$blockProp, test_list) }28: expect_equal(myMBM$connectParam, list(list(mean = matrix(0, tryCatch(withCallingHandlers({ 0, 0)), list(mean = matrix(0, 0, 0)))) eval(code, test_env) expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) new_expectations <- the$test_expectations > starting_expectations expect_equal(coef(myMBM, "block"), myMBM$blockProp) if (snapshot_skipped) { estimOptions = list(initBM = FALSE, verbosity = 0, nbCores = 2) skip("On CRAN") myMBM$optimize(estimOptions) } expect_equal(length(myMBM$networkData[[1]]$memberships), else if (!new_expectations && skip_on_empty) { npc * Q) skip_empty() expect_equal(is.list(myMBM$networkData[[2]]$memberships), } TRUE)}, expectation = handle_expectation, packageNotFoundError = function(e) { expect_equal(length(myMBM$networkData[[1]]$blockProp), if (on_cran()) { length(unique(myMBM$networkData[[1]]$memberships))) skip(paste0("{", e$package, "} is not installed.")) expect_equal(myMBM$networkData[[1]]$blockProp, myMBM$networkData[[2]]$blockProp[[1]]) } expect_equal(length(myMBM$networkData[[1]]$blockProp), }, snapshot_on_cran = function(cnd) { nrow(myMBM$networkData[[1]]$connectParam$mean)) snapshot_skipped <<- TRUE expect_equal(ncol(myMBM$networkData[[1]]$connectParam$mean), invokeRestart("muffle_cran_snapshot") nrow(myMBM$networkData[[1]]$connectParam$mean))}, skip = handle_skip, warning = handle_warning, message = handle_message, muAS <- myMBM$networkData[[2]]$connectParam$mean error = handle_error, interrupt = handle_interrupt), error = handle_fatal) expect_equal(ifelse(is.matrix(muAS), nrow(muAS), length(muAS)), 29: nrow(myMBM$networkData[[1]]$connectParam$mean))doWithOneRestart(return(expr), restart) expect_equal(lengths(myMBM$blockProp), myMBM$nbBlocks) expect_equal(length(myMBM$blockProp), length(myMBM$dimLabels))30: expect_equal(length(myMBM$connectParam), myMBM$nbNetworks)withOneRestart(expr, restarts[[1L]]) expect_equal(lengths(myMBM$memberships), myMBM$nbNodes) expect_lt(myMBM$loglik, 0)31: expect_lt(myMBM$ICL, 0)withRestarts(tryCatch(withCallingHandlers({ expect_lt(myMBM$ICL, myMBM$loglik) eval(code, test_env) expect_silent(plot(myMBM, type = "data")) new_expectations <- the$test_expectations > starting_expectations expect_silent(plot(myMBM, type = "meso")) if (snapshot_skipped) { expect_silent(plot(myMBM, type = "expected")) skip("On CRAN") expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) } expect_equal(coef(myMBM, "block"), myMBM$blockProp) else if (!new_expectations && skip_on_empty) { expect_lt(rmse(myMBM$connectParam[[1]]$mean, netA$connectParam$mean), skip_empty() 0.01) } expect_lt(rmse(myMBM$connectParam[[2]]$mean, netB$connectParam$mean), }, expectation = handle_expectation, packageNotFoundError = function(e) { 0.01) if (on_cran()) { expect_lt(1 - aricode::ARI(myMBM$memberships$Actor, netA$memberships), skip(paste0("{", e$package, "} is not installed.")) 0.05) } }}, snapshot_on_cran = function(cnd) {}) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")34: }, skip = handle_skip, warning = handle_warning, message = handle_message, eval(code, test_env) error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() {35: })eval(code, test_env) 32: 36: test_code(code, parent.frame())withCallingHandlers({ eval(code, test_env)33: new_expectations <- the$test_expectations > starting_expectationstest_that("initializing Multipartite SBM works", { if (snapshot_skipped) { if (Sys.info()["sysname"] != "Windows") { skip("On CRAN") set.seed(2) } npc <- 30 else if (!new_expectations && skip_on_empty) { Q <- 3 skip_empty() n <- npc * Q } Z <- diag(Q) %x% matrix(1, npc, 1)}, expectation = handle_expectation, packageNotFoundError = function(e) { P <- matrix(runif(Q * Q), Q, Q) if (on_cran()) { A <- 1 * (matrix(runif(n * n), n, n) < Z %*% P %*% t(Z)) skip(paste0("{", e$package, "} is not installed.")) B <- matrix(rpois(npc * Q * 20, 2), npc * Q, 20) } netA <- defineSBM(A, "bernoulli", type = "simple", directed = TRUE, }, snapshot_on_cran = function(cnd) { dimLabels = c("Actor")) snapshot_skipped <<- TRUE netB <- defineSBM(B, "poisson", type = "bipartite", dimLabels = c("Actor", invokeRestart("muffle_cran_snapshot") "Stuff"))}, skip = handle_skip, warning = handle_warning, message = handle_message, myMBM <- MultipartiteSBM_fit$new(list(netA, netB)) error = handle_error, interrupt = handle_interrupt) expect_true(inherits(myMBM, "SBM")) expect_true(inherits(myMBM, "MultipartiteSBM"))37: expect_true(inherits(myMBM, "MultipartiteSBM_fit"))doTryCatch(return(expr), name, parentenv, handler) expect_equal(myMBM$modelName, c("bernoulli", "poisson")) expect_true(is.character(myMBM$modelName))38: expect_equal(unname(myMBM$nbNodes), c(Q * npc, 20))tryCatchOne(expr, names, parentenv, handlers[[1L]]) expect_equal(myMBM$directed, c(TRUE, NA)) expect_equal(myMBM$nbNetworks, 2)39: expect_equal(unname(myMBM$networkData[[1]]$nbNodes), tryCatchList(expr, classes, parentenv, handlers) Q * npc) expect_equal(unname(myMBM$networkData[[2]]$nbNodes), 40: c(Q * npc, 20))tryCatch(withCallingHandlers({ expect_equal(unname(myMBM$architecture), matrix(c(1, eval(code, test_env) 1, 1, 2), 2, 2)) new_expectations <- the$test_expectations > starting_expectations if (packageVersion("purrr") >= "1.0.0") { if (snapshot_skipped) { test_list <- vector("list", 2) skip("On CRAN") test_list[[1]] = numeric(0) } test_list[[2]] = list(Actor = numeric(0), Stuff = numeric(0)) else if (!new_expectations && skip_on_empty) { expect_equal(myMBM$blockProp, test_list) skip_empty() } } expect_equal(myMBM$connectParam, list(list(mean = matrix(0, }, expectation = handle_expectation, packageNotFoundError = function(e) { 0, 0)), list(mean = matrix(0, 0, 0)))) if (on_cran()) { expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam) skip(paste0("{", e$package, "} is not installed.")) expect_equal(coef(myMBM, "block"), myMBM$blockProp) } estimOptions = list(initBM = FALSE, verbosity = 0, nbCores = 2)}, snapshot_on_cran = function(cnd) { myMBM$optimize(estimOptions) snapshot_skipped <<- TRUE expect_equal(length(myMBM$networkData[[1]]$memberships), invokeRestart("muffle_cran_snapshot") npc * Q)}, skip = handle_skip, warning = handle_warning, message = handle_message, expect_equal(is.list(myMBM$networkData[[2]]$memberships), error = handle_error, interrupt = handle_interrupt), error = handle_fatal) TRUE) expect_equal(length(myMBM$networkData[[1]]$blockProp), 41: length(unique(myMBM$networkData[[1]]$memberships)))doWithOneRestart(return(expr), restart) expect_equal(myMBM$networkData[[1]]$blockProp, myMBM$networkData[[2]]$blockProp[[1]]) expect_equal(length(myMBM$networkData[[1]]$blockProp), 42: nrow(myMBM$networkData[[1]]$connectParam$mean))withOneRestart(expr, restarts[[1L]]) expect_equal(ncol(myMBM$networkData[[1]]$connectParam$mean), nrow(myMBM$networkData[[1]]$connectParam$mean))43: muAS <- myMBM$networkData[[2]]$connectParam$meanwithRestarts(tryCatch(withCallingHandlers({ expect_equal(ifelse(is.matrix(muAS), nrow(muAS), length(muAS)), eval(code, test_env) nrow(myMBM$networkData[[1]]$connectParam$mean)) new_expectations <- the$test_expectations > starting_expectations expect_equal(lengths(myMBM$blockProp), myMBM$nbBlocks) if (snapshot_skipped) { expect_equal(length(myMBM$blockProp), length(myMBM$dimLabels)) skip("On CRAN") expect_equal(length(myMBM$connectParam), myMBM$nbNetworks) } expect_equal(lengths(myMBM$memberships), myMBM$nbNodes) else if (!new_expectations && skip_on_empty) { expect_lt(myMBM$loglik, 0) skip_empty() expect_lt(myMBM$ICL, 0) } expect_lt(myMBM$ICL, myMBM$loglik)}, expectation = handle_expectation, packageNotFoundError = function(e) { expect_silent(plot(myMBM, type = "data")) if (on_cran()) { expect_silent(plot(myMBM, type = "meso")) skip(paste0("{", e$package, "} is not installed.")) expect_silent(plot(myMBM, type = "expected")) } expect_equal(coef(myMBM, "connectivity"), myMBM$connectParam)}, snapshot_on_cran = function(cnd) { expect_equal(coef(myMBM, "block"), myMBM$blockProp) snapshot_skipped <<- TRUE expect_lt(rmse(myMBM$connectParam[[1]]$mean, netA$connectParam$mean), invokeRestart("muffle_cran_snapshot") 0.01)}, skip = handle_skip, warning = handle_warning, message = handle_message, expect_lt(rmse(myMBM$connectParam[[2]]$mean, netB$connectParam$mean), error = handle_error, interrupt = handle_interrupt), error = handle_fatal), 0.01) end_test = function() { expect_lt(1 - aricode::ARI(myMBM$memberships$Actor, netA$memberships), }) 0.05) }44: })test_code(code = exprs, env = env, reporter = get_reporter() %||% 34: StopReporter$new())eval(code, test_env) 45: 35: source_file(path, env = env(env), desc = desc, shuffle = shuffle, eval(code, test_env) error_call = error_call) 36: 46: withCallingHandlers({FUN(X[[i]], ...) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations47: if (snapshot_skipped) {lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, skip("On CRAN") error_call = error_call) } else if (!new_expectations && skip_on_empty) {48: skip_empty()doTryCatch(return(expr), name, parentenv, handler) } }, expectation = handle_expectation, packageNotFoundError = function(e) {49: if (on_cran()) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) skip(paste0("{", e$package, "} is not installed.")) }50: }, snapshot_on_cran = function(cnd) {tryCatchList(expr, classes, parentenv, handlers) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")51: }, skip = handle_skip, warning = handle_warning, message = handle_message, tryCatch(code, testthat_abort_reporter = function(cnd) { error = handle_error, interrupt = handle_interrupt) cat(conditionMessage(cnd), "\n") NULL37: })doTryCatch(return(expr), name, parentenv, handler) 52: 38: with_reporter(reporters$multi, lapply(test_paths, test_one_file, tryCatchOne(expr, names, parentenv, handlers[[1L]]) env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 39: 53: tryCatchList(expr, classes, parentenv, handlers)test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, 40: env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, tryCatch(withCallingHandlers({ desc = desc, load_package = load_package, shuffle = shuffle, eval(code, test_env) error_call = error_call) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {54: skip("On CRAN")test_files(test_dir = path, test_paths = test_paths, test_package = package, } reporter = reporter, load_helpers = load_helpers, env = env, else if (!new_expectations && skip_on_empty) { stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, skip_empty() load_package = load_package, parallel = parallel, shuffle = shuffle) } }, expectation = handle_expectation, packageNotFoundError = function(e) {55: if (on_cran()) {test_dir("testthat", package = package, reporter = reporter, skip(paste0("{", e$package, "} is not installed.")) ..., load_package = "installed") } }, snapshot_on_cran = function(cnd) {56: snapshot_skipped <<- TRUEtest_check("sbm") invokeRestart("muffle_cran_snapshot") }, skip = handle_skip, warning = handle_warning, message = handle_message, An irrecoverable exception occurred. R is aborting now ... error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 41: doWithOneRestart(return(expr), restart) 42: withOneRestart(expr, restarts[[1L]]) 43: 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() { }) 44: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 45: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 46: FUN(X[[i]], ...) 47: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 48: doTryCatch(return(expr), name, parentenv, handler) 49: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 50: tryCatchList(expr, classes, parentenv, handlers) 51: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 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

mirror server hosted at Truenetwork, Russian Federation.