Extract latent and observed variable names from pyro.MCMC.

    Parameters
    ----------
    posterior : pyro.MCMC
        Fitted MCMC object from Pyro

    Returns
    -------
    list[str], list[str]
    observed and latent variable names from the MCMC trace.

def _get_var_names(posterior):
    """Extract latent and observed variable names from pyro.MCMC.

    Parameters
    ----------
    posterior : pyro.MCMC
        Fitted MCMC object from Pyro

    Returns
    -------
    list[str], list[str]
    observed and latent variable names from the MCMC trace.
    """
    sample_point = posterior.exec_traces[0]
    nodes = [node for node in sample_point.nodes.values() if node["type"] == "sample"]
    observed = [node["name"] for node in nodes if node["is_observed"]]
    latent = [node["name"] for node in nodes if not node["is_observed"]]
    return observed, latent