# HG changeset patch # User Xavier Glorot # Date 1244053556 14400 # Node ID f02dc24dad8f073607e403fe900c055c247a2795 # Parent f353c9a99f95597d2e9af766e467999f671a5b2c Normalized tanh to be equivalent to sigmoid in DAAig diff -r f353c9a99f95 -r f02dc24dad8f pylearn/algorithms/sandbox/DAA_inputs_groups.py --- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py Wed Jun 03 13:54:31 2009 -0400 +++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py Wed Jun 03 14:25:56 2009 -0400 @@ -33,7 +33,7 @@ return theano.tensor.nnet.sigmoid(x) def tanh_act(x): - return theano.tensor.tanh(x) + return theano.tensor.tanh(x/2.0) # costs utils:--------------------------------------------------- @@ -45,8 +45,8 @@ return -T.mean(T.sum(XE, axis=sum_axis),axis=mean_axis) def tanh_cross_entropy(target, output_act, mean_axis, sum_axis): - XE =-(target+1)/2.0 * T.log(1 + T.exp(-2 * output_act)) + \ - (1 - (target+1)/2.0) * (- T.log(1 + T.exp(2 * output_act))) + XE =-(target+1)/2.0 * T.log(1 + T.exp(- output_act)) + \ + (1 - (target+1)/2.0) * (- T.log(1 + T.exp(output_act))) return -T.mean(T.sum(XE, axis=sum_axis),axis=mean_axis) def cross_entropy(target, output_act, act, mean_axis=0, sum_axis=1):