code: def test_overdispersed_beta_binomial(
      probs, total_count, overdispersion
  ):
      # For high concentraion, beta_binomial_dist is close to binomial_dist.
      concentration = 100.0  # very little uncertainty
      concentration1 = concentration * probs
      concentration0 = concentration * (1 - probs)
      d1 = binomial_dist(
          total_count, probs, overdispersion=overdispersion
      )
      d2 = beta_binomial_dist(
          concentration1,
          concentration0,
          total_count,
          overdispersion=overdispersion,
      )
  
      # CRPS is equivalent to the Cramer-von Mises test.
      # https://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93von_Mises_criterion
      k = torch.arange(0.0, total_count + 1.0)
      cdf1 = d1.log_prob(k).exp().cumsum(-1)
      cdf2 = d2.log_prob(k).exp().cumsum(-1)
      crps = (cdf1 - cdf2).pow(2).mean()
      assert crps < 0.01
  
imports: import math
  import pytest
  import torch
  from torch.distributions.transforms import SigmoidTransform
  import pyro.distributions
  from pyro.contrib.epidemiology import beta_binomial_dist, binomial_dist, infection_dist
  from pyro.contrib.epidemiology.distributions import _RELAX_MIN_VARIANCE, set_relaxed_distributions
  from tests.common import assert_close
label_desc: Use image node_id 9 for calling a global function with example usage: test_overdispersed_beta_binomial(probs, total_count, overdispersion) without return types