# HG changeset patch # User Xavier Glorot # Date 1254345262 14400 # Node ID 5bbfaf01395d2583e5df5524f61e5b6fc80eb326 # Parent f1a29c772210ba7c35b96c1efbbe950b28fd77f0 Added a arsinh activation function DAA input groups diff -r f1a29c772210 -r 5bbfaf01395d pylearn/algorithms/sandbox/DAA_inputs_groups.py --- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py Fri Sep 04 17:37:35 2009 -0400 +++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py Wed Sep 30 17:14:22 2009 -0400 @@ -100,6 +100,9 @@ def softsign_act(x): return x/(1.0 + T.abs_(x)) +def arsinh_act(x): + return T.log(x+T.sqrt(1+x*x)) + # costs utils:--------------------------------------------------- # in order to fix numerical instability of the cost and gradient calculation for the cross entropy we calculate it # with the following functions direclty from the activation: @@ -128,6 +131,7 @@ XS = T.xlogx.xlogx((target+1)/2.0) + T.xlogx.xlogx(1-(target+1)/2.0) return -T.mean(T.sum(XE-XS, axis=sum_axis),axis=mean_axis) + def cross_entropy(target, output_act, act, mean_axis=0, sum_axis=1): if act == 'sigmoid_act': return sigmoid_cross_entropy(target, output_act, mean_axis, sum_axis) @@ -205,7 +209,7 @@ self.corruption_pattern = corruption_pattern self.blockgrad = blockgrad - assert hid_fn in ('sigmoid_act','tanh_act','softsign_act','tanh2_act') + assert hid_fn in ('sigmoid_act','tanh_act','softsign_act','tanh2_act','arsinh_act') self.hid_fn = eval(hid_fn) assert rec_fn in ('sigmoid_act','tanh_act','softsign_act','tanh2_act') @@ -542,7 +546,7 @@ self.corruption_pattern = corruption_pattern self.blockgrad = blockgrad - assert act_reg in ('sigmoid_act','tanh_act','softsign_act','tanh2_act') + assert act_reg in ('sigmoid_act','tanh_act','softsign_act','tanh2_act','arsinh_act') self.act_reg = eval(act_reg) print '\t**** StackedDAAig.__init__ ****'