zhusuan.evaluation

is_loglikelihood(meta_bn, observed, latent=None, axis=None, proposal=None)

Marginal log likelihood (\(\log p(x)\)) estimates using self-normalized importance sampling.

Parameters:
  • meta_bn – A MetaBayesianNet instance or a log joint probability function. For the latter, it must accepts a dictionary argument of (string, Tensor) pairs, which are mappings from all node names in the model to their observed values. The function should return a Tensor, representing the log joint likelihood of the model.
  • observed – A dictionary of (string, Tensor) pairs. Mapping from names of observed stochastic nodes to their values.
  • latent – A dictionary of (string, (Tensor, Tensor)) pairs. Mapping from names of latent stochastic nodes to their samples and log probabilities. latent and proposal are mutually exclusive.
  • axis – The sample dimension(s) to reduce when computing the outer expectation in the objective. If None, no dimension is reduced.
  • proposal – A BayesianNet instance that defines the proposal distributions of latent nodes. proposal and latent are mutually exclusive.
Returns:

A Tensor. The estimated log likelihood of observed data.