How to extract a subset of information from mcmc.summary()

The summary method of mcmc class prints a summary table displaying diagnostics of samples obtained from posterior. This table includes all the key items in the MCMC simulation. If I only want to get the summary statistics for certain keys. How to achieve that.

Hi @huaiyanggongzi,
I believe you can directly use the helper function pyro.infer.mcmc.util.print_summary() with a selected set of keys:

from pyro.infer.mcmc.util import print_summary
desired_keys = {"x", "y"}  # for example
desired_samples = {
    k: v for k, v in mcmc._samples.items() if k in desired_keys
}
print_summary(desired_samples)