treeflow.vi.marginal_likelihood module
- treeflow.vi.marginal_likelihood.estimate_log_ml_importance_sampling(model: Distribution, approx: Distribution, n_samples=100, approx_samples=None, return_std=False, vectorize_log_prob=True, seed=None) Tensor | Tuple[Tensor, Tensor]
Estimate the log marginal likelihood using importance sampling This estimate can have high variance if the fit of the approximation is poor. :param model: The (pinned) distribution representing the prior and likelihood :param approx: A fitted variational approximation :param n_samples: (Optional) The number of samples to use in the estimate (default 100) :param return_std: (Optional) Whether to also return the estimated standard