You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/20 07:38:24 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #36920: [SPARK-39446][MLLIB][FOLLOWUP] Modify constructor of RankingMetrics class

zhengruifeng commented on code in PR #36920:
URL: https://github.com/apache/spark/pull/36920#discussion_r901346286


##########
mllib/src/main/scala/org/apache/spark/mllib/evaluation/RankingMetrics.scala:
##########
@@ -70,9 +62,14 @@ class RankingMetrics[T: ClassTag] @Since("3.4.0") (
   @Since("1.2.0")
   def precisionAt(k: Int): Double = {
     require(k > 0, "ranking position k should be positive")
-    predictionAndLabels.map { case (pred, lab, _) =>
-      countRelevantItemRatio(pred, lab, k, k)
-    }.mean()
+    predictionAndLabels

Review Comment:
   I think we may create a private rdd, and than use it internally to minimize changes.
   
   something like this:
   ```
   private val rdd = predictionAndLabels.map {
       case (pred: Array[T], lab: Array[T]) => ...
       case (pred: Array[T], lab: Array[T], rel: Array[Double]) => ...
   }
   
   ```



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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