diff --git a/code/simulations/clustering/02_synthetic_clustering_analysis.html b/code/simulations/clustering/02_synthetic_clustering_analysis.html new file mode 100644 index 0000000..587e0e7 --- /dev/null +++ b/code/simulations/clustering/02_synthetic_clustering_analysis.html @@ -0,0 +1,9447 @@ + + + + + + + + + +Clustering avec colSBM des données synthétiques + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+

Clustering avec colSBM des données synthétiques

+
+ + + +
+ + + + +
+ + + +
+ + +
+

Analyse

+
+

Analyse par modèle

+

Les clustering donne le critère suivant :

+
+
+ + + + + + + + + + + + + + +
BICL par modèle
\(BICL\)
iid-247618
+
+
+
+ +
+
+

Le clustering donne le critère suivant : \(BICL = -2.4761797\times 10^{5}\)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Réseaux membre du 1e cluster
Réseaux
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative_small
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
assortative
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Réseaux membre du 2e cluster
Réseaux
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative_small
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
disassortative
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Réseaux membre du 3e cluster
Réseaux
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery_small
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
core_periphery
+
+
+
+
+
+
+

+
+
+
+
+
+ +
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+

Structure des collections

+
+
Structure collection 1
+

+
+
+
Structure collection 2
+

+
+
+
Structure collection 3
+

+
+
+
+
+
+
+
+

Profiling

+
+
+
+ +
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/code/simulations/clustering/02_synthetic_clustering_analysis.qmd b/code/simulations/clustering/02_synthetic_clustering_analysis.qmd new file mode 100644 index 0000000..ff34cd3 --- /dev/null +++ b/code/simulations/clustering/02_synthetic_clustering_analysis.qmd @@ -0,0 +1,80 @@ +--- +format: + html: + embed-resources: true +title: Clustering avec `colSBM` des données synthétiques +execute: + echo: false + warning: false +--- + +# Analyse + +```{r} +library(colSBM) +library(here) +library(stringr) +library(tidyr) +library(dplyr) +library(aricode) +library(reshape2) + +library(ggplot2) +library(profvis) +``` + +```{r} +root_app_folder <- file.path(here(), "code", "applications") +source(file.path(root_app_folder, "utils.R")) +data_folder <- file.path(here(), "code", "results", "simulations", "clustering", "synthetic") +files_vec <- get_recent_files(data_folder, n = 16L, pattern = ".Rds") +files_vec <- identify_models(files_vec, pattern = "(iid|pirho|pi|rho)") +names(files_vec) <- names(files_vec) %>% str_replace_all(pattern = "_", "~") +list_clustering <- files_vec +# list_collection <- readRDS(file.path(data_folder, "dore_collection_iid_24-05-24_18-07-50.Rds")) +``` + +## Analyse par modèle + +Les clustering donne le critère suivant : +```{r} +vec_bicl <- sapply(list_clustering, function(clustering) { + list_collection <- readRDS(clustering) + unlisted_best_partition <- unlist( + extract_best_bipartite_partition(list_collection) + ) + BICL <- sum(sapply(unlisted_best_partition, function(col) col$BICL)) + BICL +}) + +names(vec_bicl) <- names(files_vec) +knitr::kable(vec_bicl, + caption = "BICL par modèle", col.names = "$BICL$", + row.names = TRUE +) +``` + +:::{.panel-tabset} + +```{r write_tabs} +#| warning: false +#| output: asis + +# Generate content for each model using knit_expand +for (clustering_idx in seq_len(length(list_clustering))) { + clustering <- list_clustering[clustering_idx] + model <- names(clustering) + expanded_content <- knitr::knit_expand(file = file.path(root_app_folder, "base_analysis.qmd"), clustering = clustering, model = model) + res <- knitr::knit_child(text = expanded_content, quiet = TRUE) + cat(res, sep = "\n") + cat("\n") +} +``` + +::: + +## Profiling + +```{r} +profvis(prof_input = file.path(data_folder, "profiling_17-06-24_11-59-35.out")) +``` \ No newline at end of file diff --git a/code/simulations/clustering/synthetic_clustering.R b/code/simulations/clustering/synthetic_clustering.R index 905b877..cd15baf 100644 --- a/code/simulations/clustering/synthetic_clustering.R +++ b/code/simulations/clustering/synthetic_clustering.R @@ -96,7 +96,8 @@ profvis( save_file <- file.path( save_folder, paste0( sprintf("%s_collection_", application_name), - model, "_eps_", eps, "_", start_time, "_maxsteps_500.Rds" + model, "_seed_", seed, "_eps_", + eps, "_", start_time, "_maxsteps_500.Rds" ) )