spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbrad...@apache.org
Subject spark git commit: [SPARK-11343][ML] Documentation of float and double prediction/label columns in RegressionEvaluator
Date Wed, 09 Dec 2015 02:54:27 GMT
Repository: spark
Updated Branches:
  refs/heads/branch-1.6 b1d5a7859 -> 9e82273af


[SPARK-11343][ML] Documentation of float and double prediction/label columns in RegressionEvaluator

felixcheung , mengxr

Just added a message to require()

Author: Dominik Dahlem <dominik.dahlem@gmail.combination>

Closes #9598 from dahlem/ddahlem_regression_evaluator_double_predictions_message_04112015.

(cherry picked from commit a0046e379bee0852c39ece4ea719cde70d350b0e)
Signed-off-by: Joseph K. Bradley <joseph@databricks.com>


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

Branch: refs/heads/branch-1.6
Commit: 9e82273afc68947dc2a08315e0d42cfcedacaa2a
Parents: b1d5a78
Author: Dominik Dahlem <dominik.dahlem@gmail.com>
Authored: Tue Dec 8 18:54:10 2015 -0800
Committer: Joseph K. Bradley <joseph@databricks.com>
Committed: Tue Dec 8 18:54:23 2015 -0800

----------------------------------------------------------------------
 .../apache/spark/ml/evaluation/RegressionEvaluator.scala    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9e82273a/mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala
b/mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala
index daaa174..b6b25ec 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala
@@ -73,10 +73,15 @@ final class RegressionEvaluator @Since("1.4.0") (@Since("1.4.0") override
val ui
   @Since("1.4.0")
   override def evaluate(dataset: DataFrame): Double = {
     val schema = dataset.schema
+    val predictionColName = $(predictionCol)
     val predictionType = schema($(predictionCol)).dataType
-    require(predictionType == FloatType || predictionType == DoubleType)
+    require(predictionType == FloatType || predictionType == DoubleType,
+      s"Prediction column $predictionColName must be of type float or double, " +
+        s" but not $predictionType")
+    val labelColName = $(labelCol)
     val labelType = schema($(labelCol)).dataType
-    require(labelType == FloatType || labelType == DoubleType)
+    require(labelType == FloatType || labelType == DoubleType,
+      s"Label column $labelColName must be of type float or double, but not $labelType")
 
     val predictionAndLabels = dataset
       .select(col($(predictionCol)).cast(DoubleType), col($(labelCol)).cast(DoubleType))


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


Mime
View raw message