# HG changeset patch # User James Bergstra # Date 1283966265 14400 # Node ID 9d5905d6d8795a199dc661d17beb0a6e550f67c9 # Parent 7bb5dd98e671036f43a86c0451b6d3ee75ba76f2 hmc - changed updates to member fn from lambda for pickling diff -r 7bb5dd98e671 -r 9d5905d6d879 pylearn/sampling/hmc.py --- 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