class_docstr: Hidden Markov Model with Gaussian mixture emissions.
  
  Attributes
  ----------
  monitor_ : ConvergenceMonitor
      Monitor object used to check the convergence of EM.
  
  startprob_ : array, shape (n_components, )
      Initial state occupation distribution.
  
  transmat_ : array, shape (n_components, n_components)
      Matrix of transition probabilities between states.
  
  weights_ : array, shape (n_components, n_mix)
      Mixture weights for each state.
  
  means_ : array, shape (n_components, n_mix, n_features)
      Mean parameters for each mixture component in each state.
  
  covars_ : array
      Covariance parameters for each mixture components in each state.
  
      The shape depends on :attr:`covariance_type`:
  
      * (n_components, n_mix)                          if "spherical",
      * (n_components, n_mix, n_features)              if "diag",
      * (n_components, n_mix, n_features, n_features)  if "full"
      * (n_components, n_features, n_features)         if "tied".
class_docstr_tok: ["Hidden","Markov","Model","with","Gaussian","mixture","emissions",".","Attributes","--","--","--","--","--","monitor_",":","ConvergenceMonitor","Monitor","object","used","to","check","the","convergence","of","EM",".","startprob_",":","array",",","shape","(","n_components",",",")","Initial","state","occupation","distribution",".","transmat_",":","array",",","shape","(","n_components",",","n_components",")","Matrix","of","transition","probabilities","between","states",".","weights_",":","array",",","shape","(","n_components",",","n_mix",")","Mixture","weights","for","each","state",".","means_",":","array",",","shape","(","n_components",",","n_mix",",","n_features",")","Mean","parameters","for","each","mixture","component","in","each","state",".","covars_",":","array","Covariance","parameters","for","each","mixture","components","in","each","state",".","The","shape","depends","on",":","attr",":","`","covariance_type","`",":","*","(","n_components",",","n_mix",")","if","``","spherical","''",",","*","(","n_components",",","n_mix",",","n_features",")","if","``","diag","''",",","*","(","n_components",",","n_mix",",","n_features",",","n_features",")","if","``","full","''","*","(","n_components",",","n_features",",","n_features",")","if","``","tied","''","."]
code: def _check(self):
      super()._check()
      if not hasattr(self, "n_features"):
          self.n_features = self.means_.shape[2]
      nc = self.n_components
      nf = self.n_features
      nm = self.n_mix
  
      self._init_covar_priors()
      self._fix_priors_shape()
  
      # Checking covariance type
      if self.covariance_type not in COVARIANCE_TYPES:
          raise ValueError(
              f"covariance_type must be one of {COVARIANCE_TYPES}"
          )
  
      self.weights_ = np.array(self.weights_)
      # Checking mixture weights' shape
      if self.weights_.shape != (nc, nm):
          raise ValueError(
              f"weights_ must have shape (n_components, n_mix), "
              f"actual shape: {self.weights_.shape}"
          )
  
      # Checking mixture weights' mathematical correctness
      self._check_sum_1("weights_")
  
      # Checking means' shape
      self.means_ = np.array(self.means_)
      if self.means_.shape != (nc, nm, nf):
          raise ValueError(
              f"means_ must have shape (n_components, n_mix, n_features), "
              f"actual shape: {self.means_.shape}"
          )
  
      # Checking covariances' shape
      self.covars_ = np.array(self.covars_)
      covars_shape = self.covars_.shape
      needed_shapes = {
          "spherical": (nc, nm),
          "tied": (nc, nf, nf),
          "diag": (nc, nm, nf),
          "full": (nc, nm, nf, nf),
      }
      needed_shape = needed_shapes[self.covariance_type]
      if covars_shape != needed_shape:
          raise ValueError(
              f"{self.covariance_type!r} mixture covars must have shape "
              f"{needed_shape}, actual shape: {covars_shape}"
          )
  
      # Checking covariances' mathematical correctness
      if (
          self.covariance_type == "spherical"
          or self.covariance_type == "diag"
      ):
          if np.any(self.covars_ < 0):
              raise ValueError(
                  f"{self.covariance_type!r} mixture covars "
                  f"must be non-negative"
              )
          if np.any(self.covars_ == 0):
              _log.warning("Degenerate mixture covariance")
      elif self.covariance_type == "tied":
          for i, covar in enumerate(self.covars_):
              if not np.allclose(covar, covar.T):
                  raise ValueError(
                      f"Covariance of state #{i} is not symmetric"
                  )
              min_eigvalsh = linalg.eigvalsh(covar).min()
              if min_eigvalsh < 0:
                  raise ValueError(
                      f"Covariance of state #{i} is not positive definite"
                  )
              if min_eigvalsh == 0:
                  _log.warning(
                      "Covariance of state #%d has a null "
                      "eigenvalue.",
                      i,
                  )
      elif self.covariance_type == "full":
          for i, mix_covars in enumerate(self.covars_):
              for j, covar in enumerate(mix_covars):
                  if not np.allclose(covar, covar.T):
                      raise ValueError(
                          f"Covariance of state #{i}, mixture #{j} is not "
                          f"symmetric"
                      )
                  min_eigvalsh = linalg.eigvalsh(covar).min()
                  if min_eigvalsh < 0:
                      raise ValueError(
                          f"Covariance of state #{i}, mixture #{j} is not "
                          f"positive definite"
                      )
                  if min_eigvalsh == 0:
                      _log.warning(
                          "Covariance of state #%d, mixture #%d "
                          "has a null eigenvalue.",
                          i,
                          j,
                      )
  
imports: import logging
  import numpy
  from scipy import linalg
  from sklearn import cluster
  from sklearn.utils import check_random_state
  from .None import _emissions, _utils
  from .base import BaseHMM
  from .utils import fill_covars, normalize
label_desc: Use image node_id 5 for calling the GMMHMM obj's underlying member method code with example usage: obj._check() without return types