Mercurial > pylearn
annotate cost.py @ 417:4f61201fa9a9
Parameters are no longer global
author | Joseph Turian <turian@iro.umontreal.ca> |
---|---|
date | Fri, 11 Jul 2008 17:19:37 -0400 |
parents | 319bf28c2dd5 |
children | 0f366ecb11ee |
rev | line source |
---|---|
413 | 1 """ |
2 Cost functions. | |
3 """ | |
4 | |
415 | 5 import theano.tensor as T |
6 | |
413 | 7 def quadratic(target, output, axis=1): |
8 return T.mean(T.sqr(target - output), axis) | |
9 | |
10 def cross_entropy(target, output, axis=1): | |
11 return -T.mean(target * T.log2(output) + (1 - target) * T.log2(1 - output), axis=axis) |