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

    https://github.com/apache/spark/pull/10472#discussion_r48993085
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala
 ---
    @@ -79,13 +79,14 @@ class BinaryClassificationEvaluator @Since("1.4.0") 
(@Since("1.4.0") override va
       @Since("1.2.0")
       override def evaluate(dataset: DataFrame): Double = {
         val schema = dataset.schema
    -    SchemaUtils.checkColumnType(schema, $(rawPredictionCol), new VectorUDT)
    +    SchemaUtils.checkColumnTypes(schema, $(rawPredictionCol), 
Seq(DoubleType, new VectorUDT))
         SchemaUtils.checkColumnType(schema, $(labelCol), DoubleType)
     
         // TODO: When dataset metadata has been implemented, check 
rawPredictionCol vector length = 2.
         val scoreAndLabels = dataset.select($(rawPredictionCol), $(labelCol))
    -      .map { case Row(rawPrediction: Vector, label: Double) =>
    -        (rawPrediction(1), label)
    +      .map {
    +        case Row(rawPrediction: Vector, label: Double) => 
(rawPrediction(1), label)
    +        case Row(rawPrediction: Double, label: Double) => (rawPrediction, 
label)
    --- End diff --
    
    there is a small loss of performance because a conditional branch is 
introduced here, but I believe the cost of unpacking the row is much higher 
anyway.


---
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