
VAE evidence lower bound (Geron Ch 17, morie.fn grvae)
Source:R/geron_train_native.R
morie_geron_vae_elbo.RdELBO = E_q[log p(x|z)] - beta KL, both terms divided by the batch size; the KL is the closed form.
Examples
morie_geron_vae_elbo(x = c(1, 2, 3, 4, 5, 6, 7, 8), mu = c(1, 2, 3, 4, 5, 6, 7, 8),
logvar = c(1, 2, 3, 4, 5, 6, 7, 8), recon = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $elbo
#> [1] -2437.112
#>
#> $loss
#> [1] 2437.112
#>
#> $reconstruction_term
#> [1] 0
#>
#> $kl
#> [1] 2437.112
#>
#> $kl_per_dim
#> [1] 0.8591409 4.1945280 12.5427685 32.7990750 83.7065796
#> [6] 216.2143967 568.8165792 1517.9789935
#>
#> $beta
#> [1] 1
#>
#> $estimate
#> [1] -2437.112
#>
#> $n
#> [1] 1
#>