srowen commented on a change in pull request #24717: [SPARK-27847][ML] One-Pass 
MultilabelMetrics & MulticlassMetrics
URL: https://github.com/apache/spark/pull/24717#discussion_r288141438
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/mllib/evaluation/MultilabelMetrics.scala
 ##########
 @@ -142,17 +124,17 @@ class MultilabelMetrics @Since("1.2.0") 
(predictionAndLabels: RDD[(Array[Double]
     if((p + r) == 0) 0.0 else 2 * p * r / (p + r)
   }
 
-  private lazy val sumTp = tpPerClass.foldLeft(0L) { case (sum, (_, tp)) => 
sum + tp }
-  private lazy val sumFpClass = fpPerClass.foldLeft(0L) { case (sum, (_, fp)) 
=> sum + fp }
-  private lazy val sumFnClass = fnPerClass.foldLeft(0L) { case (sum, (_, fn)) 
=> sum + fn }
+  private lazy val sumTp = summary.tpPerClass.foldLeft(0L) { case (sum, (_, 
tp)) => sum + tp }
 
 Review comment:
   I wonder why these use `foldLeft`? isn't it just a sum over values in the 
map, like `summary.tpPerClass.values.sum`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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