code: def test_em_loglike4():
      # Test that the likelihood of the GMM is expected on standard data
      # here dim = 5
      dim, k, n = 5, 1, 1000
      scale, offset = 3.0, 4.0
      x = offset + scale * nr.randn(n, dim)
      lgmm = GMM(k, dim)
      lgmm.initialize(x)
      lgmm.estimate(x)
      ll = lgmm.average_log_like(x)
      ent = dim * 0.5 * (1 + np.log(2 * np.pi * scale**2))
      assert np.absolute(ll + ent) < dim * 3.0 / np.sqrt(n)
  
file_path: nipy/nipy/algorithms/clustering/tests/test_gmm.py
imports: import numpy
  from ..gmm import GMM, best_fitting_GMM
label_desc: Use image node_id 5 for calling a global function with example usage: test_em_loglike4() without return types