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 10:55:34 UTC

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

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


##########
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:
   Do you mean that we use `rdd` as a private variable whose type is `RDD[(Array[T], Array[T], Array[Double])]`, and keep other methods almost the same ? 



##########
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:
   Do you mean that we use `rdd` as a private variable whose type is `RDD[(Array[T], Array[T], Array[Double])]`, and keep other methods almost the same? 



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