code: def test_bgmm_gibbs():
      # Perform the estimation of a gmm using Gibbs sampling
      n_samples, k, dim, niter, offset = 100, 2, 2, 1000, 2.0
      x = nr.randn(n_samples, dim)
      x[:30] += offset
  
      b = BGMM(k, dim)
      b.guess_priors(x)
      b.initialize(x)
      b.sample(x, 1)
      w, cent, prec, pz = b.sample(x, niter, mem=1)
      b.plugin(cent, prec, w)
      z = pz[:, 0]
  
      # fixme : find a less trivial test
      assert z.max() + 1 == b.k
  
file_path: nipy/nipy/algorithms/clustering/tests/test_bgmm.py
imports: import numpy
  import numpy.random
  from ..bgmm import BGMM, VBGMM, dirichlet_eval, dkl_gaussian, multinomial
label_desc: Use image node_id 6 for calling a global function with example usage: test_bgmm_gibbs() without return types