Package org.elasticsearch.index.rankeval
Interface EvaluationMetric
-
- All Superinterfaces:
org.elasticsearch.common.io.stream.NamedWriteable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject,org.elasticsearch.common.io.stream.Writeable
- All Known Implementing Classes:
DiscountedCumulativeGain,ExpectedReciprocalRank,MeanReciprocalRank,PrecisionAtK
public interface EvaluationMetric extends org.elasticsearch.common.xcontent.ToXContentObject, org.elasticsearch.common.io.stream.NamedWriteableImplementations ofEvaluationMetricneed to provide a way to compute the quality metric for a result list returned by some search (@linkSearchHits) and a list of rated documents.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default doublecombine(java.util.Collection<EvalQueryQuality> partialResults)Combine severalEvalQueryQualityresults into the overall evaluation score.EvalQueryQualityevaluate(java.lang.String taskId, org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)Evaluates a single ranking evaluation case.static java.util.List<org.elasticsearch.index.rankeval.RatedDocument.DocumentKey>filterUnratedDocuments(java.util.List<RatedSearchHit> ratedHits)FilterRatedSearchHits that do not have a rating.default java.util.Optional<java.lang.Integer>forcedSearchSize()Metrics can define a size of the search hits windows they want to retrieve by overwriting this method.static java.util.List<RatedSearchHit>joinHitsWithRatings(org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)Joins hits with rated documents using the joint _index/_id document key.
-
-
-
Method Detail
-
evaluate
EvalQueryQuality evaluate(java.lang.String taskId, org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)
Evaluates a single ranking evaluation case.- 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
-
joinHitsWithRatings
static java.util.List<RatedSearchHit> joinHitsWithRatings(org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)
Joins hits with rated documents using the joint _index/_id document key.
-
filterUnratedDocuments
static java.util.List<org.elasticsearch.index.rankeval.RatedDocument.DocumentKey> filterUnratedDocuments(java.util.List<RatedSearchHit> ratedHits)
FilterRatedSearchHits that do not have a rating.
-
combine
default double combine(java.util.Collection<EvalQueryQuality> partialResults)
Combine severalEvalQueryQualityresults into the overall evaluation score. This defaults to averaging over the partial results, but can be overwritten to obtain a different behavior.
-
forcedSearchSize
default java.util.Optional<java.lang.Integer> forcedSearchSize()
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.- Returns:
- the number of search hits this metrics requests
-
-