code: def test_em_loglike1():
      # Test that the likelihood of the GMM is expected on standard data
      # 3-cluster model
      dim, k, n = 1, 3, 1000
      x = nr.randn(n, dim)
      lgmm = GMM(k, dim)
      lgmm.initialize(x)
      lgmm.estimate(x)
      ll = lgmm.average_log_like(x)
      ent = 0.5 * (1 + np.log(2 * np.pi))
      assert np.absolute(ll + ent) < 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 2 for calling a global function with example usage: test_em_loglike1() without return types