package modelkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Modelkit.Ranking_metrics

Discounted cumulative gain over per-row graded relevance.

Each row of relevance holds finite non-negative gains for the row's items and each row of scores holds the ranking scores; both matrices share one shape with at least two columns. Rank r receives discount 1 / log2 (r + 2), and k zeroes discounts from rank k onward. By default tied scores share the mean gain of their group times the group's summed discount, following McSherry and Najork; ignore_ties instead ranks tied items by descending column index as scikit-learn's reversed stable sort does. NDCG divides each row by its ideal DCG and scores an all-zero row as zero. Both metrics average rows by sample weight and cost O(rows * columns log columns).

val dcg : ?k:int -> ?ignore_ties:bool -> ?sample_weight:Sample_weight.t -> relevance:Matrix.t -> scores:Matrix.t -> unit -> (float, Error.t) result
val ndcg : ?k:int -> ?ignore_ties:bool -> ?sample_weight:Sample_weight.t -> relevance:Matrix.t -> scores:Matrix.t -> unit -> (float, Error.t) result