Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
xgboost::ltr Namespace Reference

Copyright 2023 by XGBoost contributors. More...

Data Structures

struct  LambdaRankParam
 
class  MAPCache
 
class  NDCGCache
 
class  PreCache
 
class  RankingCache
 Common cached items for ranking tasks. More...
 

Typedefs

using rel_degree_t = std::uint32_t
 Relevance degree.
 
using position_t = std::uint32_t
 top-k position
 

Enumerations

enum class  PairMethod : std::int32_t { kTopK = 0 , kMean = 1 }
 

Functions

 DMLC_REGISTER_PARAMETER (LambdaRankParam)
 
std::string ParseMetricName (StringView name, StringView param, position_t *topn, bool *minus)
 Parse name for ranking metric given parameters.
 
std::string MakeMetricName (StringView name, position_t topn, bool minus)
 Parse name for ranking metric given parameters.
 
constexpr std::size_t MaxRel ()
 Maximum relevance degree for NDCG.
 
XGBOOST_DEVICE double CalcDCGGain (rel_degree_t label)
 
XGBOOST_DEVICE double CalcDCGDiscount (std::size_t idx)
 
XGBOOST_DEVICE double CalcInvIDCG (double idcg)
 
template<typename NoneOf >
void CheckNDCGLabels (ltr::LambdaRankParam const &p, linalg::VectorView< float const > labels, NoneOf none_of)
 Validate label for NDCG.
 
template<typename AllOf >
bool IsBinaryRel (linalg::VectorView< float const > label, AllOf all_of)
 
template<typename AllOf >
void CheckPreLabels (StringView name, linalg::VectorView< float const > label, AllOf all_of)
 Validate label for precision-based metric.
 
 TEST (RankingUtils, LambdaRankParam)
 
 TEST (RankingUtils, ParseMetricName)
 
 TEST (RankingUtils, MakeMetricName)
 
void TestRankingCache (Context const *ctx)
 
 TEST (RankingCache, InitFromCPU)
 
void TestNDCGCache (Context const *ctx)
 
 TEST (NDCGCache, InitFromCPU)
 
void TestMAPCache (Context const *ctx)
 
 TEST (MAPCache, InitFromCPU)
 

Detailed Description

Copyright 2023 by XGBoost contributors.

Copyright 2023 by XGBoost Contributors.

Function Documentation

◆ CheckNDCGLabels()

template<typename NoneOf >
void xgboost::ltr::CheckNDCGLabels ( ltr::LambdaRankParam const &  p,
linalg::VectorView< float const >  labels,
NoneOf  none_of 
)

Validate label for NDCG.

Template Parameters
NoneOfImplementation of std::none_of. Specified as a parameter to reuse the check for both CPU and GPU.

◆ CheckPreLabels()

template<typename AllOf >
void xgboost::ltr::CheckPreLabels ( StringView  name,
linalg::VectorView< float const >  label,
AllOf  all_of 
)

Validate label for precision-based metric.

Template Parameters
Implementationof std::all_of. Specified as a parameter to reuse the check for both CPU and GPU.

◆ ParseMetricName()

std::string xgboost::ltr::ParseMetricName ( StringView  name,
StringView  param,
position_t topn,
bool *  minus 
)

Parse name for ranking metric given parameters.

Parameters
[in]nameNull terminated string for metric name
[in]paramNull terminated string for parameter like the 3- in ndcg@3-.
[out]topnTop n documents parsed from param. Unchanged if it's not specified.
[out]minusWhether we should turn the score into loss. Unchanged if it's not specified.
Returns
The name of the metric.