回答編集履歴

2

もう一度修正

2017/07/30 11:08

投稿

MasashiKimura
MasashiKimura

スコア1150

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  out = th.tensor.nnet.softmax(x.dot(W) + b)
6
6
 
7
- xent = -y * th.tensor.log(out + 1e-8)
7
+ xent = -(1-y) * th.tensor.log(1-out + 1e-8)
8
8
 
9
9
  loss = xent.mean()
10
10
 

1

クロスエントロピーの式を修正

2017/07/30 11:08

投稿

MasashiKimura
MasashiKimura

スコア1150

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  out = th.tensor.nnet.softmax(x.dot(W) + b)
6
6
 
7
- xent = -y * th.tensor.log(out + 1e-8) - (1-y) * th.tensor.log(1-out + 1e-8)
7
+ xent = -y * th.tensor.log(out + 1e-8)
8
8
 
9
9
  loss = xent.mean()
10
10