Class ExpectedReciprocalRank

  • All Implemented Interfaces:
    NamedWriteable, Writeable, ToXContent, ToXContentObject, EvaluationMetric

    public class ExpectedReciprocalRank
    extends java.lang.Object
    implements EvaluationMetric
    Implementation of the Expected Reciprocal Rank metric described in:

    Chapelle, O., Metlzer, D., Zhang, Y., & Grinspan, P. (2009).
    Expected reciprocal rank for graded relevance.
    Proceeding of the 18th ACM Conference on Information and Knowledge Management - CIKM ’09, 621.
    https://doi.org/10.1145/1645953.1646033

    • Constructor Detail

      • ExpectedReciprocalRank

        public ExpectedReciprocalRank​(int maxRelevance)
        Parameters:
        maxRelevance - the highest expected relevance in the data
      • ExpectedReciprocalRank

        public ExpectedReciprocalRank​(int maxRelevance,
                                      @Nullable
                                      java.lang.Integer unknownDocRating,
                                      int k)
        Parameters:
        maxRelevance - the maximal relevance judgment in the evaluation dataset
        unknownDocRating - the rating for documents the user hasn't supplied an explicit rating for. Can be null, in which case document is skipped.
        k - the search window size all request use.
    • Method Detail

      • writeTo

        public void writeTo​(StreamOutput out)
                     throws java.io.IOException
        Specified by:
        writeTo in interface Writeable
        Throws:
        java.io.IOException
      • getUnknownDocRating

        public java.lang.Integer getUnknownDocRating()
        get the rating used for unrated documents
      • forcedSearchSize

        public java.util.OptionalInt forcedSearchSize()
        Description copied from interface: EvaluationMetric
        Metrics can define a size of the search hits windows they want to retrieve by overwriting this method. The default implementation returns an empty optional.
        Specified by:
        forcedSearchSize in interface EvaluationMetric
        Returns:
        the number of search hits this metrics requests
      • evaluate

        public EvalQueryQuality evaluate​(java.lang.String taskId,
                                         SearchHit[] hits,
                                         java.util.List<RatedDocument> ratedDocs)
        Description copied from interface: EvaluationMetric
        Evaluates a single ranking evaluation case.
        Specified by:
        evaluate in interface EvaluationMetric
        Parameters:
        taskId - an identifier of the query for which the search ranking is evaluated
        hits - the search result hits
        ratedDocs - the documents that contain the document rating for this query case
        Returns:
        an EvalQueryQuality instance that contains the metric score with respect to the provided search hits and ratings
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object