org.elasticsearch.common.io.stream.NamedWriteable, org.elasticsearch.common.io.stream.Writeable, org.elasticsearch.common.xcontent.ToXContent, EvaluationMetricpublic class PrecisionAtK extends java.lang.Object implements EvaluationMetric
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
NAME |
| Constructor | Description |
|---|---|
PrecisionAtK() |
|
PrecisionAtK(int threshold,
boolean ignoreUnlabeled,
int k) |
Metric implementing Precision@K.
|
| 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) |
Compute precisionAtN based on provided relevant document IDs.
|
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 PrecisionAtK |
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) |
|
boolean |
getIgnoreUnlabeled() |
Gets the 'ignore_unlabeled' parameter.
|
int |
getRelevantRatingThreshold() |
Return the rating threshold above which ratings are considered to be
"relevant" for this metric.
|
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) |
combine, filterUnknownDocuments, joinHitsWithRatingspublic static final java.lang.String NAME
public PrecisionAtK(int threshold,
boolean ignoreUnlabeled,
int k)
threshold - 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 accountpublic PrecisionAtK()
public void writeTo(org.elasticsearch.common.io.stream.StreamOutput out)
throws java.io.IOException
writeTo in interface org.elasticsearch.common.io.stream.Writeablejava.io.IOExceptionpublic java.lang.String getWriteableName()
getWriteableName in interface org.elasticsearch.common.io.stream.NamedWriteablepublic int getRelevantRatingThreshold()
public boolean getIgnoreUnlabeled()
public java.util.Optional<java.lang.Integer> forcedSearchSize()
EvaluationMetricforcedSearchSize in interface EvaluationMetricpublic static PrecisionAtK fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
public EvalQueryQuality evaluate(java.lang.String taskId, org.elasticsearch.search.SearchHit[] hits, java.util.List<RatedDocument> ratedDocs)
evaluate in interface EvaluationMetrictaskId - the id of the query for which the ranking is currently evaluatedhits - the result hits as returned by a search requestratedDocs - the documents that were ranked by human annotators for this query
caseSearchResult list.public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder,
org.elasticsearch.common.xcontent.ToXContent.Params params)
throws java.io.IOException
toXContent in interface org.elasticsearch.common.xcontent.ToXContentjava.io.IOExceptionpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Object