From 049e09bb265fd3287904dee619406ed1b8ca2b84 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 27 Jan 2026 09:54:29 +0100 Subject: [PATCH] Using autosave --- benchmark_lbm_seq.R | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/benchmark_lbm_seq.R b/benchmark_lbm_seq.R index 40e763d..46798d2 100644 --- a/benchmark_lbm_seq.R +++ b/benchmark_lbm_seq.R @@ -32,18 +32,19 @@ switch(mode, adj = per_taxa_networks[[2]], # Account for the root verbosity = 6, plotting = "", + autosave = here(tmp_folder, "r2_seq.Rds"), ncores = 1L ) r2_model_seq$estimate() }, times = 3L) r3_mbm_seq <- microbenchmark("Rank3seq" = { - r3_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 2, target_rank_id = 3, per_taxa_networks = per_taxa_networks, first_model = r2_model_seq, ncores = 1) + r3_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 2, target_rank_id = 3, per_taxa_networks = per_taxa_networks, first_model = r2_model_seq, ncores = 1, autosave = here(tmp_folder, "r3_seq.Rds")) }, times = 3L) r4_mbm_seq <- microbenchmark("Rank4seq" = { - r4_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 3, per_taxa_networks = per_taxa_networks, first_model = r3_model_seq, ncores = 1) + r4_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 3, per_taxa_networks = per_taxa_networks, first_model = r3_model_seq, ncores = 1, autosave = here(tmp_folder, "r4_seq.Rds")) }, times = 3L) r5_mbm_seq <- microbenchmark("Rank5seq" = { - r5_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 4, per_taxa_networks = per_taxa_networks, first_model = r4_model_seq, ncores = 1) + r5_model_seq <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 4, per_taxa_networks = per_taxa_networks, first_model = r4_model_seq, ncores = 1, autosave = here(tmp_folder, "r5_seq.Rds")) }, times = 3L) mbm_seq <- rbind(r2_mbm_seq, r3_mbm_seq, r4_mbm_seq, r5_mbm_seq) @@ -68,18 +69,18 @@ switch(mode, adj = per_taxa_networks[[2]], # Account for the root verbosity = 6, plotting = "", - ncores = parallelly::availableCores() + ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r2_para.Rds") ) r2_model_para$estimate() }, times = 3L) r3_mbm_para <- microbenchmark("Rank3para" = { - r3_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 2, target_rank_id = 3, per_taxa_networks = per_taxa_networks, first_model = r2_model_para, ncores = parallelly::availableCores()) + r3_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 2, target_rank_id = 3, per_taxa_networks = per_taxa_networks, first_model = r2_model_para, ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r3_para.Rds")) }, times = 3L) r4_mbm_para <- microbenchmark("Rank4para" = { - r4_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 3, per_taxa_networks = per_taxa_networks, first_model = r3_model_para, ncores = parallelly::availableCores()) + r4_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 3, per_taxa_networks = per_taxa_networks, first_model = r3_model_para, ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r4_para.Rds")) }, times = 3L) r5_mbm_para <- microbenchmark("Rank5para" = { - r5_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 4, per_taxa_networks = per_taxa_networks, first_model = r4_model_para, ncores = parallelly::availableCores()) + r5_model_para <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 4, per_taxa_networks = per_taxa_networks, first_model = r4_model_para, ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r5_para.Rds")) }, times = 3L) mbm_para <- rbind(r2_mbm_para, r3_mbm_para, r4_mbm_para, r5_mbm_para) @@ -101,8 +102,7 @@ switch(mode, membership_type = "LBM", adj = per_taxa_networks[[2]], # Account for the root verbosity = 6, - plotting = "", - ncores = parallelly::availableCores() + ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r2_notrans.Rds") ) r2_model_notrans$estimate() }, times = 3L) @@ -112,7 +112,7 @@ switch(mode, adj = per_taxa_networks[[3]], # Account for the root verbosity = 6, plotting = "", - ncores = parallelly::availableCores() + ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r3_notrans.Rds") ) r3_model_notrans$estimate() }, times = 3L) @@ -122,7 +122,7 @@ switch(mode, adj = per_taxa_networks[[4]], # Account for the root verbosity = 6, plotting = "", - ncores = parallelly::availableCores() + ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r4_notrans.Rds") ) r4_model_notrans$estimate() }, times = 3L) @@ -132,7 +132,7 @@ switch(mode, adj = per_taxa_networks[[5]], # Account for the root verbosity = 6, plotting = "", - ncores = parallelly::availableCores() + ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r5_notrans.Rds") ) r5_model_notrans$estimate() }, times = 3L)