Adding autosave capabilities
This commit is contained in:
parent
e236b687ca
commit
d46e7e8913
1 changed files with 7 additions and 4 deletions
|
|
@ -63,9 +63,11 @@ bm_estimate_with_inits <- function(bm_model, reinitialization_effort = 1) {
|
|||
|
||||
cat("With ascending number of groups\n")
|
||||
ra <- bm_model$estim_ascend(reinitialization_effort, changing_effort)
|
||||
bm_model$save_now() # Using blockmodels save capabilities
|
||||
|
||||
cat("With descending number of groups\n")
|
||||
rb <- bm_model$estim_descend(reinitialization_effort)
|
||||
bm_model$save_now()
|
||||
|
||||
l <- ra || rb
|
||||
n <- n + 1
|
||||
|
|
@ -73,7 +75,7 @@ bm_estimate_with_inits <- function(bm_model, reinitialization_effort = 1) {
|
|||
}
|
||||
}
|
||||
|
||||
bm_propagate_taus_all_models <- function(phyloseq_data, rank_id_start = 2, target_rank_id = rank_id_start + 1, first_model = NULL, per_taxa_networks = collapse_otu_at_taxo(phyloseq_data), sd_noise = 0.001, ncores = parallelly::availableCores(), verbosity = 2L) {
|
||||
bm_propagate_taus_all_models <- function(phyloseq_data, rank_id_start = 2, target_rank_id = rank_id_start + 1, first_model = NULL, per_taxa_networks = collapse_otu_at_taxo(phyloseq_data), sd_noise = 0.001, ncores = parallelly::availableCores(), verbosity = 2L, autosave = character(0)) {
|
||||
removed_root <- FALSE
|
||||
# Detect if first rank (higher) is fully collapsed
|
||||
if (nrow(per_taxa_networks[[1]]) <= 1L) {
|
||||
|
|
@ -81,7 +83,6 @@ bm_propagate_taus_all_models <- function(phyloseq_data, rank_id_start = 2, targe
|
|||
removed_root <- TRUE
|
||||
per_taxa_networks <- per_taxa_networks[-1]
|
||||
}
|
||||
result_list <- list()
|
||||
# Init
|
||||
net_id_start <- ifelse(removed_root, rank_id_start - 1, rank_id_start)
|
||||
if (missing(first_model)) {
|
||||
|
|
@ -90,7 +91,8 @@ bm_propagate_taus_all_models <- function(phyloseq_data, rank_id_start = 2, targe
|
|||
adj = per_taxa_networks[[net_id_start]], # Account for the root
|
||||
verbosity = verbosity,
|
||||
plotting = "",
|
||||
ncores = ncores
|
||||
ncores = ncores,
|
||||
autosave = autosave
|
||||
)
|
||||
first_model$estimate()
|
||||
}
|
||||
|
|
@ -110,7 +112,8 @@ bm_propagate_taus_all_models <- function(phyloseq_data, rank_id_start = 2, targe
|
|||
adj = per_taxa_networks[[target_net_id]], # Account for the root
|
||||
verbosity = verbosity,
|
||||
plotting = "",
|
||||
ncores = ncores
|
||||
ncores = ncores,
|
||||
autosave = autosave
|
||||
)
|
||||
|
||||
lapply(seq_along(propagated_models), function(current_q) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue