spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject spark git commit: [SPARK-7694] [MLLIB] Use getOrElse for getting the threshold of LR model
Date Mon, 18 May 2015 04:16:56 GMT
Repository: spark
Updated Branches:
  refs/heads/master ff71d34e0 -> 775e6f990


[SPARK-7694] [MLLIB] Use getOrElse for getting the threshold of LR model

The `toString` method of `LogisticRegressionModel` calls `get` method on an Option (threshold)
without a safeguard. In spark-shell, the following code `val model = algorithm.run(data).clearThreshold()`
in lbfgs code will fail as `toString `method will be called right after `clearThreshold()`
to show the results in the REPL.

Author: Shuo Xiang <shuoxiangpub@gmail.com>

Closes #6224 from coderxiang/getorelse and squashes the following commits:

d5f53c9 [Shuo Xiang] use getOrElse for getting the threshold of LR model
5f109b4 [Shuo Xiang] Merge remote-tracking branch 'upstream/master'
c5c5bfe [Shuo Xiang] Merge remote-tracking branch 'upstream/master'
98804c9 [Shuo Xiang] fix bug in topBykey and update test


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/775e6f99
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/775e6f99
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/775e6f99

Branch: refs/heads/master
Commit: 775e6f9909d4495cbc11c377508b43482d782742
Parents: ff71d34
Author: Shuo Xiang <shuoxiangpub@gmail.com>
Authored: Sun May 17 21:16:52 2015 -0700
Committer: Xiangrui Meng <meng@databricks.com>
Committed: Sun May 17 21:16:52 2015 -0700

----------------------------------------------------------------------
 .../org/apache/spark/mllib/classification/LogisticRegression.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/775e6f99/mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
b/mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
index bd2e907..2df4d21 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
@@ -163,7 +163,7 @@ class LogisticRegressionModel (
   override protected def formatVersion: String = "1.0"
 
   override def toString: String = {
-    s"${super.toString}, numClasses = ${numClasses}, threshold = ${threshold.get}"
+    s"${super.toString}, numClasses = ${numClasses}, threshold = ${threshold.getOrElse("None")}"
   }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message