Using autosave

This commit is contained in:
Louis 2026-01-27 09:54:29 +01:00
parent d46e7e8913
commit 049e09bb26

View file

@ -32,18 +32,19 @@ switch(mode,
adj = per_taxa_networks[[2]], # Account for the root adj = per_taxa_networks[[2]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", plotting = "",
autosave = here(tmp_folder, "r2_seq.Rds"),
ncores = 1L ncores = 1L
) )
r2_model_seq$estimate() r2_model_seq$estimate()
}, times = 3L) }, times = 3L)
r3_mbm_seq <- microbenchmark("Rank3seq" = { 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) }, times = 3L)
r4_mbm_seq <- microbenchmark("Rank4seq" = { 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) }, times = 3L)
r5_mbm_seq <- microbenchmark("Rank5seq" = { 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) }, times = 3L)
mbm_seq <- rbind(r2_mbm_seq, r3_mbm_seq, r4_mbm_seq, r5_mbm_seq) 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 adj = per_taxa_networks[[2]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", plotting = "",
ncores = parallelly::availableCores() ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r2_para.Rds")
) )
r2_model_para$estimate() r2_model_para$estimate()
}, times = 3L) }, times = 3L)
r3_mbm_para <- microbenchmark("Rank3para" = { 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) }, times = 3L)
r4_mbm_para <- microbenchmark("Rank4para" = { 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) }, times = 3L)
r5_mbm_para <- microbenchmark("Rank5para" = { 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) }, times = 3L)
mbm_para <- rbind(r2_mbm_para, r3_mbm_para, r4_mbm_para, r5_mbm_para) mbm_para <- rbind(r2_mbm_para, r3_mbm_para, r4_mbm_para, r5_mbm_para)
@ -101,8 +102,7 @@ switch(mode,
membership_type = "LBM", membership_type = "LBM",
adj = per_taxa_networks[[2]], # Account for the root adj = per_taxa_networks[[2]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r2_notrans.Rds")
ncores = parallelly::availableCores()
) )
r2_model_notrans$estimate() r2_model_notrans$estimate()
}, times = 3L) }, times = 3L)
@ -112,7 +112,7 @@ switch(mode,
adj = per_taxa_networks[[3]], # Account for the root adj = per_taxa_networks[[3]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", plotting = "",
ncores = parallelly::availableCores() ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r3_notrans.Rds")
) )
r3_model_notrans$estimate() r3_model_notrans$estimate()
}, times = 3L) }, times = 3L)
@ -122,7 +122,7 @@ switch(mode,
adj = per_taxa_networks[[4]], # Account for the root adj = per_taxa_networks[[4]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", plotting = "",
ncores = parallelly::availableCores() ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r4_notrans.Rds")
) )
r4_model_notrans$estimate() r4_model_notrans$estimate()
}, times = 3L) }, times = 3L)
@ -132,7 +132,7 @@ switch(mode,
adj = per_taxa_networks[[5]], # Account for the root adj = per_taxa_networks[[5]], # Account for the root
verbosity = 6, verbosity = 6,
plotting = "", plotting = "",
ncores = parallelly::availableCores() ncores = parallelly::availableCores(), autosave = here(tmp_folder, "r5_notrans.Rds")
) )
r5_model_notrans$estimate() r5_model_notrans$estimate()
}, times = 3L) }, times = 3L)