Skip to content

Commit

Permalink
Add delta(1e-7) for cross_entropy_error
Browse files Browse the repository at this point in the history
  • Loading branch information
koki0702 authored Dec 20, 2017
1 parent 899c2c4 commit ea91786
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cross_entropy_error(y, t):
t = t.argmax(axis=1)

batch_size = y.shape[0]
return -np.sum(np.log(y[np.arange(batch_size), t])) / batch_size
return -np.sum(np.log(y[np.arange(batch_size), t] + 1e-7)) / batch_size


def softmax_loss(X, t):
Expand Down

0 comments on commit ea91786

Please sign in to comment.