Skip to content

Commit

Permalink
Merge pull request #635 from rizar/fix633
Browse files Browse the repository at this point in the history
Fix 633
  • Loading branch information
bartvm committed May 15, 2015
2 parents e4d2cd0 + f563f9a commit 49f568a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions blocks/bricks/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ def apply(self, y, y_hat):
class MisclassificationRate(Cost):
@application(outputs=["error_rate"])
def apply(self, y, y_hat):
return (tensor.sum(tensor.neq(y, y_hat.argmax(axis=1))) /
y.shape[0].astype(floatX))
# Here we have to cast both operands to floatX explicitly.
# Because int64 / float32 = float64 in Theano, unfortunately.
return (
tensor.sum(tensor.neq(y, y_hat.argmax(axis=1))).astype(floatX) /
y.shape[0].astype(floatX))

0 comments on commit 49f568a

Please sign in to comment.