powered by
Computes the ELBO:
ELBOflow(flow, Qobs, pxgivenz, nmc = 256)
A numeric ELBO value.
A flow model created by makeflow().
makeflow()
Observed empirical distribution (probability vector).
A function mapping a latent vector z to a categorical pmf.
Number of Monte Carlo samples.
\(\log p(x \| z) + \log p(z) - \log q(z)\)
where:
q(z) is the flow-based variational posterior
p(z) is a standard Gaussian prior
p(x | z) is provided by the user as pxgivenz
pxgivenz
The expectation is approximated via Monte Carlo sampling.
f <- makeflow("planar", list(u = 0.1, w = 0.2, b = 0)) px <- function(z) c(0.3, 0.4, 0.3) ELBOflow(f, Qobs = c(0.2, 0.5, 0.3), pxgivenz = px, nmc = 100)
Run the code above in your browser using DataLab