changeset 642:88603b2ac8f9

Bugfix in cost.py to correctly use theano.tensor.xlogx
author Joseph Turian <turian@iro.umontreal.ca>
date Fri, 30 Jan 2009 16:38:02 -0500
parents ac6e7ce28f70
children 5f9ffefa9ca8
files pylearn/algorithms/cost.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)