MFGaussian¶
- class viabel.MFGaussian(dim, seed=1)[source]¶
A mean-field Gaussian approximation family.
- Attributes:
dim
Dimension of the space the distribution is defined on
supports_entropy
Whether the approximation family supports closed-form entropy computation.
supports_kl
Whether the approximation family supports closed-form KL divergence computation.
var_param_dim
Dimension of the variational parameter
Methods
entropy
(var_param)Compute entropy of variational distribution.
A variational parameter to use for initialization.
kl
(var_param0, var_param1)Compute the Kullback-Leibler (KL) divergence.
log_density
(var_param, x)The log density of the variational distribution.
mean_and_cov
(var_param)The mean and covariance of the variational distribution.
pth_moment
(var_param, p)The absolute pth moment of the variational distribution.
sample
(var_param, n_samples[, seed])Generate samples from the variational distribution
Whether analytically computing the pth moment is supported
- __init__(dim, seed=1)[source]¶
Create mean field Gaussian approximation family.
- Parameters:
- dimint
dimension of the underlying parameter space
- init_param()[source]¶
A variational parameter to use for initialization.
- Returns:
- var_paramnumpy.ndarray, shape (var_param_dim,)
- log_density(var_param, x)[source]¶
The log density of the variational distribution.
- Parameters:
- var_paramnumpy.ndarray, shape (var_param_dim,)
The variational parameter.
- xnumpy.ndarray, shape (dim,)
Value at which to evaluate the density.
- mean_and_cov(var_param)[source]¶
The mean and covariance of the variational distribution.
- Parameters:
- var_paramnumpy.ndarray, shape (var_param_dim,)
The variational parameter.