class_docstr: Subclass of Bayesian GMMs (BGMM)
  that implements Variational Bayes estimation of the parameters
class_docstr_tok: ["Subclass","of","Bayesian","GMMs","(","BGMM",")","that","implements","Variational","Bayes","estimation","of","the","parameters"]
docstr: VB-M step
  
  Parameters
  ----------
  x: array of shape(nb_samples, self.dim)
     the data from which the model is estimated
  like: array of shape(nb_samples, self.k)
     the likelihood of the data under each class
docstr_tok: ["VB-M","step","Parameters","--","--","--","--","--","x",":","array","of","shape","(","nb_samples",",","self.dim",")","the","data","from","which","the","model","is","estimated","like",":","array","of","shape","(","nb_samples",",","self.k",")","the","likelihood","of","the","data","under","each","class"]
code: def _Mstep(self, x, like):
      """VB-M step
  
      Parameters
      ----------
      x: array of shape(nb_samples, self.dim)
         the data from which the model is estimated
      like: array of shape(nb_samples, self.k)
         the likelihood of the data under each class
      """
      from numpy.linalg import inv
  
      tiny = 1.0e-15
      pop = like.sum(0)
  
      # shrinkage, weights,dof
      self.weights = self.prior_weights + pop
      pop = pop[0 : self.k]
      like = like[:, : self.k]
      self.shrinkage = self.prior_shrinkage + pop
      self.dof = self.prior_dof + pop
  
      # reshape
      pop = np.reshape(pop, (self.k, 1))
      prior_shrinkage = np.reshape(self.prior_shrinkage, (self.k, 1))
      shrinkage = np.reshape(self.shrinkage, (self.k, 1))
  
      # means
      means = np.dot(like.T, x) + self.prior_means * prior_shrinkage
      self.means = means / shrinkage
  
      # precisions
      empmeans = np.dot(like.T, x) / np.maximum(pop, tiny)
      empcov = np.zeros(np.shape(self.prior_scale))
      for k in range(self.k):
          dx = x - empmeans[k]
          empcov[k] = np.dot(dx.T, like[:, k : k + 1] * dx)
          covariance = np.array(self._inv_prior_scale) + empcov
  
      dx = np.reshape(
          empmeans - self.prior_means, (self.k, self.dim, 1)
      )
      addcov = np.array([np.dot(dx[k], dx[k].T) for k in range(self.k)])
      apms = np.reshape(
          prior_shrinkage * pop / shrinkage, (self.k, 1, 1)
      )
      covariance += addcov * apms
      # update scale
      self.scale = np.array([inv(covariance[k]) for k in range(self.k)])
  
imports: import math
  import numpy
  import numpy.random
  from scipy.linalg import cholesky, eigvalsh, inv
  from scipy.special import gammaln
  from .gmm import GMM
  from .utils import kmeans
label_desc: Use image node_id 4 for calling the VBGMM obj's underlying member method code with example usage: obj._Mstep(x, like) without return types