# HG changeset patch # User James Bergstra # Date 1282672987 14400 # Node ID 9e753ddcc320f9e3eda53aa31b639e459aa05ea1 # Parent fd243cb2bf0bfb003bac1d06b0db98ebcdb0e82d mcRBM - cleaned up the preactivation function diff -r fd243cb2bf0b -r 9e753ddcc320 pylearn/algorithms/mcRBM.py --- a/pylearn/algorithms/mcRBM.py Tue Aug 24 14:02:29 2010 -0400 +++ b/pylearn/algorithms/mcRBM.py Tue Aug 24 14:03:07 2010 -0400 @@ -245,12 +245,16 @@ else: return shared(x, name=name) -def hidden_cov_units_preactivation_given_v(rbm, v, small=1e-8): +def hidden_cov_units_preactivation_given_v(rbm, v, small=0.5): + """Return argument to the sigmoid that would give mean of covariance hid units + + See the math at the top of this file for what 'adjusted' means. + + return b - 0.5 * dot(adjusted(v), U)**2 + """ (U,W,a,b,c) = rbm - unit_v = v / (TT.sqrt(TT.sum(v**2, axis=1))+small).dimshuffle(0,'x') # unit rows - unit_U = U # assuming unit cols! - #unit_U = U / (TT.sqrt(TT.sum(U**2, axis=0))+small) #unit cols - return b - 0.5 * dot(unit_v, unit_U)**2 + unit_v = v / (TT.sqrt(TT.mean(v**2, axis=1)+small)).dimshuffle(0,'x') # adjust row norm + return b - 0.5 * dot(unit_v, U)**2 def free_energy_given_v(rbm, v): """Returns theano expression for free energy of visible vector `v` in an mcRBM