[Scipy-svn] r3101 - trunk/Lib/sandbox/pyem/tests

scipy-svn@scip... scipy-svn@scip...
Wed Jun 13 05:26:10 CDT 2007


Author: cdavid
Date: 2007-06-13 05:26:06 -0500 (Wed, 13 Jun 2007)
New Revision: 3101

Modified:
   trunk/Lib/sandbox/pyem/tests/test_gmm_em.py
Log:
More fix for broken tests in gmm_em

Modified: trunk/Lib/sandbox/pyem/tests/test_gmm_em.py
===================================================================
--- trunk/Lib/sandbox/pyem/tests/test_gmm_em.py	2007-06-13 10:08:00 UTC (rev 3100)
+++ trunk/Lib/sandbox/pyem/tests/test_gmm_em.py	2007-06-13 10:26:06 UTC (rev 3101)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Tue Jun 12 09:00 PM 2007 J
+# Last Change: Wed Jun 13 07:00 PM 2007 J
 
 # For now, just test that all mode/dim execute correctly
 
@@ -123,9 +123,9 @@
         gmm = GMM(gm, 'test')
         EM().train(dic['data'], gmm)
 
-        assert_array_equal(gmm.gm.w, dic['w'])
-        assert_array_equal(gmm.gm.mu, dic['mu'])
-        assert_array_equal(gmm.gm.va, dic['va'])
+        assert_array_almost_equal(gmm.gm.w, dic['w'], DEF_DEC)
+        assert_array_almost_equal(gmm.gm.mu, dic['mu'], DEF_DEC)
+        assert_array_almost_equal(gmm.gm.va, dic['va'], DEF_DEC)
 
     def test_1d_diag(self, level = 1):
         d = 1
@@ -137,9 +137,9 @@
         gmm = GMM(gm, 'test')
         EM().train(dic['data'], gmm)
 
-        assert_array_equal(gmm.gm.w, dic['w'])
-        assert_array_equal(gmm.gm.mu, dic['mu'])
-        assert_array_equal(gmm.gm.va, dic['va'])
+        assert_array_equal(gmm.gm.w, dic['w'], DEF_DEC)
+        assert_array_equal(gmm.gm.mu, dic['mu'], DEF_DEC)
+        assert_array_equal(gmm.gm.va, dic['va'], DEF_DEC)
 
     def test_2d_full(self, level = 1):
         d = 2
@@ -151,9 +151,9 @@
         gmm = GMM(gm, 'test')
         EM().train(dic['data'], gmm)
 
-        assert_array_equal(gmm.gm.w, dic['w'])
-        assert_array_equal(gmm.gm.mu, dic['mu'])
-        assert_array_equal(gmm.gm.va, dic['va'])
+        assert_array_equal(gmm.gm.w, dic['w'], DEF_DEC)
+        assert_array_equal(gmm.gm.mu, dic['mu'], DEF_DEC)
+        assert_array_equal(gmm.gm.va, dic['va'], DEF_DEC)
 
     def test_2d_diag(self, level = 1):
         d = 2
@@ -165,9 +165,9 @@
         gmm = GMM(gm, 'test')
         EM().train(dic['data'], gmm)
 
-        assert_array_equal(gmm.gm.w, dic['w'])
-        assert_array_equal(gmm.gm.mu, dic['mu'])
-        assert_array_equal(gmm.gm.va, dic['va'])
+        assert_array__almost_equal(gmm.gm.w, dic['w'], DEF_DEC)
+        assert_array__almost_equal(gmm.gm.mu, dic['mu'], DEF_DEC)
+        assert_array__almost_equal(gmm.gm.va, dic['va'], DEF_DEC)
 
 class test_log_domain(EmTest):
     """This class tests whether the GMM works in log domain."""
@@ -183,12 +183,12 @@
         ta = N.log(a)
         tna = N.log(na)
         if not N.all(N.isfinite(ta)):
-            print "precision problem for %s, %dd, %dk, need fixing" % (mode, d, k)
+            print "precision problem for %s, %dd, %dk, test need fixing" % (mode, d, k)
         else:
             assert_array_almost_equal(ta, la, DEF_DEC)
 
         if not N.all(N.isfinite(tna)):
-            print "precision problem for %s, %dd, %dk, need fixing" % (mode, d, k)
+            print "precision problem for %s, %dd, %dk, test need fixing" % (mode, d, k)
         else:
             assert_array_almost_equal(tna, nla, DEF_DEC)
 



More information about the Scipy-svn mailing list