Mercurial > pylearn
comparison nnet_ops.py @ 448:0961d4b56ec5
Added some documentation
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Wed, 03 Sep 2008 17:08:54 -0400 |
parents | 0392b666320a |
children | 2bb67e978c28 |
comparison
equal
deleted
inserted
replaced
447:0392b666320a | 448:0961d4b56ec5 |
---|---|
608 def binary_crossentropy(output, target): | 608 def binary_crossentropy(output, target): |
609 """ | 609 """ |
610 Compute the crossentropy of binary output wrt binary target. | 610 Compute the crossentropy of binary output wrt binary target. |
611 @note: We do not sum, crossentropy is computed by component. | 611 @note: We do not sum, crossentropy is computed by component. |
612 @todo: Rewrite as a scalar, and then broadcast to tensor. | 612 @todo: Rewrite as a scalar, and then broadcast to tensor. |
613 @todo: This is essentially duplicated as cost.cross_entropy | |
613 """ | 614 """ |
614 return -(target * tensor.log(output) + (1 - target) * tensor.log(1 - output)) | 615 return -(target * tensor.log(output) + (1 - target) * tensor.log(1 - output)) |
615 | 616 |
616 | 617 |
617 | 618 |