changeset 1274:9d5905d6d879

hmc - changed updates to member fn from lambda for pickling
author James Bergstra <bergstrj@iro.umontreal.ca>
date Wed, 08 Sep 2010 13:17:45 -0400
parents 7bb5dd98e671
children f0129e37a8ef
files pylearn/sampling/hmc.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/hmc.py	Wed Sep 08 13:05:02 2010 -0400
+++ b/pylearn/sampling/hmc.py	Wed Sep 08 13:17:45 2010 -0400
@@ -213,7 +213,7 @@
                 avg_acceptance_rate=avg_acceptance_rate,
                 target_acceptance_rate=target_acceptance_rate,
                 s_rng=s_rng,
-                updates=lambda: list(simulate_updates),
+                _updates=simulate_updates,
                 simulate=simulate)
 
     def draw(self, **kwargs):
@@ -229,6 +229,13 @@
         self.simulate()
         return self.positions.value.copy()
 
+    def updates(self):
+        """Returns the update expressions required to simulate the Markov Chain
+
+        :TODO: :WRITEME: *prescriptive* definition of what this method does (API)
+        """
+        return list(self._updates)
+
 #TODO: 
 # Consider a heuristic for updating the *MASS* of the particles.  We might want the mass to be
 # such that the momentum is in the same range as the gradient on the energy.  Look at Radford's