class_docstr: Gaussian Mixture Model
  
  Representation of a Gaussian mixture model probability distribution.
  This class allows for easy evaluation of, sampling from, and
  maximum-likelihood estimation of the parameters of a GMM distribution.
  
  Initializes parameters such that every mixture component has zero
  mean and identity covariance.
  
  Parameters
  ----------
  n_components : int, optional
      Number of mixture components. Defaults to 1.
  covariance_type : {'diag', 'spherical', 'tied', 'full'}
      String describing the type of covariance parameters to
      use. Defaults to 'diag'.
  
  Attributes
  ----------
  `weights_` : array, shape (n_components,)
      This attribute stores the mixing weights for each mixture component.
  `means_` : array, shape (n_components, n_features)
      Mean parameters for each mixture component.
  `covars_` : array
      Covariance parameters for each mixture component. The shape
      depends on `covariance_type`.::
  
      - (n_components, n_features)             if 'spherical',
      - (n_features, n_features)               if 'tied',
      - (n_components, n_features)             if 'diag',
      - (n_components, n_features, n_features) if 'full'.
  
  `converged_` : bool
      True when convergence was reached in fit(), False otherwise.
  
  See Also
  --------
  sklearn.mixture.GMM
class_docstr_tok: ["Gaussian","Mixture","Model","Representation","of","a","Gaussian","mixture","model","probability","distribution",".","This","class","allows","for","easy","evaluation","of",",","sampling","from",",","and","maximum-likelihood","estimation","of","the","parameters","of","a","GMM","distribution",".","Initializes","parameters","such","that","every","mixture","component","has","zero","mean","and","identity","covariance",".","Parameters","--","--","--","--","--","n_components",":","int",",","optional","Number","of","mixture","components",".","Defaults","to","1.","covariance_type",":","{","'diag","'",",","'spherical","'",",","'tied","'",",","'full","'","}","String","describing","the","type","of","covariance","parameters","to","use",".","Defaults","to","'diag","'",".","Attributes","--","--","--","--","--","`","weights_","`",":","array",",","shape","(","n_components",",",")","This","attribute","stores","the","mixing","weights","for","each","mixture","component",".","`","means_","`",":","array",",","shape","(","n_components",",","n_features",")","Mean","parameters","for","each","mixture","component",".","`","covars_","`",":","array","Covariance","parameters","for","each","mixture","component",".","The","shape","depends","on","`","covariance_type","`",".",":",":","-","(","n_components",",","n_features",")","if","'spherical","'",",","-","(","n_features",",","n_features",")","if","'tied","'",",","-","(","n_components",",","n_features",")","if","'diag","'",",","-","(","n_components",",","n_features",",","n_features",")","if","'full","'",".","`","converged_","`",":","bool","True","when","convergence","was","reached","in","fit","(",")",",","False","otherwise",".","See","Also","--","--","--","--","sklearn.mixture.GMM"]
docstr: Estimate model parameters with the expectation-maximization algorithm.
  
  A initialization step is performed before entering the em
  algorithm. If you want to avoid this step, set the keyword
  argument init_params to the empty string '' when creating the
  GMM object. Likewise, if you would like just to do an
  initialization, set n_iter=0.
  
  Parameters
  ----------
  x : array_like, shape (n, n_features)
      List of n_features-dimensional data points.  Each row corresponds
      to a single data point.
  random_state: RandomState or an int seed (0 by default)
      A random number generator instance.
  min_covar : float, optional
      Floor on the diagonal of the covariance matrix to prevent
      overfitting.
  tol : float, optional
      Convergence threshold. EM iterations will stop when average
      gain in log-likelihood is below this threshold.
  n_iter : int, optional
      Number of EM iterations to perform.
  n_init : int, optional
      Number of initializations to perform, the best results is kept.
  params : str, optional
      Controls which parameters are updated in the training process.
      Can contain any combination of 'w' for weights, 'm' for means,
      and 'c' for covars.
  init_params : str, optional
      Controls which parameters are updated in the initialization
      process.  Can contain any combination of 'w' for weights,
      'm' for means, and 'c' for covars.
docstr_tok: ["Estimate","model","parameters","with","the","expectation-maximization","algorithm",".","A","initialization","step","is","performed","before","entering","the","em","algorithm",".","If","you","want","to","avoid","this","step",",","set","the","keyword","argument","init_params","to","the","empty","string","``","when","creating","the","GMM","object",".","Likewise",",","if","you","would","like","just","to","do","an","initialization",",","set","n_iter=0",".","Parameters","--","--","--","--","--","x",":","array_like",",","shape","(","n",",","n_features",")","List","of","n_features-dimensional","data","points",".","Each","row","corresponds","to","a","single","data","point",".","random_state",":","RandomState","or","an","int","seed","(","0","by","default",")","A","random","number","generator","instance",".","min_covar",":","float",",","optional","Floor","on","the","diagonal","of","the","covariance","matrix","to","prevent","overfitting",".","tol",":","float",",","optional","Convergence","threshold",".","EM","iterations","will","stop","when","average","gain","in","log-likelihood","is","below","this","threshold",".","n_iter",":","int",",","optional","Number","of","EM","iterations","to","perform",".","n_init",":","int",",","optional","Number","of","initializations","to","perform",",","the","best","results","is","kept",".","params",":","str",",","optional","Controls","which","parameters","are","updated","in","the","training","process",".","Can","contain","any","combination","of","'","w","'","for","weights",",","'m","'","for","means",",","and","'","c","'","for","covars",".","init_params",":","str",",","optional","Controls","which","parameters","are","updated","in","the","initialization","process",".","Can","contain","any","combination","of","'","w","'","for","weights",",","'m","'","for","means",",","and","'","c","'","for","covars","."]
code: def fit(
      self,
      x,
      random_state=None,
      tol=1e-3,
      min_covar=1e-3,
      n_iter=100,
      n_init=1,
      params="wmc",
      init_params="wmc",
  ):
      """
      Estimate model parameters with the expectation-maximization algorithm.
  
      A initialization step is performed before entering the em
      algorithm. If you want to avoid this step, set the keyword
      argument init_params to the empty string '' when creating the
      GMM object. Likewise, if you would like just to do an
      initialization, set n_iter=0.
  
      Parameters
      ----------
      x : array_like, shape (n, n_features)
          List of n_features-dimensional data points.  Each row corresponds
          to a single data point.
      random_state: RandomState or an int seed (0 by default)
          A random number generator instance.
      min_covar : float, optional
          Floor on the diagonal of the covariance matrix to prevent
          overfitting.
      tol : float, optional
          Convergence threshold. EM iterations will stop when average
          gain in log-likelihood is below this threshold.
      n_iter : int, optional
          Number of EM iterations to perform.
      n_init : int, optional
          Number of initializations to perform, the best results is kept.
      params : str, optional
          Controls which parameters are updated in the training process.
          Can contain any combination of 'w' for weights, 'm' for means,
          and 'c' for covars.
      init_params : str, optional
          Controls which parameters are updated in the initialization
          process.  Can contain any combination of 'w' for weights,
          'm' for means, and 'c' for covars.
  
      """
      import sklearn.mixture
  
      # first initialise a sklearn.mixture.GMM object
      gmm = sklearn.mixture.GMM(
          n_components=self.n_components,
          covariance_type=self.covariance_type,
          random_state=random_state,
          tol=tol,
          min_covar=min_covar,
          n_iter=n_iter,
          n_init=n_init,
          params=params,
          init_params=init_params,
      )
      # fit this GMM
      gmm.fit(x)
      # copy the needed information
      self.covars = gmm.covars_
      self.means = gmm.means_
      self.weights = gmm.weights_
      # and return self
      return self
  
file_path: madmom/madmom/ml/gmm.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from scipy import linalg
label_desc: Use image node_id 5 for calling the GMM obj's underlying member method code with example usage: obj.fit(x, random_state, tol, min_covar, n_iter, n_init, params, init_params) and returns: self