Class PrecisionAtK

java.lang.Object
org.opensearch.index.rankeval.PrecisionAtK
All Implemented Interfaces:
NamedWriteable, Writeable, ToXContent, ToXContentObject, EvaluationMetric

public class PrecisionAtK extends Object implements EvaluationMetric
Metric implementing Precision@K (https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Precision).
By default documents with a rating equal or bigger than 1 are considered to be "relevant" for this calculation. This value can be changed using the `relevant_rating_threshold` parameter.
The `ignore_unlabeled` parameter (default to false) controls if unrated documents should be ignored. The `k` parameter (defaults to 10) controls the search window size.
  • Field Details

  • Constructor Details

    • PrecisionAtK

      public PrecisionAtK(int relevantRatingThreshold, boolean ignoreUnlabeled, int k)
      Metric implementing Precision@K.
      Parameters:
      relevantRatingThreshold - ratings equal or above this value will be considered relevant.
      ignoreUnlabeled - Controls how unlabeled documents in the search hits are treated. Set to 'true', unlabeled documents are ignored and neither count as true or false positives. Set to 'false', they are treated as false positives.
      k - controls the window size for the search results the metric takes into account
    • PrecisionAtK

      public PrecisionAtK(boolean ignoreUnlabeled)
    • PrecisionAtK

      public PrecisionAtK()
  • Method Details