hyperposterior {MagmaClustR} | R Documentation |
Compute the hyper-posterior distribution in Magma
Description
Compute the parameters of the hyper-posterior Gaussian distribution of the
mean process in Magma (similarly to the expectation step of the EM
algorithm used for learning). This hyper-posterior distribution, evaluated
on a grid of inputs provided through the grid_inputs
argument, is a
key component for making prediction in Magma, and is required in the function
pred_magma
.
Usage
hyperposterior(
trained_model = NULL,
data = NULL,
hp_0 = NULL,
hp_i = NULL,
kern_0 = NULL,
kern_i = NULL,
prior_mean = NULL,
grid_inputs = NULL,
pen_diag = 1e-10
)
Arguments
trained_model |
A list, containing the information coming from a
Magma model, previously trained using the |
data |
A tibble or data frame. Required columns: 'Input',
'Output'. Additional columns for covariates can be specified.
The 'Input' column should define the variable that is used as
reference for the observations (e.g. time for longitudinal data). The
'Output' column specifies the observed values (the response
variable). The data frame can also provide as many covariates as desired,
with no constraints on the column names. These covariates are additional
inputs (explanatory variables) of the models that are also observed at
each reference 'Input'. Recovered from |
hp_0 |
A named vector, tibble or data frame of hyper-parameters
associated with |
hp_i |
A tibble or data frame of hyper-parameters
associated with |
kern_0 |
A kernel function, associated with the mean GP. Several popular kernels (see The Kernel Cookbook) are already implemented and can be selected within the following list:
|
kern_i |
A kernel function, associated with the individual GPs. ("SE",
"PERIO" and "RQ" are aso available here). Recovered from
|
prior_mean |
Hyper-prior mean parameter of the mean GP. This argument, can be specified under various formats, such as:
|
grid_inputs |
A vector or a data frame, indicating the grid of additional reference inputs on which the mean process' hyper-posterior should be evaluated. |
pen_diag |
A number. A jitter term, added on the diagonal to prevent numerical issues when inverting nearly singular matrices. |
Value
A list gathering the parameters of the mean processes' hyper-posterior distributions, namely:
mean: A tibble, the hyper-posterior mean parameter evaluated at each training
Input
.cov: A matrix, the covariance parameter for the hyper-posterior distribution of the mean process.
pred: A tibble, the predicted mean and variance at
Input
for the mean process' hyper-posterior distribution under a format that allows the direct visualisation as a GP prediction.
Examples
TRUE