Mercurial > pylearn
changeset 991:d68828c98c38
mcRBM - cleaned up expected hidden unit function
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Tue, 24 Aug 2010 14:12:53 -0400 |
parents | e70e74464170 |
children | 30b7c4defb6c |
files | pylearn/algorithms/mcRBM.py |
diffstat | 1 files changed, 7 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/algorithms/mcRBM.py Tue Aug 24 14:08:24 2010 -0400 +++ b/pylearn/algorithms/mcRBM.py Tue Aug 24 14:12:53 2010 -0400 @@ -293,24 +293,15 @@ rval = theano.tensor.grad(cost, list(rbm)) return rval -def expected_h_g_given_v(P, U, W, b, c, v): - """Returns theano expression conditional expectations (`h`, `g`) in an mcRBM. - - An mcRBM is parametrized - by `U`, `W`, `b`, `c`. - See module - level documentation for explanations of the `U`, `W`, `b` and `c` parameters. - +def expected_h_g_given_v(rbm, v): + """Returns tuple (`h`, `g`) of theano expression conditional expectations in an mcRBM. - The conditional E[h, g | v] is what we need to classify images. + `h` is the conditional on the covariance units. + `g` is the conditional on the mean units. + """ - raise NotImplementedError() - - #TODO: check to see if these args should be negated? - - if P is None: - h = nnet.sigmoid(b + 0.5 * cosines(v,U)) - else: - h = nnet.sigmoid(b + 0.5 * dot(cosines(v,U), P)) + (U, W, a, b, c) = rbm + h = TT.nnet.sigmoid(hidden_cov_units_preactivation_given_v(rbm, v)) g = nnet.sigmoid(c + dot(v,W)) return (h, g)