srowen commented on a change in pull request #23881: [SPARK-26981][MLlib] Add
'Recall_at_k' metric to RankingMetrics
URL: https://github.com/apache/spark/pull/23881#discussion_r259622126
##########
File path:
mllib/src/main/scala/org/apache/spark/mllib/evaluation/RankingMetrics.scala
##########
@@ -157,6 +157,46 @@ class RankingMetrics[T: ClassTag](predictionAndLabels:
RDD[(Array[T], Array[T])]
}.mean()
}
+ /**
+ * Compute the average recall of all the queries, truncated at ranking
position k.
+ *
+ * If for a query, the ranking algorithm returns n results, the recall
value will be
+ * computed as #(relevant items retrieved) / #(ground truth set). This
formula
+ * also applies when the size of the ground truth set is less than k.
+ *
+ * If a query has an empty ground truth set, zero will be used as recall
together with
+ * a log warning.
+ *
+ * See the following paper for detail:
+ *
+ * IR evaluation methods for retrieving highly relevant documents. K.
Jarvelin and J. Kekalainen
+ *
+ * @param k the position to compute the truncated recall, must be positive
+ * @return the average recall at the first k ranking positions
+ */
+ @Since("2.5.0")
Review comment:
There is no 2.5.0; this would have to be 3.0.0
----------------------------------------------------------------
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]