Class DiscountedCumulativeGain

    • Constructor Detail

      • DiscountedCumulativeGain

        public DiscountedCumulativeGain()
      • DiscountedCumulativeGain

        public DiscountedCumulativeGain​(boolean normalize,
                                        java.lang.Integer unknownDocRating,
                                        int k)
        Parameters:
        normalize - If set to true, dcg will be normalized (ndcg) See https://en.wikipedia.org/wiki/Discounted_cumulative_gain
        unknownDocRating - the rating for documents the user hasn't supplied an explicit rating for
        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.Optional<java.lang.Integer> 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