struct_learn {gmgm} | R Documentation |
Learn the structure and the parameters of a Gaussian mixture graphical model
Description
This function learns the (graphical and mixture) structure and the parameters of a Gaussian mixture graphical model. Using the local decomposability of the scoring function, this task consists in learning each local conditional model independently with the stepwise algorithm (Koller and Friedman, 2009). Note that some candidate arcs may be discarded to avoid that the global graphical structure contains cycles. To limit recourse to this action, the learning process is performed sequentially. The more arcs of a local model are likely to be part of cycles (considering the worst case where all the candidate arcs are selected), the later this local model is processed. By gradually taking into account the local structures learned over time, the number of possible cycles decreases and, with it, the number of candidate arcs to discard.
Usage
struct_learn(
gmgm,
data,
nodes = structure(gmgm)$nodes,
arcs_cand = tibble(lag = 0),
col_seq = NULL,
score = "bic",
verbose = FALSE,
...
)
Arguments
gmgm |
An initial object of class |
data |
A data frame containing the data used for learning. Its columns
must explicitly be named after the nodes of |
nodes |
A character vector containing the nodes whose local conditional
models are learned (by default all the nodes of |
arcs_cand |
A data frame containing the candidate arcs for addition or
removal (by default all possible non-temporal arcs). The column |
col_seq |
A character vector containing the column names of |
score |
A character string ( |
verbose |
A logical value indicating whether learned nodes in progress are displayed. |
... |
Additional arguments passed to function |
Value
A list with elements:
gmgm |
The final |
evol_score |
A list with elements:
|
References
Koller, D. and Friedman, N. (2009). Probabilistic Graphical Models: Principles and Techniques. The MIT Press.
See Also
param_em
, param_learn
,
struct_em
Examples
data(data_body)
gmbn_1 <- add_nodes(NULL,
c("AGE", "FAT", "GENDER", "GLYCO", "HEIGHT", "WAIST",
"WEIGHT"))
arcs_cand_1 <- data.frame(from = c("AGE", "GENDER", "HEIGHT", "WEIGHT", NA,
"AGE", "GENDER", "AGE", "FAT", "GENDER",
"HEIGHT", "WEIGHT", "AGE", "GENDER",
"HEIGHT"),
to = c("FAT", "FAT", "FAT", "FAT", "GLYCO", "HEIGHT",
"HEIGHT", "WAIST", "WAIST", "WAIST", "WAIST",
"WAIST", "WEIGHT", "WEIGHT", "WEIGHT"))
res_learn_1 <- struct_learn(gmbn_1, data_body, arcs_cand = arcs_cand_1,
verbose = TRUE, max_comp = 3)
data(data_air)
gmdbn_1 <- gmdbn(b_2 = add_nodes(NULL, c("NO2", "O3", "TEMP", "WIND")),
b_13 = add_nodes(NULL, c("NO2", "O3", "TEMP", "WIND")))
arcs_cand_2 <- data.frame(from = c("NO2", "NO2", "NO2", "O3", "TEMP", "TEMP",
"WIND", "WIND"),
to = c("NO2", "O3", "O3", "O3", NA, NA, NA, NA),
lag = c(1, 0, 1, 1, 0, 1, 0, 1))
res_learn_2 <- struct_learn(gmdbn_1, data_air, arcs_cand = arcs_cand_2,
col_seq = "DATE", verbose = TRUE, max_comp = 3)