Mercurial > pylearn
changeset 976:4cbd65cf902d
mcRBM - added extra free_energy param
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Mon, 23 Aug 2010 16:03:38 -0400 |
parents | 38e66e0da66a |
children | 9cac1ecaeef7 |
files | pylearn/algorithms/mcRBM.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/algorithms/mcRBM.py Mon Aug 23 16:02:34 2010 -0400 +++ b/pylearn/algorithms/mcRBM.py Mon Aug 23 16:03:38 2010 -0400 @@ -198,7 +198,7 @@ t1 = -TT.sum(TT.nnet.softplus(c + dot(v,W)), axis=1) t2 = 0.5 * TT.sum(v**2, axis=1) t3 = -TT.dot(v, a) - return t0 + t1 + t2 + t3 + return t0 + t1 + t2 + t3, (t0, t1, t2, t3) def expected_h_g_given_v(P, U, W, b, c, v): """Returns theano expression conditional expectations (`h`, `g`) in an mcRBM. @@ -292,8 +292,12 @@ energy_fn = lambda p : self.free_energy_given_v(p[0]), seed=seed) - def free_energy_given_v(self, v): - return free_energy_given_v(self.params, v) + def free_energy_given_v(self, v, extra=False): + rval = free_energy_given_v(self.params, v) + if extra: + return rval + else: + return rval[0] def contrastive_gradient(self, pos_v, neg_v, U_l1_penalty=0, W_l1_penalty=0): """Return a list of gradient expressions for self.params