param_learn {gmgm} | R Documentation |
Learn the parameters of a Gaussian mixture graphical model
Description
This function learns the parameters of a Gaussian mixture graphical model. Using the local decomposability of the log-likelihood, this task consists in learning each local conditional model independently with the EM algorithm (Koller and Friedman, 2009).
Usage
param_learn(
gmgm,
data,
nodes = structure(gmgm)$nodes,
col_seq = NULL,
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 |
col_seq |
A character vector containing the column names of |
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_loglik |
A list with elements:
|
References
Koller, D. and Friedman, N. (2009). Probabilistic Graphical Models: Principles and Techniques. The MIT Press.
See Also
param_em
, struct_em
,
struct_learn
Examples
data(data_body)
gmbn_1 <- gmbn(
AGE = split_comp(add_var(NULL, data_body[, "AGE"]), n_sub = 3),
FAT = split_comp(add_var(NULL,
data_body[, c("FAT", "GENDER", "HEIGHT", "WEIGHT")]),
n_sub = 2),
GENDER = split_comp(add_var(NULL, data_body[, "GENDER"]), n_sub = 2),
GLYCO = split_comp(add_var(NULL, data_body[, c("GLYCO", "AGE", "WAIST")]),
n_sub = 2),
HEIGHT = split_comp(add_var(NULL, data_body[, c("HEIGHT", "GENDER")])),
WAIST = split_comp(add_var(NULL,
data_body[, c("WAIST", "AGE", "FAT", "HEIGHT",
"WEIGHT")]),
n_sub = 3),
WEIGHT = split_comp(add_var(NULL, data_body[, c("WEIGHT", "HEIGHT")]),
n_sub = 2)
)
res_learn_1 <- param_learn(gmbn_1, data_body, verbose = TRUE)
library(dplyr)
data(data_air)
data <- data_air %>%
group_by(DATE) %>%
mutate(NO2.1 = lag(NO2), O3.1 = lag(O3), TEMP.1 = lag(TEMP),
WIND.1 = lag(WIND)) %>%
ungroup()
gmdbn_1 <- gmdbn(
b_2 = gmbn(
NO2 = split_comp(add_var(NULL, data[, c("NO2", "NO2.1", "WIND")]),
n_sub = 3),
O3 = split_comp(add_var(NULL,
data[, c("O3", "NO2", "NO2.1", "O3.1", "TEMP",
"TEMP.1")]),
n_sub = 3),
TEMP = split_comp(add_var(NULL, data[, c("TEMP", "TEMP.1")]), n_sub = 3),
WIND = split_comp(add_var(NULL, data[, c("WIND", "WIND.1")]), n_sub = 3)
),
b_13 = gmbn(
NO2 = split_comp(add_var(NULL, data[, c("NO2", "NO2.1", "WIND")]),
n_sub = 3),
O3 = split_comp(add_var(NULL,
data[, c("O3", "O3.1", "TEMP", "TEMP.1", "WIND")]),
n_sub = 3),
TEMP = split_comp(add_var(NULL, data[, c("TEMP", "TEMP.1")]), n_sub = 3),
WIND = split_comp(add_var(NULL, data[, c("WIND", "WIND.1")]), n_sub = 3)
)
)
res_learn_2 <- param_learn(gmdbn_1, data_air, col_seq = "DATE", verbose = TRUE)