Package org.opensearch.index.rankeval
Class ExpectedReciprocalRank
java.lang.Object
org.opensearch.index.rankeval.ExpectedReciprocalRank
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentObject,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 ClassesNested classes/interfaces inherited from interface org.opensearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.common.io.stream.Writeable
Writeable.Reader<V extends Object>, Writeable.Writer<V extends Object> -
Field Summary
FieldsFields inherited from interface org.opensearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionExpectedReciprocalRank(int maxRelevance) ExpectedReciprocalRank(int maxRelevance, Integer unknownDocRating, int k) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanevaluate(String taskId, SearchHit[] hits, List<RatedDocument> ratedDocs) Evaluates a single ranking evaluation case.Metrics can define a size of the search hits windows they want to retrieve by overwriting this method.static ExpectedReciprocalRankfromXContent(XContentParser parser) get the rating used for unrated documentsfinal inthashCode()toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.index.rankeval.EvaluationMetric
combineMethods inherited from interface org.opensearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
ExpectedReciprocalRank
public ExpectedReciprocalRank(int maxRelevance) - Parameters:
maxRelevance- the highest expected relevance in the data
-
ExpectedReciprocalRank
- Parameters:
maxRelevance- the maximal relevance judgment in the evaluation datasetunknownDocRating- the rating for documents the user hasn't supplied an explicit rating for. Can benull, in which case document is skipped.k- the search window size all request use.
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
getUnknownDocRating
get the rating used for unrated documents -
forcedSearchSize
Description copied from interface:EvaluationMetricMetrics 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:
forcedSearchSizein interfaceEvaluationMetric- Returns:
- the number of search hits this metrics requests
-
evaluate
Description copied from interface:EvaluationMetricEvaluates a single ranking evaluation case.- Specified by:
evaluatein interfaceEvaluationMetric- Parameters:
taskId- an identifier of the query for which the search ranking is evaluatedhits- the search result hitsratedDocs- the documents that contain the document rating for this query case- Returns:
- an
EvalQueryQualityinstance that contains the metric score with respect to the provided search hits and ratings
-
fromXContent
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
equals
-
hashCode
public final int hashCode()
-