class_docstr: This class implements Bayesian GMMs
  
  this class contains the following fields
  k: int,
     the number of components in the mixture
  dim: int,
       the dimension of the data
  means: array of shape (k, dim)
         all the means of the components
  precisions: array of shape (k, dim, dim)
              the precisions of the components
  weights: array of shape (k):
           weights of the mixture
  shrinkage: array of shape (k):
             scaling factor of the posterior precisions on the mean
  dof: array of shape (k)
       the degrees of freedom of the components
  prior_means: array of shape (k, dim):
               the prior on the components means
  prior_scale: array of shape (k, dim):
               the prior on the components precisions
  prior_dof: array of shape (k):
              the prior on the dof (should be at least equal to dim)
  prior_shrinkage: array of shape (k):
                   scaling factor of the prior precisions on the mean
  prior_weights: array of shape (k)
                 the prior on the components weights
  shrinkage: array of shape (k):
             scaling factor of the posterior precisions on the mean
  dof : array of shape (k): the posterior dofs
  
  fixme
  -----
  only 'full' precision is supported
class_docstr_tok: ["This","class","implements","Bayesian","GMMs","this","class","contains","the","following","fields","k",":","int",",","the","number","of","components","in","the","mixture","dim",":","int",",","the","dimension","of","the","data","means",":","array","of","shape","(","k",",","dim",")","all","the","means","of","the","components","precisions",":","array","of","shape","(","k",",","dim",",","dim",")","the","precisions","of","the","components","weights",":","array","of","shape","(","k",")",":","weights","of","the","mixture","shrinkage",":","array","of","shape","(","k",")",":","scaling","factor","of","the","posterior","precisions","on","the","mean","dof",":","array","of","shape","(","k",")","the","degrees","of","freedom","of","the","components","prior_means",":","array","of","shape","(","k",",","dim",")",":","the","prior","on","the","components","means","prior_scale",":","array","of","shape","(","k",",","dim",")",":","the","prior","on","the","components","precisions","prior_dof",":","array","of","shape","(","k",")",":","the","prior","on","the","dof","(","should","be","at","least","equal","to","dim",")","prior_shrinkage",":","array","of","shape","(","k",")",":","scaling","factor","of","the","prior","precisions","on","the","mean","prior_weights",":","array","of","shape","(","k",")","the","prior","on","the","components","weights","shrinkage",":","array","of","shape","(","k",")",":","scaling","factor","of","the","posterior","precisions","on","the","mean","dof",":","array","of","shape","(","k",")",":","the","posterior","dofs","fixme","--","--","-","only","'full","'","precision","is","supported"]
docstr: Given the allocation vector z,
  and the corresponding data x,
  resample the precisions
  
  Parameters
  ----------
  x array of shape (nb_samples,self.dim)
    the data used in the estimation process
  z array of shape (nb_samples), type = np.int_
    the corresponding classification
docstr_tok: ["Given","the","allocation","vector","z",",","and","the","corresponding","data","x",",","resample","the","precisions","Parameters","--","--","--","--","--","x","array","of","shape","(","nb_samples",",","self.dim",")","the","data","used","in","the","estimation","process","z","array","of","shape","(","nb_samples",")",",","type","=","np.int_","the","corresponding","classification"]
code: def update_precisions(self, x, z):
      """
      Given the allocation vector z,
      and the corresponding data x,
      resample the precisions
  
      Parameters
      ----------
      x array of shape (nb_samples,self.dim)
        the data used in the estimation process
      z array of shape (nb_samples), type = np.int_
        the corresponding classification
      """
      pop = self.pop(z)
      self.dof = self.prior_dof + pop + 1
      rpop = pop + (pop == 0)
      self._detp = np.zeros(self.k)
  
      for k in range(self.k):
          # empirical means
          empmeans = np.sum(x[z == k], 0) / rpop[k]
          dm = np.reshape(empmeans - self.prior_means[k], (1, self.dim))
  
          # scatter
          dx = np.reshape(x[z == k] - empmeans, (pop[k], self.dim))
          scatter = np.dot(dx.T, dx)
  
          # bias
          addcov = np.dot(dm.T, dm) * self.prior_shrinkage[k]
  
          # covariance = prior term + scatter + bias
          covariance = self._inv_prior_scale[k] + scatter + addcov
  
          # precision
          scale = inv(covariance)
          self.precisions[k] = generate_Wishart(self.dof[k], scale)
          self._detp[k] = detsh(self.precisions[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 9 for calling the BGMM obj's underlying member method code with example usage: obj.update_precisions(x, z) without return types