def test_bgmm_gibbs(verbose=0): # perform the estimation of a gmm using Gibbs sampling n = 100 k = 2 dim = 2 niter = 1000 x = nr.randn(n, dim) x[:30] += 2 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