diff options
author | Xusen Yin <yinxusen@gmail.com> | 2014-01-06 12:30:17 +0800 |
---|---|---|
committer | Xusen Yin <yinxusen@gmail.com> | 2014-01-06 12:30:17 +0800 |
commit | a72107284ae4d8b6c7c47ded31c6784732028603 (patch) | |
tree | 424fe3d876aa34e89da2edc7db8f57f965269632 | |
parent | f4b924f6623525d0f9287039b963fd5f7eaf1a7d (diff) | |
download | spark-a72107284ae4d8b6c7c47ded31c6784732028603.tar.gz spark-a72107284ae4d8b6c7c47ded31c6784732028603.tar.bz2 spark-a72107284ae4d8b6c7c47ded31c6784732028603.zip |
fix logistic loss bug
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala b/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala index 749e7364f4..c590492e7a 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala @@ -50,8 +50,8 @@ class LogisticGradient extends Gradient { val gradient = data.mul(gradientMultiplier) val loss = - if (margin > 0) { - math.log(1 + math.exp(0 - margin)) + if (label > 0) { + math.log(1 + math.exp(margin)) } else { math.log(1 + math.exp(margin)) - margin } |