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 _init(self, X, lengths=None):
      super()._init(X, lengths=None)
      nc = self.n_components
      nf = self.n_features
      nm = self.n_mix
  
      def compute_cv():
          return np.cov(X.T) + self.min_covar * np.eye(nf)
  
      # Default values for covariance prior parameters
      self._init_covar_priors()
      self._fix_priors_shape()
  
      main_kmeans = cluster.KMeans(
          n_clusters=nc, random_state=self.random_state, n_init=10
      )  # sklearn >=1.2 compat.
      cv = None  # covariance matrix
      labels = main_kmeans.fit_predict(X)
      main_centroid = np.mean(main_kmeans.cluster_centers_, axis=0)
      means = []
      for label in range(nc):
          kmeans = cluster.KMeans(
              n_clusters=nm, random_state=self.random_state, n_init=10
          )  # sklearn >=1.2 compat.
          X_cluster = X[np.where(labels == label)]
          if X_cluster.shape[0] >= nm:
              kmeans.fit(X_cluster)
              means.append(kmeans.cluster_centers_)
          else:
              if cv is None:
                  cv = compute_cv()
              m_cluster = np.random.multivariate_normal(
                  main_centroid, cov=cv, size=nm
              )
              means.append(m_cluster)
  
      if self._needs_init("w", "weights_"):
          self.weights_ = np.full((nc, nm), 1 / nm)
  
      if self._needs_init("m", "means_"):
          self.means_ = np.stack(means)
  
      if self._needs_init("c", "covars_"):
          if cv is None:
              cv = compute_cv()
          if not cv.shape:
              cv.shape = (1, 1)
          if self.covariance_type == "tied":
              self.covars_ = np.zeros((nc, nf, nf))
              self.covars_[:] = cv
          elif self.covariance_type == "full":
              self.covars_ = np.zeros((nc, nm, nf, nf))
              self.covars_[:] = cv
          elif self.covariance_type == "diag":
              self.covars_ = np.zeros((nc, nm, nf))
              self.covars_[:] = np.diag(cv)
          elif self.covariance_type == "spherical":
              self.covars_ = np.zeros((nc, nm))
              self.covars_[:] = cv.mean()
  
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 2 for calling the GMMHMM obj's underlying member method code with example usage: obj._init(X, lengths) and returns: unknown