imatiach-msft commented on a change in pull request #17084: 
[SPARK-24103][ML][MLLIB] ML Evaluators should use weight column - added weight 
column for binary classification evaluator
URL: https://github.com/apache/spark/pull/17084#discussion_r257890293
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/mllib/evaluation/BinaryClassificationMetrics.scala
 ##########
 @@ -146,11 +164,13 @@ class BinaryClassificationMetrics @Since("1.3.0") (
   private lazy val (
     cumulativeCounts: RDD[(Double, BinaryLabelCounter)],
     confusions: RDD[(Double, BinaryConfusionMatrix)]) = {
-    // Create a bin for each distinct score value, count positives and 
negatives within each bin,
-    // and then sort by score values in descending order.
-    val counts = scoreAndLabels.combineByKey(
-      createCombiner = (label: Double) => new BinaryLabelCounter(0L, 0L) += 
label,
-      mergeValue = (c: BinaryLabelCounter, label: Double) => c += label,
+    // Create a bin for each distinct score value, count weighted positives and
+    // negatives within each bin, and then sort by score values in descending 
order.
+    val counts = scoreLabelsWeight.combineByKey(
+      createCombiner = (labelAndWeight: (Double, Double)) =>
+        new BinaryLabelCounter(0.0, 0.0) += (labelAndWeight._1, 
labelAndWeight._2),
 
 Review comment:
   sorry, I just noticed this was causing the test failures and actually won't 
work - please see the class BinaryLabelCounter.scala.  The two values we init 
it with are actually weightedNumPositives and weightedNumNegatives.  When we do 
+= (val1, val2), that operator is overloaded and it is actually taking a label 
and weight.  So they are not actually the same.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to