# HG changeset patch # User Joseph Turian # Date 1233351482 18000 # Node ID 88603b2ac8f906e19697d37cc876e8ffa85606f4 # Parent ac6e7ce28f7061eeaa966b5d3c3b35db5d31b770 Bugfix in cost.py to correctly use theano.tensor.xlogx diff -r ac6e7ce28f70 -r 88603b2ac8f9 pylearn/algorithms/cost.py --- a/pylearn/algorithms/cost.py Sat Jan 24 17:25:41 2009 -0500 +++ b/pylearn/algorithms/cost.py Fri Jan 30 16:38:02 2009 -0500 @@ -10,6 +10,7 @@ """ import theano.tensor as T +from theano.tensor.xlogx import xlogx def quadratic(target, output, axis=1): return T.mean(T.sqr(target - output), axis=axis) @@ -28,5 +29,5 @@ different shapes then the result will be garbled. """ return -(target * T.log(output) + (1 - target) * T.log(1 - output)) \ - + (T.xlogx(target) + T.xlogx(1 - target)) + + (xlogx(target) + xlogx(1 - target)) # return cross_entropy(target, output, axis) - cross_entropy(target, target, axis)