importance_sampling_log_likelihood

tfsnippet.importance_sampling_log_likelihood(log_joint, latent_log_prob, axis, keepdims=False, name=None)

Compute \(\log p(\mathbf{x})\) by importance sampling.

\[\log p(\mathbf{x}) = \log \mathbb{E}_{q(\mathbf{z}|\mathbf{x})} \Big[\exp\big(\log p(\mathbf{x},\mathbf{z}) - \log q(\mathbf{z}|\mathbf{x})\big) \Big]\]
Parameters:
  • log_joint – Values of \(\log p(\mathbf{z},\mathbf{x})\), computed with \(\mathbf{z} \sim q(\mathbf{z}|\mathbf{x})\).
  • latent_log_prob\(q(\mathbf{z}|\mathbf{x})\).
  • axis – The sampling dimensions to be averaged out.
  • keepdims (bool) – When axis is specified, whether or not to keep the averaged dimensions? (default False)
  • name (str) – TensorFlow name scope of the graph nodes. (default “importance_sampling_log_likelihood”)
Returns:

The computed \(\log p(x)\).