class_docstr: Hidden Markov Model with Multivariate Gaussian Emissions trained
  using Variational Inference.
  
  References:
      * https://arxiv.org/abs/1605.08618
      * https://core.ac.uk/reader/10883750
      * https://theses.gla.ac.uk/6941/7/2005McGroryPhD.pdf
  
  Attributes
  ----------
  n_features : int
      Dimensionality of the Gaussian emissions.
  
  monitor_ : ConvergenceMonitor
      Monitor object used to check the convergence of EM.
  
  startprob_prior_ : array, shape (n_components, )
      Prior for the initial state occupation distribution.
  
  startprob_posterior_ : array, shape (n_components, )
      Posterior estimate of the state occupation distribution.
  
  transmat_prior_ : array, shape (n_components, n_components)
      Prior for the matrix of transition probabilities between states.
  
  transmat_posterior_ : array, shape (n_components, n_components)
      Posterior estimate of the transition probabilities between states.
  
  means_prior_: array, shape (n_components, n_features)
      Prior estimates for the mean of each state.
  
  means_posterior_: array, shape (n_components, n_features)
      Posterior estimates for the mean of each state.
  
  beta_prior_: array, shape (n_components, )
      Prior estimate on the scale of the variance over the means.
  
  beta_posterior_: array, shape (n_components, )
      Posterior estimate of the scale of the variance over the means.
  
  covars_ : array
      Covariance parameters for each state.
  
      The shape depends on :attr:`covariance_type`:
  
      * (n_components, )                        if "spherical",
      * (n_components, n_features)              if "diag",
      * (n_components, n_features, n_features)  if "full",
      * (n_features, n_features)                if "tied".
  
  dof_prior_: int / array
      The Degrees Of Freedom prior for each state's Wishart distribution.
      The type depends on :attr:`covariance_type`:
  
      * array, shape (n_components, )  if "full",
      * int                            if "tied".
  
  dof_prior_: int / array
      The Prior on the Degrees Of Freedom
      for each state's Wishart distribution.
      The type depends on :attr:`covariance_type`:
  
      * array, shape (n_components, )  if "full",
      * int                            if "tied".
  
  dof_posterior_: int / array
      The Degrees Of Freedom for each state's Wishart distribution.
      The type depends on :attr:`covariance_type`:
  
      * array, shape (n_components, )  if "full",
      * int                            if "tied".
  
  scale_prior_ : array
      Prior for the Inverse scale parameter for each state's
      Wishart distribution. The wishart distribution is
      the conjugate prior for the covariance.
  
      The shape depends on :attr:`covariance_type`:
  
      * (n_components, )                        if "spherical",
      * (n_components, n_features)              if "diag",
      * (n_components, n_features, n_features)  if "full",
      * (n_features, n_features)                if "tied".
  
  scale_posterior_ : array
      Inverse scale parameter for each state's wishart distribution.
      The wishart distribution is the conjugate prior for the covariance.
  
      The shape depends on :attr:`covariance_type`:
  
      * (n_components, )                        if "spherical",
      * (n_components, n_features)              if "diag",
      * (n_components, n_features, n_features)  if "full",
      * (n_features, n_features)                if "tied".
  
  Examples
  --------
  >>> from hmmlearn.hmm import VariationalGaussianHMM
  >>> VariationalGaussianHMM(n_components=2)  #doctest: +ELLIPSIS
  VariationalGaussianHMM(algorithm='viterbi',...
class_docstr_tok: ["Hidden","Markov","Model","with","Multivariate","Gaussian","Emissions","trained","using","Variational","Inference",".","References",":","*","https",":","\/\/arxiv.org\/abs\/1605.08618","*","https",":","\/\/core.ac.uk\/reader\/10883750","*","https",":","\/\/theses.gla.ac.uk\/6941\/7\/2005McGroryPhD.pdf","Attributes","--","--","--","--","--","n_features",":","int","Dimensionality","of","the","Gaussian","emissions",".","monitor_",":","ConvergenceMonitor","Monitor","object","used","to","check","the","convergence","of","EM",".","startprob_prior_",":","array",",","shape","(","n_components",",",")","Prior","for","the","initial","state","occupation","distribution",".","startprob_posterior_",":","array",",","shape","(","n_components",",",")","Posterior","estimate","of","the","state","occupation","distribution",".","transmat_prior_",":","array",",","shape","(","n_components",",","n_components",")","Prior","for","the","matrix","of","transition","probabilities","between","states",".","transmat_posterior_",":","array",",","shape","(","n_components",",","n_components",")","Posterior","estimate","of","the","transition","probabilities","between","states",".","means_prior_",":","array",",","shape","(","n_components",",","n_features",")","Prior","estimates","for","the","mean","of","each","state",".","means_posterior_",":","array",",","shape","(","n_components",",","n_features",")","Posterior","estimates","for","the","mean","of","each","state",".","beta_prior_",":","array",",","shape","(","n_components",",",")","Prior","estimate","on","the","scale","of","the","variance","over","the","means",".","beta_posterior_",":","array",",","shape","(","n_components",",",")","Posterior","estimate","of","the","scale","of","the","variance","over","the","means",".","covars_",":","array","Covariance","parameters","for","each","state",".","The","shape","depends","on",":","attr",":","`","covariance_type","`",":","*","(","n_components",",",")","if","``","spherical","''",",","*","(","n_components",",","n_features",")","if","``","diag","''",",","*","(","n_components",",","n_features",",","n_features",")","if","``","full","''",",","*","(","n_features",",","n_features",")","if","``","tied","''",".","dof_prior_",":","int","\/","array","The","Degrees","Of","Freedom","prior","for","each","state","'s","Wishart","distribution",".","The","type","depends","on",":","attr",":","`","covariance_type","`",":","*","array",",","shape","(","n_components",",",")","if","``","full","''",",","*","int","if","``","tied","''",".","dof_prior_",":","int","\/","array","The","Prior","on","the","Degrees","Of","Freedom","for","each","state","'s","Wishart","distribution",".","The","type","depends","on",":","attr",":","`","covariance_type","`",":","*","array",",","shape","(","n_components",",",")","if","``","full","''",",","*","int","if","``","tied","''",".","dof_posterior_",":","int","\/","array","The","Degrees","Of","Freedom","for","each","state","'s","Wishart","distribution",".","The","type","depends","on",":","attr",":","`","covariance_type","`",":","*","array",",","shape","(","n_components",",",")","if","``","full","''",",","*","int","if","``","tied","''",".","scale_prior_",":","array","Prior","for","the","Inverse","scale","parameter","for","each","state's","Wishart","distribution",".","The","wishart","distribution","is","the","conjugate","prior","for","the","covariance",".","The","shape","depends","on",":","attr",":","`","covariance_type","`",":","*","(","n_components",",",")","if","``","spherical","''",",","*","(","n_components",",","n_features",")","if","``","diag","''",",","*","(","n_components",",","n_features",",","n_features",")","if","``","full","''",",","*","(","n_features",",","n_features",")","if","``","tied","''",".","scale_posterior_",":","array","Inverse","scale","parameter","for","each","state","'s","wishart","distribution",".","The","wishart","distribution","is","the","conjugate","prior","for","the","covariance",".","The","shape","depends","on",":","attr",":","`","covariance_type","`",":","*","(","n_components",",",")","if","``","spherical","''",",","*","(","n_components",",","n_features",")","if","``","diag","''",",","*","(","n_components",",","n_features",",","n_features",")","if","``","full","''",",","*","(","n_features",",","n_features",")","if","``","tied","''",".","Examples","--","--","--","--",">",">",">","from","hmmlearn.hmm","import","VariationalGaussianHMM",">",">",">","VariationalGaussianHMM","(","n_components=2",")","#","doctest",":","+ELLIPSIS","VariationalGaussianHMM","(","algorithm='viterbi","'",",","..."]
docstr: Initialize model parameters prior to fitting.
  
  Parameters
  ----------
  X : array-like, shape (n_samples, n_features)
      Feature matrix of individual samples.
  lengths : array-like of integers, shape (n_sequences, )
      Lengths of the individual sequences in ``X``. The sum of
      these should be ``n_samples``.
docstr_tok: ["Initialize","model","parameters","prior","to","fitting",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","(","n_samples",",","n_features",")","Feature","matrix","of","individual","samples",".","lengths",":","array-like","of","integers",",","shape","(","n_sequences",",",")","Lengths","of","the","individual","sequences","in","``","X","``",".","The","sum","of","these","should","be","``","n_samples","``","."]
code: def _init(self, X, lengths):
      """
      Initialize model parameters prior to fitting.
  
      Parameters
      ----------
      X : array-like, shape (n_samples, n_features)
          Feature matrix of individual samples.
      lengths : array-like of integers, shape (n_sequences, )
          Lengths of the individual sequences in ``X``. The sum of
          these should be ``n_samples``.
      """
      super()._init(X, lengths)
  
      X_mean = X.mean(axis=0)
      # Kmeans will be used for initializing both the means
      # and the covariances
      kmeans = cluster.KMeans(
          n_clusters=self.n_components,
          random_state=self.random_state,
          n_init=10,
      )  # sklearn >=1.2 compat.
      kmeans.fit(X)
      cluster_counts = np.bincount(kmeans.predict(X))
  
      if (
          self._needs_init("m", "means_prior_")
          or self._needs_init("m", "means_posterior_")
          or self._needs_init("m", "beta_prior_")
          or self._needs_init("m", "beta_posterior_")
      ):
          if self.means_prior is None:
              self.means_prior_ = np.full(
                  (self.n_components, self.n_features), X_mean
              )
          else:
              self.means_prior_ = self.means_prior
          # Initialize to the data means
          self.means_posterior_ = np.copy(kmeans.cluster_centers_)
  
          if self.beta_prior is None:
              self.beta_prior_ = np.zeros(self.n_components) + 1
          else:
              self.beta_prior_ = self.beta_prior
  
          # Count of items in each cluster
          self.beta_posterior_ = np.copy(cluster_counts)
  
      if (
          self._needs_init("c", "dof_prior_")
          or self._needs_init("c", "dof_posterior_")
          or self._needs_init("c", "scale_prior_")
          or self._needs_init("c", "scale_posterior_")
      ):
          if self.covariance_type in ("full", "diag", "spherical"):
              if self.dof_prior is None:
                  self.dof_prior_ = np.full(
                      (self.n_components,), self.n_features
                  )
              else:
                  self.dof_prior_ = self.dof_prior
              self.dof_posterior_ = np.copy(cluster_counts)
  
          elif self.covariance_type == "tied":
              if self.dof_prior is None:
                  self.dof_prior_ = self.n_features
              else:
                  self.dof_prior_ = self.dof_prior
              self.dof_posterior_ = cluster_counts.sum()
  
          # Covariance posterior comes from the estimate of the data
          # We store and update both W_k and scale_posterior_,
          # as they each are used in the EM-like algorithm
          cv = np.cov(X.T) + 1e-3 * np.eye(X.shape[1])
          self.covars_ = (
              _utils.distribute_covar_matrix_to_match_covariance_type(
                  cv, self.covariance_type, self.n_components
              ).copy()
          )
  
          if self.covariance_type == "full":
              if self.scale_prior is None:
                  self.scale_prior_ = np.broadcast_to(
                      np.identity(self.n_features) * 1e-3,
                      (
                          self.n_components,
                          self.n_features,
                          self.n_features,
                      ),
                  )
              else:
                  self.scale_prior_ = self.scale_prior
              self.scale_posterior_ = (
                  self._covars_
                  * np.asarray(self.dof_posterior_)[:, None, None]
              )
  
          elif self.covariance_type == "tied":
              if self.scale_prior is None:
                  self.scale_prior_ = (
                      np.identity(self.n_features) * 1e-3
                  )
              else:
                  self.scale_prior_ = self.scale_prior
              self.scale_posterior_ = (
                  self._covars_ * self.dof_posterior_
              )
  
          elif self.covariance_type == "diag":
              if self.scale_prior is None:
                  self.scale_prior_ = np.full(
                      (self.n_components, self.n_features), 1e-3
                  )
              else:
                  self.scale_prior_ = self.scale_prior
              self.scale_posterior_ = np.einsum(
                  "ij,i->ij", self._covars_, self.dof_posterior_
              )
  
          elif self.covariance_type == "spherical":
              if self.scale_prior is None:
                  self.scale_prior_ = np.full(
                      (self.n_components,), 1e-3
                  )
              else:
                  self.scale_prior_ = self.scale_prior
              self.scale_posterior_ = (
                  self._covars_.mean(axis=1) * self.dof_posterior_
              )
  
imports: import logging
  import numbers
  import numpy
  from scipy import special
  from sklearn import cluster
  from sklearn.utils import check_random_state
  from .None import _kl_divergence, _utils
  from ._emissions import BaseCategoricalHMM, BaseGaussianHMM
  from .base import VariationalBaseHMM
  from .hmm import COVARIANCE_TYPES
  from .utils import fill_covars
label_desc: Use image node_id 5 for calling the VariationalGaussianHMM obj's underlying member method code with example usage: obj._init(X, lengths) without return types