view cost.py @ 418:2ea14774eb07

Automated merge with ssh://projects@lgcm.iro.umontreal.ca/hg/pylearn
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 14 Jul 2008 13:48:41 -0400
parents 319bf28c2dd5
children 0f366ecb11ee
line wrap: on
line source

"""
Cost functions.
"""

import theano.tensor as T

def quadratic(target, output, axis=1):
    return T.mean(T.sqr(target - output), axis)

def cross_entropy(target, output, axis=1):
    return -T.mean(target * T.log2(output) + (1 - target) * T.log2(1 - output), axis=axis)