changeset 1374:8b61566b0d36

small bug fix in test discovered by making Variable class raise an error about logical comparaison then checking if it is zero or not.
author Frederic Bastien <nouiz@nouiz.org>
date Thu, 18 Nov 2010 09:53:38 -0500
parents 90116fb3636b
children 7b61bfda1dab
files pylearn/sampling/tests/test_hmc.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/tests/test_hmc.py	Wed Nov 17 13:21:21 2010 -0500
+++ b/pylearn/sampling/tests/test_hmc.py	Thu Nov 18 09:53:38 2010 -0500
@@ -30,8 +30,8 @@
     samples = [sampler.draw() for r in xrange(burnin)] #burn-in
     samples = np.asarray([sampler.draw() for r in xrange(n_samples)])
 
-    assert sampler.avg_acceptance_rate > 0
-    assert sampler.avg_acceptance_rate < 1
+    assert sampler.avg_acceptance_rate.value > 0
+    assert sampler.avg_acceptance_rate.value < 1
 
     # TEST THAT THEY ARE FROM THE RIGHT DISTRIBUTION
 
@@ -59,7 +59,7 @@
 def test_hmc():
     print ('HMC')
     sampler = _sampler_on_2d_gaussian(HMC_sampler.new_from_shared_positions, burnin=3000/20, n_samples=90000/20)
-    assert abs(sampler.avg_acceptance_rate - sampler.target_acceptance_rate) < .1
+    assert abs(sampler.avg_acceptance_rate.value - sampler.target_acceptance_rate) < .1
     assert sampler.stepsize.value >= sampler.stepsize_min
     assert sampler.stepsize.value <= sampler.stepsize_max