class_docstr: Base class for mixture models.
  
  This abstract class specifies an interface for all mixture classes and
  provides basic common methods for mixture models.
docstr: Generate random samples from the fitted Gaussian distribution.
  
  Parameters
  ----------
  n_samples : int, optional
      Number of samples to generate. Defaults to 1.
  
  Returns
  -------
  X : array, shape (n_samples, n_features)
      Randomly generated sample
  
  y : array, shape (nsamples,)
      Component labels
code: def sample(self, n_samples=1):
      """Generate random samples from the fitted Gaussian distribution.
  
      Parameters
      ----------
      n_samples : int, optional
          Number of samples to generate. Defaults to 1.
  
      Returns
      -------
      X : array, shape (n_samples, n_features)
          Randomly generated sample
  
      y : array, shape (nsamples,)
          Component labels
  
      """
      self._check_is_fitted()
  
      if n_samples < 1:
          raise ValueError(
              "Invalid value for 'n_samples': %d . The sampling requires at "
              "least one sample." % (self.n_components)
          )
  
      _, n_features = self.means_.shape
      rng = check_random_state(self.random_state)
      n_samples_comp = rng.multinomial(n_samples, self.weights_)
  
      if self.covariance_type == "full":
          X = np.vstack(
              [
                  rng.multivariate_normal(mean, covariance, int(sample))
                  for (mean, covariance, sample) in zip(
                      self.means_, self.covariances_, n_samples_comp
                  )
              ]
          )
      elif self.covariance_type == "tied":
          X = np.vstack(
              [
                  rng.multivariate_normal(
                      mean, self.covariances_, int(sample)
                  )
                  for (mean, sample) in zip(self.means_, n_samples_comp)
              ]
          )
      else:
          X = np.vstack(
              [
                  mean
                  + rng.randn(sample, n_features) * np.sqrt(covariance)
                  for (mean, covariance, sample) in zip(
                      self.means_, self.covariances_, n_samples_comp
                  )
              ]
          )
  
      y = np.concatenate(
          [
              j * np.ones(sample, dtype=int)
              for j, sample in enumerate(n_samples_comp)
          ]
      )
  
      return (X, y)
  
imports: from __future__ import print_function
  import warnings
  from abc import ABCMeta, abstractmethod
  from time import time
  import numpy
  from ..None import cluster
  from ..base import BaseEstimator
  from ..base import DensityMixin
  from ..externals import six
  from ..exceptions import ConvergenceWarning
  from ..utils import check_array, check_random_state
  from ..utils.extmath import logsumexp
label_desc: Use image node_id 16 for calling the BaseMixture obj's underlying member method code with example usage: obj.sample(n_samples) and returns: X,  y