Mercurial > pylearn
annotate cost.py @ 434:0f366ecb11ee
log2->log in cost
author | Olivier Breuleux <breuleuo@iro.umontreal.ca> |
---|---|
date | Mon, 04 Aug 2008 16:21:59 -0400 |
parents | 319bf28c2dd5 |
children | 45879c1ecde7 |
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): | |
434
0f366ecb11ee
log2->log in cost
Olivier Breuleux <breuleuo@iro.umontreal.ca>
parents:
415
diff
changeset
|
11 return -T.mean(target * T.log(output) + (1 - target) * T.log(1 - output), axis=axis) |