code: def get_summary_table(
      posterior,
      sites,
      player_names,
      transforms={},
      diagnostics=False,
      group_by_chain=False,
  ):
      """
      Return summarized statistics for each of the ``sites`` in the
      traces corresponding to the approximate posterior.
      """
      site_stats = {}
  
      for site_name in sites:
          marginal_site = posterior[site_name].cpu()
  
          if site_name in transforms:
              marginal_site = transforms[site_name](marginal_site)
  
          site_summary = summary(
              {site_name: marginal_site},
              prob=0.5,
              group_by_chain=group_by_chain,
          )[site_name]
          if site_summary["mean"].shape:
              site_df = pd.DataFrame(site_summary, index=player_names)
          else:
              site_summary = {
                  k: float(v) for k, v in site_summary.items()
              }
              site_df = pd.DataFrame(site_summary, index=[0])
          if not diagnostics:
              site_df = site_df.drop(["n_eff", "r_hat"], axis=1)
          site_stats[site_name] = site_df.astype(float).round(2)
  
      return site_stats
  
file_path: pyro/examples/baseball.py
imports: import argparse
  import logging
  import math
  import pandas
  import torch
  import pyro
  from pyro.distributions import Beta, Binomial, HalfCauchy, Normal, Pareto, Uniform
  from pyro.distributions.util import scalar_like
  from pyro.infer import MCMC, NUTS, Predictive
  from pyro.infer.mcmc.util import initialize_model, summary
  from pyro.util import ignore_experimental_warning
label_desc: Use image node_id 5 for calling a global function with example usage: get_summary_table(posterior, sites, player_names, transforms, diagnostics, group_by_chain) and returns: site_stats