Class ExpectedReciprocalRank

java.lang.Object
org.elasticsearch.index.rankeval.ExpectedReciprocalRank
All Implemented Interfaces:
org.elasticsearch.common.io.stream.NamedWriteable, org.elasticsearch.common.io.stream.Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.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

  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  ExpectedReciprocalRank.Detail  

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    org.elasticsearch.common.io.stream.Writeable.Reader<V extends java.lang.Object>, org.elasticsearch.common.io.stream.Writeable.Writer<V extends java.lang.Object>
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String NAME  

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor Description
    ExpectedReciprocalRank​(int maxRelevance)  
    ExpectedReciprocalRank​(int maxRelevance, java.lang.Integer unknownDocRating, int k)  
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object obj)  
    EvalQueryQuality evaluate​(java.lang.String taskId, org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)
    Evaluates a single ranking evaluation case.
    java.util.OptionalInt forcedSearchSize()
    Metrics can define a size of the search hits windows they want to retrieve by overwriting this method.
    static ExpectedReciprocalRank fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)  
    java.lang.Integer getUnknownDocRating()
    get the rating used for unrated documents
    java.lang.String getWriteableName()  
    int hashCode()  
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    void writeTo​(org.elasticsearch.common.io.stream.StreamOutput out)  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.index.rankeval.EvaluationMetric

    combine

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Field Details

  • Constructor Details

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

    • writeTo

      public void writeTo​(org.elasticsearch.common.io.stream.StreamOutput out) throws java.io.IOException
      Specified by:
      writeTo in interface org.elasticsearch.common.io.stream.Writeable
      Throws:
      java.io.IOException
    • getWriteableName

      public java.lang.String getWriteableName()
      Specified by:
      getWriteableName in interface org.elasticsearch.common.io.stream.NamedWriteable
    • 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, org.elasticsearch.search.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
    • fromXContent

      public static ExpectedReciprocalRank fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • 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