changeset 1266:bc4d98995bad

hmc - separated simulate into simulate_updates
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 02 Sep 2010 16:48:33 -0400
parents d6665a5af743
children 075c193afd1b
files pylearn/sampling/hmc.py
diffstat 1 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/hmc.py	Wed Sep 01 17:40:21 2010 -0400
+++ b/pylearn/sampling/hmc.py	Thu Sep 02 16:48:33 2010 -0400
@@ -194,19 +194,19 @@
                 stepsize, 
                 n_steps,
                 positions_shape)
-        simulate = function([], [],
-                updates=mcmc_updates(
-                    shared_positions,
-                    stepsize,
-                    avg_acceptance_rate, 
-                    final_p=final_p, 
-                    accept=accept,
-                    stepsize_min=stepsize_min,
-                    stepsize_max=stepsize_max,
-                    stepsize_inc=stepsize_inc,
-                    stepsize_dec=stepsize_dec,
-                    target_acceptance_rate=target_acceptance_rate,
-                    avg_acceptance_slowness=avg_acceptance_slowness))
+        simulate_updates = mcmc_updates(
+                shared_positions,
+                stepsize,
+                avg_acceptance_rate, 
+                final_p=final_p, 
+                accept=accept,
+                stepsize_min=stepsize_min,
+                stepsize_max=stepsize_max,
+                stepsize_inc=stepsize_inc,
+                stepsize_dec=stepsize_dec,
+                target_acceptance_rate=target_acceptance_rate,
+                avg_acceptance_slowness=avg_acceptance_slowness)
+        simulate = function([], [], updates=simulate_updates)
         return cls(
                 positions=shared_positions,
                 stepsize=stepsize,
@@ -215,6 +215,7 @@
                 avg_acceptance_rate=avg_acceptance_rate,
                 target_acceptance_rate=target_acceptance_rate,
                 s_rng=s_rng,
+                simulate_updates=simulate_updates,
                 simulate=simulate)
 
     def draw(self, **kwargs):