QuickRank
v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
|
This class implements the Normalized Discounted cumulative Gain NDCG@k measure. More...
#include <ndcg.h>
Public Member Functions | |
Ndcg (size_t k=NO_CUTOFF) | |
virtual | ~Ndcg () |
virtual std::string | name () const |
Returns the name of the metric. More... | |
virtual MetricScore | evaluate_result_list (const quickrank::data::QueryResults *rl, const Score *scores) const |
virtual std::unique_ptr< Jacobian > | jacobian (std::shared_ptr< data::RankedResults > ranked) const |
Computes the Jacobian matrix. More... | |
Public Member Functions inherited from quickrank::metric::ir::Dcg | |
Dcg (size_t k=NO_CUTOFF) | |
virtual | ~Dcg () |
Public Member Functions inherited from quickrank::metric::ir::Metric | |
Metric (size_t k=NO_CUTOFF) | |
Creates a new metric with the specified cut-off threshold. More... | |
virtual | ~Metric () |
size_t | cutoff () const |
Returns the current cut-off of the Metric. More... | |
void | set_cutoff (size_t k) |
Updates the cut-off of the Metric. More... | |
virtual MetricScore | evaluate_dataset (const std::shared_ptr< data::Dataset > dataset, const Score *scores) const |
virtual MetricScore | evaluate_dataset (const std::shared_ptr< data::VerticalDataset > dataset, const Score *scores) const |
Static Public Attributes | |
static const std::string | NAME_ = "NDCG" |
Static Public Attributes inherited from quickrank::metric::ir::Dcg | |
static const std::string | NAME_ = "DCG" |
Static Public Attributes inherited from quickrank::metric::ir::Metric | |
static const size_t | NO_CUTOFF = SIZE_MAX |
This should be used when no cut-off on the results list is required. More... | |
Protected Member Functions | |
MetricScore | compute_idcg (const quickrank::data::QueryResults *rl) const |
Computes the IDCG@K of a given list of labels. More... | |
Protected Member Functions inherited from quickrank::metric::ir::Dcg | |
MetricScore | compute_dcg (const Label *labels, size_t len) const |
Computes the DCG@K of a given array of labels. More... | |
Private Member Functions | |
virtual std::ostream & | put (std::ostream &os) const |
Prints the short name of the Metric, e.g., "NDCG@K". More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Ndcg &ndcg) |
This class implements the Normalized Discounted cumulative Gain NDCG@k measure.
NDCG is measured as: \( NDCG_k = \frac{1}{IDCG_k}\sum_{i=1}^k \frac{2^{l_i}-1}{\log_2 (i+1)}\), where \(l_i\) is the relevance label of the i-th document, and \(IDCG_k\) is the NDCG@K of a perfectly orderd result list.
|
inlineexplicit |
|
inlinevirtual |
|
protected |
Computes the IDCG@K of a given list of labels.
rl | The given results list. Only labels are actually used. |
|
virtual |
Make this choice available.
rl | A results list. |
scores | a list of scores |
Reimplemented from quickrank::metric::ir::Dcg.
Reimplemented in quickrank::metric::ir::Tndcg.
|
virtual |
Computes the Jacobian matrix.
This is a symmetric matrix storing the metric "decrease" when two documents scores are swapped.
rl | A results list. |
Reimplemented from quickrank::metric::ir::Dcg.
Reimplemented in quickrank::metric::ir::Tndcg.
|
inlinevirtual |
Returns the name of the metric.
Reimplemented from quickrank::metric::ir::Dcg.
Reimplemented in quickrank::metric::ir::Tndcg.
|
privatevirtual |
Prints the short name of the Metric, e.g., "NDCG@K".
Reimplemented from quickrank::metric::ir::Dcg.
Reimplemented in quickrank::metric::ir::Tndcg.
|
friend |
|
static |