# HG changeset patch # User James Bergstra # Date 1282593754 14400 # Node ID 38e66e0da66ace65edca9723e7c3d001053d1088 # Parent f2cdcc71ece1068d35ce289cf5ea1e3a01fd7cee mcRBM - put softplus in directly for num. stability diff -r f2cdcc71ece1 -r 38e66e0da66a pylearn/algorithms/mcRBM.py --- a/pylearn/algorithms/mcRBM.py Mon Aug 23 16:02:02 2010 -0400 +++ b/pylearn/algorithms/mcRBM.py Mon Aug 23 16:02:34 2010 -0400 @@ -194,9 +194,9 @@ """ U, W, a, b, c = rbm - t0 = -TT.sum(TT.log1p(TT.exp(hidden_cov_units_preactivation_given_v(rbm, v))),axis=1) - t1 = -TT.sum(TT.log1p(TT.exp(c + dot(v,W))), axis=1) - t2 = 0.5 * TT.sum(v**2, axis=1) + t0 = -TT.sum(TT.nnet.softplus(hidden_cov_units_preactivation_given_v(rbm, v)),axis=1) + 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