for report : improving code
This commit is contained in:
parent
ed1fc3f19e
commit
2179f52775
2 changed files with 50 additions and 2 deletions
|
|
@ -297,7 +297,11 @@ ARI_plots <- ggplot(averaged_data) +
|
|||
aes(x = epsilon_alpha, y = ARI_mean, color = model) +
|
||||
geom_point(aes(fill = model)) +
|
||||
geom_line() +
|
||||
geom_ribbon(aes(ymin = ARI_mean - ARI_sd, ymax = ARI_mean + ARI_sd),
|
||||
geom_ribbon(
|
||||
aes(
|
||||
ymin = ARI_mean - ARI_sd,
|
||||
ymax = ARI_mean + ARI_sd, fill = model
|
||||
),
|
||||
alpha = 0.05
|
||||
) +
|
||||
scale_color_okabe_ito() +
|
||||
|
|
@ -310,7 +314,7 @@ ARI_plots <- ggplot(averaged_data) +
|
|||
fill = guide_legend(title = "Model"),
|
||||
color = guide_legend(title = "Model")
|
||||
) +
|
||||
labs(y = "", x = "$\\epsilon_{\\alpha}$", fill = model.labs) +
|
||||
labs(y = "", x = "$\\epsilon_{\\alpha}$") +
|
||||
theme_minimal() +
|
||||
theme(aspect.ratio = 1L, axis.text.x = element_text(angle = -45, vjust = .5, hjust = 0))
|
||||
|
||||
|
|
|
|||
44
code/for_report/network_clustering_analyze.R
Normal file
44
code/for_report/network_clustering_analyze.R
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
## ----libraries, echo = FALSE, include = FALSE----------------------------------------------------------------------------------------------------------------------------------------
|
||||
library("ggplot2")
|
||||
library("ggokabeito")
|
||||
library("tidyr")
|
||||
library("dplyr")
|
||||
library("stringr")
|
||||
library("knitr")
|
||||
library("kableExtra")
|
||||
library("stringr")
|
||||
library("here")
|
||||
library("tikzDevice")
|
||||
|
||||
|
||||
|
||||
## ----impoting-data, echo = FALSE----------------------------------------------------------------------------------------------------------------------------
|
||||
filenames <- list.files(
|
||||
path = here("code", "results", "simulations", "clustering", "synthetic"),
|
||||
pattern = "synthetic",
|
||||
full.names = TRUE
|
||||
)
|
||||
|
||||
filenames <- filenames[order(file.info(filenames)$ctime, decreasing = TRUE)]
|
||||
# data_list <- lapply(filenames, function(file) lapply(readRDS(file), function(model) model$list_clustering))
|
||||
df_netclust <- do.call("rbind", lapply(filenames, readRDS))
|
||||
df_netclust$model <- factor(df_netclust$model, levels = c(
|
||||
"iid", "pi",
|
||||
"rho", "pirho"
|
||||
))
|
||||
|
||||
|
||||
|
||||
## ----netclustering-ARI-boxplot, echo = FALSE----------------------------------------------------------------------------------------------------------------
|
||||
#| dpi = 300,
|
||||
#| fig.asp = 0.5,
|
||||
#| fig.cap = "\\label{}ARI of the partition obtained by clustering in function of $\\eps$"
|
||||
df_netclust %>%
|
||||
ggplot() +
|
||||
aes(x = as.factor(epsilon), y = ARI) +
|
||||
scale_color_okabe_ito() +
|
||||
scale_fill_okabe_ito() +
|
||||
xlab(TeX("$\\epsilon$")) +
|
||||
guides(fill = guide_legend(title = "Model")) +
|
||||
ylab("ARI of obtained netclustering") +
|
||||
geom_boxplot(aes(fill = model))
|
||||
Loading…
Add table
Reference in a new issue