Github user MLnick commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12500#discussion_r60602008
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/evaluation/RegressionEvaluator.scala 
---
    @@ -74,21 +74,14 @@ final class RegressionEvaluator @Since("1.4.0") 
(@Since("1.4.0") override val ui
       @Since("2.0.0")
       override def evaluate(dataset: Dataset[_]): Double = {
         val schema = dataset.schema
    -    val predictionColName = $(predictionCol)
    -    val predictionType = schema($(predictionCol)).dataType
    -    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,
    -      s"Label column $labelColName must be of type float or double, but 
not $labelType")
    +    SchemaUtils.checkColumnTypes(schema, $(predictionCol), Seq(DoubleType, 
FloatType))
    +    SchemaUtils.checkNumericType(schema, $(labelCol))
     
         val predictionAndLabels = dataset
           .select(col($(predictionCol)).cast(DoubleType), 
col($(labelCol)).cast(DoubleType))
    -      .rdd.
    -      map { case Row(prediction: Double, label: Double) =>
    -        (prediction, label)
    +      .rdd
    +      .map {
    +        case Row(prediction: Double, label: Double) => (prediction, label)
    --- End diff --
    
    minor but can this fit on one line? or have `.map { case Row ... }`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to