View source: R/kld-analytical.R
kld_gaussian | R Documentation |
This function computes D_{KL}(p||q)
, where p\sim \mathcal{N}(\mu_1,\Sigma_1)
and q\sim \mathcal{N}(\mu_2,\Sigma_2)
.
kld_gaussian(mu1, sigma1, mu2, sigma2)
mu1 |
A numeric vector (mean of true Gaussian) |
sigma1 |
A s.p.d. matrix (Covariance matrix of true Gaussian) |
mu2 |
A numeric vector (mean of approximate Gaussian) |
sigma2 |
A s.p.d. matrix (Covariance matrix of approximate Gaussian) |
A scalar (the Kullback-Leibler divergence)
kld_gaussian(mu1 = 1, sigma1 = 1, mu2 = 1, sigma2 = 2^2)
kld_gaussian(mu1 = rep(0,2), sigma1 = diag(2),
mu2 = rep(1,2), sigma2 = matrix(c(1,0.5,0.5,1), nrow = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.