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

    https://github.com/apache/spark/pull/7652#discussion_r35773166
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala ---
    @@ -127,10 +128,16 @@ final class OneVsRestModel private[ml] (
           predictions.maxBy(_._2)._1.toDouble
         }
     
    +    // output the index of the classifier with highest confidence as 
prediction
    +    val probabilityUDF = udf { (predictions: Map[Int, Double]) =>
    +      predictions.maxBy(_._2)._2.toDouble
    +    }
    +
         // output label and label metadata as prediction
         aggregatedDataset
           .withColumn($(predictionCol), 
labelUDF(col(accColName)).as($(predictionCol), labelMetadata))
    -      .drop(accColName)
    +      .withColumn($(rawPredictionCol), 
probabilityUDF(col(accColName)).as($(rawPredictionCol),
    +      labelMetadata)).drop(accColName)
       }
    --- End diff --
    
    Adding the max confidence factor as output column.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to