Mercurial > pylearn
comparison pylearn/sampling/tests/test_hmc.py @ 1528:dee276045768
make test don't run in debug mode as it is too slow.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Fri, 09 Nov 2012 17:06:30 -0500 |
parents | 211b217f9691 |
children |
comparison
equal
deleted
inserted
replaced
1527:211b217f9691 | 1528:dee276045768 |
---|---|
60 return sampler | 60 return sampler |
61 | 61 |
62 | 62 |
63 def test_hmc(): | 63 def test_hmc(): |
64 print ('HMC') | 64 print ('HMC') |
65 sampler = _sampler_on_2d_gaussian(HMC_sampler.new_from_shared_positions, | 65 try: |
66 burnin=3000 / 20, n_samples=90000 / 20) | 66 orig_mode = theano.config.mode |
67 assert abs(sampler.avg_acceptance_rate.get_value() - sampler.target_acceptance_rate) < .1 | 67 if theano.config.mode in ["DebugMode", "DEBUG_MODE"]: |
68 theano.config.mode = "FAST_RUN" | |
69 sampler = _sampler_on_2d_gaussian( | |
70 HMC_sampler.new_from_shared_positions, | |
71 burnin=3000 / 20, n_samples=90000 / 20) | |
72 finally: | |
73 theano.config.mode = orig_mode | |
74 | |
75 | |
76 assert abs(sampler.avg_acceptance_rate.get_value() - | |
77 sampler.target_acceptance_rate) < .1 | |
68 assert sampler.stepsize.get_value() >= sampler.stepsize_min | 78 assert sampler.stepsize.get_value() >= sampler.stepsize_min |
69 assert sampler.stepsize.get_value() <= sampler.stepsize_max | 79 assert sampler.stepsize.get_value() <= sampler.stepsize_max |