view cost.py @ 414:643dbccde1fc

Added noise functions
author Joseph Turian <turian@iro.umontreal.ca>
date Fri, 11 Jul 2008 15:29:37 -0400
parents f63dfb0ac7dc
children 319bf28c2dd5
line wrap: on
line source

"""
Cost functions.
"""

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)