EM_algorithm.RdComputes responsibilities \(\gamma_{ik}\) given current parameters.
Expects params$invSigma and params$logdet to be precomputed
(see init_cov_cache_fast()).
Updates mixture parameters given responsibilities, optionally with a quadratic
prior penalty on stacked means via Q_prior. Supports covariance models:
"VVV", "VII", "EII", "EEI".
Fits a Gaussian mixture model with optional quadratic prior penalty on the stacked
mean vector mu. The algorithm alternates E-steps and penalized M-steps and
records both a penalized observed-data objective and a penalized ELBO trace.
compute_log_joint_observed(
X,
params,
Q_prior = NULL,
eigen_tol = NULL,
rank_deficiency = 0,
Q_base = NULL,
lambda = NULL
)
compute_penalized_ELBO(
X,
Gamma,
params,
Q_prior = NULL,
eigen_tol = NULL,
rank_deficiency = 0,
Q_base = NULL,
lambda = NULL
)
ESTEP(data, params)
MSTEP(
data,
gamma,
params,
Q_prior = NULL,
relative_lambda = FALSE,
modelName = "VVV",
iterate_once = TRUE,
nugget = 0,
rank_deficiency = 0,
tol_inner = 1e-06,
max_inner = 20,
verbose = FALSE
)
EM_algorithm(
data,
init_params,
Q_prior = NULL,
iterate_once = TRUE,
max_inner = 10,
modelName = "VVV",
max_iter = 100,
tol = 1e-04,
inner_tol = 1e-06,
eigen_tol = NULL,
rank_deficiency = 0,
nugget = 0,
relative_lambda = FALSE,
verbose = TRUE,
include.data = TRUE
)Current parameter list (used mainly for starting sigma).
Optional precision matrix on stacked means (d*K x d*K).
Optional tolerance passed to generalized_logdet().
Rank deficiency for pseudo-determinant correction (commonly q*d).
Numeric matrix (n x d) of observations.
Numeric matrix (n x K) responsibilities.
Logical; if TRUE, rescales Q_prior by current marginal variances.
Covariance model: one of "VVV", "VII", "EII", "EEI".
Logical; if TRUE, stop after one EM iteration (often used inside wrappers).
Nonnegative diagonal jitter added to covariance estimates.
Inner-loop controls when iterating mu <-> sigma.
Maximum number of inner iterations inside the M-step.
Logical; print progress.
Initial parameters as a list with pi, mu, sigma.
Maximum number of EM iterations.
Convergence tolerance on ELBO changes.
Tolerance for inner iterations inside the M-step.
Logical; if TRUE, include data in the returned list.
Numeric matrix (n x K) of responsibilities.
List with updated pi, mu, sigma.
A list with:
params: final parameters (including cached invSigma and logdet).
gamma: responsibility matrix (n x K).
elbo_trace: numeric vector.
loglik_trace: numeric vector.