This commit is contained in:
Louis Lacoste 2023-07-04 16:20:07 +02:00
parent e6cd4091fc
commit a9de1e1871
20 changed files with 766 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -1,7 +1,9 @@
require("ggplot2") require("ggplot2")
require("tidyr")
require("dplyr")
filenames <- list.files( filenames <- list.files(
path = "./Rcodes/simulation/data/", path = "./Rcodes/simulation/data/",
pattern = "inference_testing_2023-05*", pattern = "inference_testing_2023-07*",
full.names = TRUE full.names = TRUE
) )
col_id_BICLS <- c(11, 16, 23, 30, 37) col_id_BICLS <- c(11, 16, 23, 30, 37)
@ -13,7 +15,164 @@ ggplot(data = result_data_frame) +
aes(x = epsilon_alpha, group = preferred_model, fill = preferred_model) + aes(x = epsilon_alpha, group = preferred_model, fill = preferred_model) +
geom_bar() geom_bar()
ggplot(data = result_data_frame) + # Build ARI row long table
aes(x = , group = preferred_model, fill = preferred_model) + ARI_long_table <- result_data_frame %>%
geom_bar() # mutate(
# iid_mean_row_ARI = iid_mean_row_ARI - sep_mean_row_ARI,
# pi_mean_row_ARI = pi_mean_row_ARI - sep_mean_row_ARI,
# rho_mean_row_ARI = rho_mean_row_ARI - sep_mean_row_ARI,
# pirho_mean_row_ARI = pirho_mean_row_ARI - sep_mean_row_ARI,
# iid_mean_col_ARI = iid_mean_col_ARI - sep_mean_col_ARI,
# pi_mean_col_ARI = pi_mean_col_ARI - sep_mean_col_ARI,
# rho_mean_col_ARI = rho_mean_col_ARI - sep_mean_col_ARI,
# pirho_mean_col_ARI = pirho_mean_col_ARI - sep_mean_col_ARI,
# ) %>%
dplyr::select(
c(
epsilon_alpha, pi1.1, pi1.2, pi1.3, pi1.4,
rho2.1, rho2.2, rho2.3, rho2.4, repetition,
# sep_mean_row_ARI,
iid_mean_row_ARI, pi_mean_row_ARI, rho_mean_row_ARI,
pirho_mean_row_ARI,
# sep_mean_col_ARI,
iid_mean_col_ARI,
pi_mean_col_ARI,
rho_mean_col_ARI,
pirho_mean_col_ARI
)
) %>%
pivot_longer(
cols = c(
# sep_mean_row_ARI,
iid_mean_row_ARI,
pi_mean_row_ARI,
rho_mean_row_ARI,
pirho_mean_row_ARI,
# sep_mean_col_ARI,
iid_mean_col_ARI,
pi_mean_col_ARI,
rho_mean_col_ARI,
pirho_mean_col_ARI
),
names_to = c("model", "axis"),
names_sep = "_mean_",
names_transform = list(model = as.factor, axis = as.factor),
values_to = "ARI"
)
summarised_ARI <- ARI_long_table %>%
group_by(
epsilon_alpha, model, axis
) %>%
summarise(mean_ARI = mean(ARI), sd_ARI = sd(ARI))
summarised_ARI %>%
filter(axis == "row_ARI") %>%
ggplot() +
aes(x = epsilon_alpha, y = mean_ARI, color = model) +
geom_ribbon(aes(x = epsilon_alpha, ymin = mean_ARI - sd_ARI, ymax = mean_ARI + sd_ARI, fill = model), alpha = 0.2) +
geom_line() +
geom_point()
summarised_ARI %>%
filter(axis == "col_ARI") %>%
ggplot() +
aes(x = epsilon_alpha, y = mean_ARI, color = model) +
geom_ribbon(aes(x = epsilon_alpha, ymin = mean_ARI - sd_ARI, ymax = mean_ARI + sd_ARI, fill = model), alpha = 0.2) +
geom_line() +
geom_point()
# Build Q long table
Q1_long_table <- result_data_frame %>%
# mutate(
# iid_mean_row_ARI = iid_mean_row_ARI - sep_mean_row_ARI,
# pi_mean_row_ARI = pi_mean_row_ARI - sep_mean_row_ARI,
# rho_mean_row_ARI = rho_mean_row_ARI - sep_mean_row_ARI,
# pirho_mean_row_ARI = pirho_mean_row_ARI - sep_mean_row_ARI,
# iid_mean_col_ARI = iid_mean_col_ARI - sep_mean_col_ARI,
# pi_mean_col_ARI = pi_mean_col_ARI - sep_mean_col_ARI,
# rho_mean_col_ARI = rho_mean_col_ARI - sep_mean_col_ARI,
# pirho_mean_col_ARI = pirho_mean_col_ARI - sep_mean_col_ARI,
# ) %>%
dplyr::select(
c(
epsilon_alpha, pi1.1, pi1.2, pi1.3, pi1.4,
rho2.1, rho2.2, rho2.3, rho2.4, repetition,
iid_Q1,
pi_Q1,
rho_Q1,
pirho_Q1
)
) %>%
pivot_longer(
cols = c(
iid_Q1,
pi_Q1,
rho_Q1,
pirho_Q1
),
names_to = c("model"),
names_transform = list(model = as.factor),
values_to = "row_blocks"
)
Q1_summarised <- Q1_long_table %>%
group_by(
epsilon_alpha, model
) %>%
summarise(mean_row_blocks = mean(row_blocks), sd_row_blocks = sd(row_blocks))
Q1_summarised %>%
ggplot() +
aes(x = epsilon_alpha, y = mean_row_blocks, color = model) +
# geom_ribbon(aes(x = epsilon_alpha, ymin = mean_row_blocks - sd_row_blocks, ymax = mean_row_blocks + sd_row_blocks, fill = model), alpha = 0.2) +
geom_hline(yintercept = 4)+
geom_line() +
geom_point()
Q2_long_table <- result_data_frame %>%
# mutate(
# iid_mean_row_ARI = iid_mean_row_ARI - sep_mean_row_ARI,
# pi_mean_row_ARI = pi_mean_row_ARI - sep_mean_row_ARI,
# rho_mean_row_ARI = rho_mean_row_ARI - sep_mean_row_ARI,
# pirho_mean_row_ARI = pirho_mean_row_ARI - sep_mean_row_ARI,
# iid_mean_col_ARI = iid_mean_col_ARI - sep_mean_col_ARI,
# pi_mean_col_ARI = pi_mean_col_ARI - sep_mean_col_ARI,
# rho_mean_col_ARI = rho_mean_col_ARI - sep_mean_col_ARI,
# pirho_mean_col_ARI = pirho_mean_col_ARI - sep_mean_col_ARI,
# ) %>%
dplyr::select(
c(
epsilon_alpha, pi1.1, pi1.2, pi1.3, pi1.4,
rho2.1, rho2.2, rho2.3, rho2.4, repetition,
iid_Q2,
pi_Q2,
rho_Q2,
pirho_Q2
)
) %>%
pivot_longer(
cols = c(
iid_Q2,
pi_Q2,
rho_Q2,
pirho_Q2
),
names_to = c("model"),
names_transform = list(model = as.factor),
values_to = "row_blocks"
)
Q2_summarised <- Q2_long_table %>%
group_by(
epsilon_alpha, model
) %>%
summarise(mean_row_blocks = mean(row_blocks), sd_row_blocks = sd(row_blocks))
Q2_summarised %>%
ggplot() +
aes(x = epsilon_alpha, y = mean_row_blocks, color = model) +
# geom_ribbon(aes(x = epsilon_alpha, ymin = mean_row_blocks - sd_row_blocks, ymax = mean_row_blocks + sd_row_blocks, fill = model), alpha = 0.2) +
geom_hline(yintercept = 4) +
geom_line() +
geom_point()

View file

@ -125,6 +125,10 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
) )
) )
# Handling a problem with sep_BiSBM$M
fitted_bisbmpop_iid$sep_BiSBM$M <- fitted_bisbmpop_iid$M
sep_BiSBM <- fitted_bisbmpop_iid$sep_BiSBM
fitted_bisbmpop_pi <- estimate_colBiSBM( fitted_bisbmpop_pi <- estimate_colBiSBM(
netlist = netlist, netlist = netlist,
colsbm_model = "pi", colsbm_model = "pi",
@ -134,7 +138,8 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
fitted_bisbmpop_rho <- estimate_colBiSBM( fitted_bisbmpop_rho <- estimate_colBiSBM(
@ -146,7 +151,8 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
fitted_bisbmpop_pirho <- estimate_colBiSBM( fitted_bisbmpop_pirho <- estimate_colBiSBM(
@ -158,11 +164,12 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
# BICLs # BICLs
sep_BICL <- sum(fitted_bisbmpop_iid$sep_BiSBM$BICL) sep_BICL <- sum(sep_BiSBM$BICL)
iid_BICL <- fitted_bisbmpop_iid$best_fit$BICL iid_BICL <- fitted_bisbmpop_iid$best_fit$BICL
pi_BICL <- fitted_bisbmpop_pi$best_fit$BICL pi_BICL <- fitted_bisbmpop_pi$best_fit$BICL
rho_BICL <- fitted_bisbmpop_rho$best_fit$BICL rho_BICL <- fitted_bisbmpop_rho$best_fit$BICL
@ -179,13 +186,13 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
# ax row1 row2 # ax row1 row2
# ay col1 col2 # ay col1 col2
rowMeans(sapply(seq.int(model$M), function(m) { rowMeans(sapply(seq.int(model$M), function(m) {
c( matrix(c(
aricode::ARI(model$Z[[m]][[1]], row_clusterings[[m]]), aricode::ARI(model$Z[[m]][[1]], row_clusterings[[m]]),
aricode::ARI(model$Z[[m]][[2]], col_clusterings[[m]]) aricode::ARI(model$Z[[m]][[2]], col_clusterings[[m]])
) ), nrow = 2, ncol = 1)
})) }))
} }
sep_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_iid$sep_BiSBM) sep_mean_ARIs <- compute_mean_ARI(sep_BiSBM)
iid_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_iid$best_fit) iid_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_iid$best_fit)
pi_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_pi$best_fit) pi_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_pi$best_fit)
rho_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_rho$best_fit) rho_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_rho$best_fit)

View file

@ -0,0 +1,184 @@
```{r libraries, echo = FALSE, include = FALSE}
require("ggplot2")
require("tidyr")
require("dplyr")
require("patchwork")
require("latex2exp")
```
```{r import-data, echo = FALSE}
filenames <- list.files(
path = "./data/",
pattern = "model_selection_check_batch_report_3_rep_*",
full.names = TRUE
)
data_list <- lapply(filenames, readRDS)
result_data_frame <- dplyr::bind_rows(data_list)
result_data_frame$preferred_model <- factor(result_data_frame$preferred_model, levels = c(
"sep","iid","pi",
"rho","pirho"
))
# Adding a column accounting for true model iid, pi, rho or pirho
# result_data_frame <- result_data_frame %>% mutate(true_model = if (all( c(epsilon_pi >0, epsilon_rho > 0) == c(TRUE, TRUE))) print("pirho") else if (all( c(epsilon_pi >0, epsilon_rho > 0) == c(TRUE, FALSE))) print("pi") else if (all( c(epsilon_pi >0, epsilon_rho > 0) == c(F, T))) print("rho") else print("iid"))
```
# Capacity to distinguish $\pi\rho\text{-}colBiSBM$ from $iid\text{-}colBiSBM$ and other variants
The idea of this model selection simulations is to assess how the model select
the correct *colBiSBM* model among the possible ones:
\textit{iid, pi, rho, pirho}. This difference being based on the row and col
block proportions.
For this task we choose the same simulation context
as \cite{chabert-liddellLearningCommonStructures2023}.
Namely $n_{1}^{m} = 90, n_{2}^{m} = 90, Q_1 = Q_2 = 3$, $\bm{\alpha}, \bm{\pi}$
and $\bm{\rho}$ are set as follows:
\begin{align*}
\bm{\alpha} =.25 + \begin{pmatrix}
3 \eps[\alpha] & 2 \eps[\alpha] & \eps[\alpha] \\
2 \eps[\alpha] & 2 \eps[\alpha] & - \eps[\alpha] \\
\eps[\alpha] & - \eps[\alpha] & \eps[\alpha]
\end{pmatrix}, & & \bm{\pi}^1 = \begin{pmatrix}
\frac{1}{3}, & \frac{1}{3}, & \frac{1}{3}
\end{pmatrix}, & & \bm{\pi}^2 = \sigma\begin{pmatrix}
\frac{1}{3} - \eps[\pi], & \frac{1}{3}, & \frac{1}{3} + \eps[\pi]
\end{pmatrix},\\
& & \bm{\rho}^1 = \begin{pmatrix}
\frac{1}{3}, & \frac{1}{3}, & \frac{1}{3}
\end{pmatrix}, & & \bm{\rho}^2 = \sigma\begin{pmatrix}
\frac{1}{3} - \eps[\rho], & \frac{1}{3}, & \frac{1}{3} + \eps[\rho]
\end{pmatrix},
\end{align*}
with $\eps[\alpha] = 0.16$, $\eps[\pi]$ and $\eps[\rho]$ taking 9 values equally
spaced in $\left[ 0, .28\right]$. We simulate 324 different collections for each
value of $\eps[\pi]$ and $\eps[\rho]$.
$\pi\rho\text{-}colBiSBM$, $\pi\text{-}colBiSBM$, $\rho\text{-}colBiSBM$,
$iid\text{-}colBiSBM$ and $sep\text{-}colBiSBM$ are put in competition and the
model with the greater BIC-L is selected as the \emph{preferred model}.
```{r compute-table, echo = FALSE, include = FALSE}
model_comparison_eps_pi_rho <- result_data_frame %>%
group_by(epsilon_pi, epsilon_rho, preferred_model) %>%
summarise(n = n()) %>%
mutate(prop_model = n / sum(n))
model_comparison_eps_pi <- result_data_frame %>%
group_by(epsilon_pi, preferred_model) %>%
summarise(n = n(), rec_Q1 = mean(iid_Q1 + pi_Q1 + rho_Q1 + pirho_Q1)/4) %>%
mutate(prop_model = n / sum(n))
model_comparison_eps_rho <- result_data_frame %>%
group_by(epsilon_rho, preferred_model) %>%
summarise(n = n(), rec_Q2 = mean(iid_Q2 + pi_Q2 + rho_Q2 + pirho_Q2)/4) %>%
mutate(prop_model = n / sum(n))
```
```{r epsilon_plot, echo = FALSE, include = FALSE}
#| fig.asp = 0.5,
#| fig.pos = "H",
#| fig.width = 7,
#| fig.height = 4,
#| dpi=300
plot_pi <- model_comparison_eps_pi %>% ggplot() +
aes(x = epsilon_pi, y = prop_model, color = preferred_model,
fill = preferred_model) +
xlab(TeX("$\\epsilon_{\\pi}$")) +
ylab("Model proportions")+
geom_col(position = "stack")
plot_rho <- model_comparison_eps_rho %>% ggplot() +
aes(x = epsilon_rho, y = prop_model, color = preferred_model,
fill = preferred_model) +
xlab(TeX("$\\epsilon_{\\rho}$")) +
ylab("")+
geom_col(position = "stack")
ggsave("./img/plot_model_function_eps.png", plot_pi + plot_rho + plot_layout(guides = "collect"))
```
When $\eps[\pi] = 0$, $\bm{\pi}^1 = \bm{\pi}^2$, $\eps[\rho] = 0$ and
$\bm{\rho}^1 = \bm{\rho}^2$, the generated collection is an
$iid\text{-}colBiSBM$. When $\eps[\pi] > 0$ or $\bm{\pi}^1 \neq \bm{\pi}^2$,
the model is a $\pi\text{-}colBiSBM$.
When $\eps[\rho] > 0$ or $\bm{\rho}^1 \neq \bm{\rho}^2$,
the model is a $\rho\text{-}colBiSBM$.
Finally, when $\eps[\pi] > 0$ or $\bm{\pi}^1 \neq \bm{\pi}^2$ and
$\eps[\rho] > 0$ or $\bm{\rho}^1 \neq \bm{\rho}^2$,
the model is a $\pi\rho\text{-}colBiSBM$.
```{r tables, echo = FALSE}
kable(
(model_comparison_eps_pi %>%
select(-one_of("n")) %>%
pivot_wider(
names_from = preferred_model,
values_from = prop_model,
values_fill = 0
) %>% group_by(epsilon_pi) %>%
summarise(rec_Q1 = mean(rec_Q1),
iid = sum(iid),
pi = sum(pi),
rho = sum(rho),
pirho = sum(pirho)))[,c(1,3:6, 2)],
digits = 2,
col.names = c(
"$\\eps[\\pi]$",
"$iid\\text{-}colBiSBM$",
"$\\pi\\text{-}colBiSBM$",
"$\\rho\\text{-}colBiSBM$",
"$\\pi\\rho\\text{-}colBiSBM$",
"Recovered $Q_1$"
), align = "lcccc",
caption = "\\label{tab:pi-model-sel}Model selection for varying $\\pi$ mixture parameters"
)
kable(
(model_comparison_eps_rho %>%
select(-one_of("n")) %>%
pivot_wider(
names_from = preferred_model,
values_from = prop_model,
values_fill = 0
) %>% group_by(epsilon_rho) %>%
summarise(rec_Q2 = mean(rec_Q2),
iid = sum(iid),
pi = sum(pi),
rho = sum(rho),
pirho = sum(pirho)))[,c(1,3:6, 2)],
digits = 2,
col.names = c(
"$\\eps[\\rho]$",
"$iid\\text{-}colBiSBM$",
"$\\pi\\text{-}colBiSBM$",
"$\\rho\\text{-}colBiSBM$",
"$\\pi\\rho\\text{-}colBiSBM$",
"Recovered $Q_2$"
), align = "lcccc",
caption = "\\label{tab:rho-model-sel}Model selection for varying $\\rho$ mixture parameters"
)
```
\begin{figure}[H]
\includegraphics{./Rcodes/simulation/img/plot_model_function_eps.png}
\caption{Plot of preferred model in function of $\eps[\pi]$ and $\eps[\rho]$}
\label{fig:pref_model_func_eps}
\end{figure}
On the figure \ref{fig:pref_model_func_eps} and tables \ref{tab:pi-model-sel}
and \ref{tab:rho-model-sel}, one can see that there is a turning
point around $\eps[\pi] = 0.2$ (resp. $\eps[\rho] = 0.2$), before which
$iid\text{-}colBiSBM$
and $\rho\text{-}colBiSBM$ (resp. $\pi\text{-}colBiSBM$) are selected most of
the times and after $0.2$ the $\pi\text{-}colBiSBM$ (resp.
$\rho\text{-}colBiSBM$) and
$\pi\rho\text{-}colBiSBM$ gets more and more selected, highlighting our
capacity to recover the simulated structure.
Please note that when "Recovered $Q_1$(or $Q_2$)" is not an integer it's because
some procedures returned a value other than 3.

View file

@ -0,0 +1,379 @@
\hypertarget{capacity-to-distinguish-pirhotext-colbisbm-from-iidtext-colbisbm-and-other-variants}{%
\section{\texorpdfstring{Capacity to distinguish
\(\pi\rho\text{-}colBiSBM\) from \(iid\text{-}colBiSBM\) and other
variants}{Capacity to distinguish \textbackslash pi\textbackslash rho\textbackslash text\{-\}colBiSBM from iid\textbackslash text\{-\}colBiSBM and other variants}}\label{capacity-to-distinguish-pirhotext-colbisbm-from-iidtext-colbisbm-and-other-variants}}
The idea of this model selection simulations is to assess how the model
select the correct \emph{colBiSBM} model among the possible ones:
\textit{iid, pi, rho, pirho}. This difference being based on the row and
col block proportions.
For this task we choose the same simulation context as
\cite{chabert-liddellLearningCommonStructures2023}.
Namely \(n_{1}^{m} = 90, n_{2}^{m} = 90, Q_1 = Q_2 = 3\),
\(\bm{\alpha}, \bm{\pi}\) and \(\bm{\rho}\) are set as follows:
\begin{align*}
\bm{\alpha} =.25 + \begin{pmatrix}
3 \eps[\alpha] & 2 \eps[\alpha] & \eps[\alpha] \\
2 \eps[\alpha] & 2 \eps[\alpha] & - \eps[\alpha] \\
\eps[\alpha] & - \eps[\alpha] & \eps[\alpha]
\end{pmatrix}, & & \bm{\pi}^1 = \begin{pmatrix}
\frac{1}{3}, & \frac{1}{3}, & \frac{1}{3}
\end{pmatrix}, & & \bm{\pi}^2 = \sigma\begin{pmatrix}
\frac{1}{3} - \eps[\pi], & \frac{1}{3}, & \frac{1}{3} + \eps[\pi]
\end{pmatrix},\\
& & \bm{\rho}^1 = \begin{pmatrix}
\frac{1}{3}, & \frac{1}{3}, & \frac{1}{3}
\end{pmatrix}, & & \bm{\rho}^2 = \sigma\begin{pmatrix}
\frac{1}{3} - \eps[\rho], & \frac{1}{3}, & \frac{1}{3} + \eps[\rho]
\end{pmatrix},
\end{align*} with \(\eps[\alpha] = 0.16\), \(\eps[\pi]\) and
\(\eps[\rho]\) taking 9 values equally spaced in
\(\left[ 0, .28\right]\). We simulate 324 different collections for each
value of \(\eps[\pi]\) and \(\eps[\rho]\).
\(\pi\rho\text{-}colBiSBM\), \(\pi\text{-}colBiSBM\),
\(\rho\text{-}colBiSBM\), \(iid\text{-}colBiSBM\) and
\(sep\text{-}colBiSBM\) are put in competition and the model with the
greater BIC-L is selected as the \emph{preferred model}.
When \(\eps[\pi] = 0\), \(\bm{\pi}^1 = \bm{\pi}^2\), \(\eps[\rho] = 0\)
and \(\bm{\rho}^1 = \bm{\rho}^2\), the generated collection is an
\(iid\text{-}colBiSBM\). When \(\eps[\pi] > 0\) or
\(\bm{\pi}^1 \neq \bm{\pi}^2\), the model is a \(\pi\text{-}colBiSBM\).
When \(\eps[\rho] > 0\) or \(\bm{\rho}^1 \neq \bm{\rho}^2\), the model
is a \(\rho\text{-}colBiSBM\). Finally, when \(\eps[\pi] > 0\) or
\(\bm{\pi}^1 \neq \bm{\pi}^2\) and \(\eps[\rho] > 0\) or
\(\bm{\rho}^1 \neq \bm{\rho}^2\), the model is a
\(\pi\rho\text{-}colBiSBM\).
\begin{longtable}[]{@{}lccccl@{}}
\caption{\label{tab:pi-model-sel}Model selection for varying \(\pi\)
mixture parameters}\tabularnewline
\toprule
\begin{minipage}[b]{0.08\columnwidth}\raggedright
\(\eps[\pi]\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(iid\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(\pi\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.16\columnwidth}\centering
\(\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.18\columnwidth}\centering
\(\pi\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.11\columnwidth}\raggedright
Recovered \(Q_1\)\strut
\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{0.08\columnwidth}\raggedright
\(\eps[\pi]\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(iid\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(\pi\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.16\columnwidth}\centering
\(\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.18\columnwidth}\centering
\(\pi\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.11\columnwidth}\raggedright
Recovered \(Q_1\)\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.65\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.35\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.04\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.66\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.34\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.07\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.64\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.34\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.11\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.63\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.03\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.31\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.03\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.14\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.55\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.12\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.28\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.05\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.18\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.39\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.26\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.21\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.13\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.21\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.23\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.42\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.13\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.23\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.25\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.10\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.56\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.05\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.29\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.02\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.08\columnwidth}\raggedright
0.28\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.65\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.33\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}
\begin{longtable}[]{@{}lccccl@{}}
\caption{\label{tab:rho-model-sel}Model selection for varying \(\rho\)
mixture parameters}\tabularnewline
\toprule
\begin{minipage}[b]{0.09\columnwidth}\raggedright
\(\eps[\rho]\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(iid\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(\pi\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.16\columnwidth}\centering
\(\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.18\columnwidth}\centering
\(\pi\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.11\columnwidth}\raggedright
Recovered \(Q_2\)\strut
\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{0.09\columnwidth}\raggedright
\(\eps[\rho]\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(iid\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.15\columnwidth}\centering
\(\pi\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.16\columnwidth}\centering
\(\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.18\columnwidth}\centering
\(\pi\rho\text{-}colBiSBM\)\strut
\end{minipage} & \begin{minipage}[b]{0.11\columnwidth}\raggedright
Recovered \(Q_2\)\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.63\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.37\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.04\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.65\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.34\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.00\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.07\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.64\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.33\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.11\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.64\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.31\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.03\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.02\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.14\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.53\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.29\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.11\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.06\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.18\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.42\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.20\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.24\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.14\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.21\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.25\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.12\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.40\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.22\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.25\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.08\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.06\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.58\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.29\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.01\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright
0.28\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.15\columnwidth}\centering
0.01\strut
\end{minipage} & \begin{minipage}[t]{0.16\columnwidth}\centering
0.65\strut
\end{minipage} & \begin{minipage}[t]{0.18\columnwidth}\centering
0.32\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright
3.00\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}
\begin{figure}[H]
\includegraphics{./Rcodes/simulation/img/plot_model_function_eps.png}
\caption{Plot of preferred model in function of $\eps[\pi]$ and $\eps[\rho]$}
\label{fig:pref_model_func_eps}
\end{figure}
On the figure \ref{fig:pref_model_func_eps} and tables
\ref{tab:pi-model-sel} and \ref{tab:rho-model-sel}, one can see that
there is a turning point around \(\eps[\pi] = 0.2\) (resp.
\(\eps[\rho] = 0.2\)), before which \(iid\text{-}colBiSBM\) and
\(\rho\text{-}colBiSBM\) (resp. \(\pi\text{-}colBiSBM\)) are selected
most of the times and after \(0.2\) the \(\pi\text{-}colBiSBM\) (resp.
\(\rho\text{-}colBiSBM\)) and \(\pi\rho\text{-}colBiSBM\) gets more and
more selected, highlighting our capacity to recover the simulated
structure.
Please note that when ``Recovered \(Q_1\)(or \(Q_2\))'' is not an
integer it's because some procedures returned a value other than 3.

View file

@ -1,7 +1,7 @@
require("bettermc") require("bettermc")
require("gtools") require("gtools")
require("tictoc") require("tictoc")
devtools::load_all("R/") require("colSBM")
# Network param # Network param
nr <- 90 nr <- 90
@ -89,14 +89,14 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
current_rho2 <- current_rho2[conditions[s, ]$rho2_order] current_rho2 <- current_rho2[conditions[s, ]$rho2_order]
netlist_generated <- list( netlist_generated <- list(
generate_bipartite_network( generate_bipartite_collection(
nr, nc, pi1, rho1, nr, nc, pi1, rho1,
alpha alpha, M = 1, return_memberships = TRUE
), )[[1]],
generate_bipartite_network( generate_bipartite_collection(
nr, nc, current_pi2, current_rho2, nr, nc, current_pi2, current_rho2,
alpha alpha, M = 1, return_memberships = TRUE
) )[[1]]
) )
# Extracting the incidence matrices # Extracting the incidence matrices
@ -116,6 +116,9 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
) )
) )
fitted_bisbmpop_iid$sep_BiSBM$M <- 2
sep_BiSBM <- fitted_bisbmpop_iid$sep_BiSBM
fitted_bisbmpop_pi <- estimate_colBiSBM( fitted_bisbmpop_pi <- estimate_colBiSBM(
netlist = netlist, netlist = netlist,
colsbm_model = "pi", colsbm_model = "pi",
@ -125,7 +128,8 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
fitted_bisbmpop_rho <- estimate_colBiSBM( fitted_bisbmpop_rho <- estimate_colBiSBM(
@ -137,7 +141,8 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
fitted_bisbmpop_pirho <- estimate_colBiSBM( fitted_bisbmpop_pirho <- estimate_colBiSBM(
@ -149,7 +154,8 @@ results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
verbosity = 0, verbosity = 0,
plot_details = 0, plot_details = 0,
nb_cores = parallel::detectCores() - 1 nb_cores = parallel::detectCores() - 1
) ),
sep_BiSBM = sep_BiSBM
) )
# BICLs # BICLs

View file

@ -3,7 +3,7 @@ require("knitr")
create_latex <- function(f) { create_latex <- function(f) {
knitr::knit(f, "/tmp/tmp-outputfile.md") knitr::knit(f, "/tmp/tmp-outputfile.md")
newname <- paste0(tools::file_path_sans_ext(f), ".tex") newname <- paste0(tools::file_path_sans_ext(f), ".tex")
mess <- paste("pandoc -f markdown -t latex -p -o", shQuote(newname), "/tmp/tmp-outputfile.md") mess <- paste("pandoc --extract-media=./img -f markdown -t latex -p -o", shQuote(newname), "/tmp/tmp-outputfile.md")
system(mess) system(mess)
} }
args <- commandArgs(trailingOnly = TRUE) args <- commandArgs(trailingOnly = TRUE)

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
figure/epsilon_plot-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -54,6 +54,12 @@ chercheurs et des maîtres de conférences, a été pour moi très enrichissant.
stage s'inscrit dans la construction de mon parcours professionnel en validant stage s'inscrit dans la construction de mon parcours professionnel en validant
le désir que je présentais de faire de la recherche. le désir que je présentais de faire de la recherche.
Par ailleurs, divers projets entrepris au sein du laboratoire ont permis de
nouer des relations amicales en dehors des heures de travail. Par exemple, le
projet de construction d'une borne d'arcade pour le laboratoire, impulsé par
Julien Chiquet, a été une expérience extrêmement agréable et captivante à
laquelle prendre part.
J'ai particulièrement apprécié la disponibilité de toutes les personnes de J'ai particulièrement apprécié la disponibilité de toutes les personnes de
l'unité qui n'ont jamais hésité à se rendre disponible pour répondre à mes l'unité qui n'ont jamais hésité à se rendre disponible pour répondre à mes
questions. questions.

Binary file not shown.

View file

@ -20,6 +20,7 @@
\usepackage{longtable} \usepackage{longtable}
\usepackage{rotating} % For allowing to rotate figures \usepackage{rotating} % For allowing to rotate figures
\usepackage{svg} % To allow svg inclusions \usepackage{svg} % To allow svg inclusions
\usepackage{float} % To allow Pandoc to control figure placement
%% Bibliography %% Bibliography
\usepackage[style=apa,citestyle=authoryear-comp]{biblatex} \usepackage[style=apa,citestyle=authoryear-comp]{biblatex}
@ -64,6 +65,7 @@
% Nouvelles commandes % Nouvelles commandes
\newcommand{\Tau}{\mathcal{T}} \newcommand{\Tau}{\mathcal{T}}
\newcommand{\eps}[1][]{\ensuremath{\epsilon_{#1}}}
% titre et auteur % titre et auteur
\title{Rapport de stage dans l'UMR MIA Paris-Saclay} \title{Rapport de stage dans l'UMR MIA Paris-Saclay}
@ -1058,6 +1060,7 @@ We illustrate our capacity to perform a partition of a collection for all
colBiSBM models in \ref{sec:network-clustering-of-simulated-networks}. colBiSBM models in \ref{sec:network-clustering-of-simulated-networks}.
\chapter{Simulation studies}\label{chap:simulation-studies} \chapter{Simulation studies}\label{chap:simulation-studies}
\include{Rcodes/simulation/model_selection_analyze}
\section{Network clustering of simulated networks}\label{sec:network-clustering-of-simulated-networks} \section{Network clustering of simulated networks}\label{sec:network-clustering-of-simulated-networks}
\chapter{Applications} \chapter{Applications}