# HG changeset patch # User James Bergstra # Date 1282673573 14400 # Node ID d68828c98c3863020e22d0061dba0aa372971ee0 # Parent e70e7446417055a110f047f9f95e9d831bf6a9d8 mcRBM - cleaned up expected hidden unit function diff -r e70e74464170 -r d68828c98c38 pylearn/algorithms/mcRBM.py --- 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)