class_docstr: Mixture (same-family) distribution.
  
  The `MixtureSameFamily` distribution implements a (batch of) mixture
  distribution where all components are from different parameterizations of the
  same distribution type. It is parameterized by a `Categorical` 'selecting
  distribution' (over `k` components) and a components distribution, i.e., a
  `Distribution` with a rightmost batch shape (equal to `[k]`) which indexes
  each (batch of) component.
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  
  ### Create a mixture of two scalar Gaussians:
  
  gm = tfd.MixtureSameFamily(
      mixture_distribution=tfd.Categorical(
          probs=[0.3, 0.7]),
      components_distribution=tfd.Normal(
        loc=[-1., 1],       # One for each component.
        scale=[0.1, 0.5]))  # And same here.
  
  gm.mean()
  # ==> 0.4
  
  gm.variance()
  # ==> 1.018
  
  # Plot PDF.
  x = np.linspace(-2., 3., int(1e4), dtype=np.float32)
  import matplotlib.pyplot as plt
  plt.plot(x, gm.prob(x));
  
  ### Create a mixture of three Bivariate Gaussians:
  
  gm = tfd.MixtureSameFamily(
      mixture_distribution=tfd.Categorical(
          probs=[0.2, 0.4, 0.4]),
      components_distribution=tfd.MultivariateNormalDiag(
          loc=[[-1., 1],  # component 1
               [1, -1],  # component 2
               [1, 1]],  # component 3
          scale_diag=tf.tile([[.3], [.6], [.7]], [1, 2])))
  
  gm.components_distribution.batch_shape
  # ==> (3,)
  
  gm.components_distribution.event_shape
  # ==> (2,)
  
  gm.mean()
  # ==> array([ 0.6, 0.2], dtype=float32)
  
  gm.covariance()
  # ==> array([[ 0.998    , -0.32     ],
  #            [-0.32     ,  1.3180001]], dtype=float32)
  
  # Plot PDF contours.
  def meshgrid(x):
    y = x
    [gx, gy] = np.meshgrid(x, y, indexing='ij')
    gx, gy = np.float32(gx), np.float32(gy)
    grid = np.concatenate([gx.ravel()[None, :], gy.ravel()[None, :]], axis=0)
    return grid.T.reshape(x.size, y.size, 2)
  grid = meshgrid(np.linspace(-2, 2, 100, dtype=np.float32))
  plt.contour(grid[..., 0], grid[..., 1], gm.prob(grid));
  ```
  
  Note that this distribution is *not* a joint distribution over categorical
  and continuous values, but rather a mixture of continuous distributions
  proportioned by the given categorical distribution. If you want a joint
  distribution, you might write it as:
  
  ```python
  @tfd.JointDistributionCoroutineAutoBatched
  def model():
    mus = tf.constant([[-1., 1], # component 1
                       [1, -1],  # component 2
                       [1, 1]])  # component 3
    scales = tf.constant([.3, .6, .7])
    idx = yield tfd.Categorical(probs=[.2, .4, .4], name='idx')
    val = yield tfd.MultivariateNormalDiag(
        loc=mus[idx], scale_diag=tf.ones(2) * scales[idx], name='val')
  
  model.sample()
  # ==> StructTuple(
  #       idx=2,
  #       val=array([1.0582672, 1.3583777], dtype=float32)
  #     )
  ```
class_docstr_tok: ["Mixture","(","same-family",")","distribution",".","The","`","MixtureSameFamily","`","distribution","implements","a","(","batch","of",")","mixture","distribution","where","all","components","are","from","different","parameterizations","of","the","same","distribution","type",".","It","is","parameterized","by","a","`","Categorical","`","'selecting","distribution","'","(","over","`","k","`","components",")","and","a","components","distribution",",","i.e.",",","a","`","Distribution","`","with","a","rightmost","batch","shape","(","equal","to","`","[","k","]","`",")","which","indexes","each","(","batch","of",")","component",".","#","#","#","#","Examples","``","`","python","tfd","=","tfp.distributions","#","#","#","Create","a","mixture","of","two","scalar","Gaussians",":","gm","=","tfd.MixtureSameFamily","(","mixture_distribution=tfd.Categorical","(","probs=","[","0.3",",","0.7","]",")",",","components_distribution=tfd.Normal","(","loc=","[","-1.",",","1","]",",","#","One","for","each","component",".","scale=","[","0.1",",","0.5","]",")",")","#","And","same","here",".","gm.mean","(",")","#","==",">","0.4","gm.variance","(",")","#","==",">","1.018","#","Plot","PDF",".","x","=","np.linspace","(","-2.",",","3.",",","int","(","1e4",")",",","dtype=np.float32",")","import","matplotlib.pyplot","as","plt","plt.plot","(","x",",","gm.prob","(","x",")",")",";","#","#","#","Create","a","mixture","of","three","Bivariate","Gaussians",":","gm","=","tfd.MixtureSameFamily","(","mixture_distribution=tfd.Categorical","(","probs=","[","0.2",",","0.4",",","0.4","]",")",",","components_distribution=tfd.MultivariateNormalDiag","(","loc=","[","[","-1.",",","1","]",",","#","component","1","[","1",",","-1","]",",","#","component","2","[","1",",","1","]","]",",","#","component","3","scale_diag=tf.tile","(","[","[",".3","]",",","[",".6","]",",","[",".7","]","]",",","[","1",",","2","]",")",")",")","gm.components_distribution.batch_shape","#","==",">","(","3",",",")","gm.components_distribution.event_shape","#","==",">","(","2",",",")","gm.mean","(",")","#","==",">","array","(","[","0.6",",","0.2","]",",","dtype=float32",")","gm.covariance","(",")","#","==",">","array","(","[","[","0.998",",","-0.32","]",",","#","[","-0.32",",","1.3180001","]","]",",","dtype=float32",")","#","Plot","PDF","contours",".","def","meshgrid","(","x",")",":","y","=","x","[","gx",",","gy","]","=","np.meshgrid","(","x",",","y",",","indexing='ij","'",")","gx",",","gy","=","np.float32","(","gx",")",",","np.float32","(","gy",")","grid","=","np.concatenate","(","[","gx.ravel","(",")","[","None",",",":","]",",","gy.ravel","(",")","[","None",",",":","]","]",",","axis=0",")","return","grid.T.reshape","(","x.size",",","y.size",",","2",")","grid","=","meshgrid","(","np.linspace","(","-2",",","2",",","100",",","dtype=np.float32",")",")","plt.contour","(","grid","[","...",",","0","]",",","grid","[","...",",","1","]",",","gm.prob","(","grid",")",")",";","``","`","Note","that","this","distribution","is","*","not","*","a","joint","distribution","over","categorical","and","continuous","values",",","but","rather","a","mixture","of","continuous","distributions","proportioned","by","the","given","categorical","distribution",".","If","you","want","a","joint","distribution",",","you","might","write","it","as",":","``","`","python","@","tfd.JointDistributionCoroutineAutoBatched","def","model","(",")",":","mus","=","tf.constant","(","[","[","-1.",",","1","]",",","#","component","1","[","1",",","-1","]",",","#","component","2","[","1",",","1","]","]",")","#","component","3","scales","=","tf.constant","(","[",".3",",",".6",",",".7","]",")","idx","=","yield","tfd.Categorical","(","probs=","[",".2",",",".4",",",".4","]",",","name='idx","'",")","val","=","yield","tfd.MultivariateNormalDiag","(","loc=mus","[","idx","]",",","scale_diag=tf.ones","(","2",")","*","scales","[","idx","]",",","name='val","'",")","model.sample","(",")","#","==",">","StructTuple","(","#","idx=2",",","#","val=array","(","[","1.0582672",",","1.3583777","]",",","dtype=float32",")","#",")","``","`"]
code: def _default_event_space_bijector(self):
      # TODO(b/146456627): Implement `default_event_space_bijector` for mixture
      # distributions.
      return
  
imports: import warnings
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import batch_broadcast
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.gradient import value_and_batch_jacobian
label_desc: Use image node_id 22 for calling the _MixtureSameFamily obj's underlying member method code with example usage: obj._default_event_space_bijector() without return types