4#ifndef XGBOOST_OBJECTIVE_TEST_LAMBDARANK_OBJ_H_
5#define XGBOOST_OBJECTIVE_TEST_LAMBDARANK_OBJ_H_
6#include <gtest/gtest.h>
16#include "../../../src/common/ranking_utils.h"
17#include "../../../src/objective/lambdarank_obj.h"
18#include "../helpers.h"
21void TestMAPStat(Context
const* ctx);
23inline void TestNDCGJsonIO(Context
const* ctx) {
26 obj->Configure(Args{});
28 obj->SaveConfig(&j_obj);
30 ASSERT_EQ(get<String>(j_obj[
"name"]),
"rank:ndcg");
31 auto const& j_param = j_obj[
"lambdarank_param"];
33 ASSERT_EQ(get<String>(j_param[
"ndcg_exp_gain"]),
"1");
34 ASSERT_EQ(get<String>(j_param[
"lambdarank_num_pair_per_sample"]),
35 std::to_string(ltr::LambdaRankParam::NotSet()));
38void TestNDCGGPair(Context
const* ctx);
40void TestUnbiasedNDCG(Context
const* ctx);
42void TestMAPGPair(Context
const* ctx);
47void InitMakePairTest(Context
const* ctx, MetaInfo* out_info, HostDeviceVector<float>* out_predt);
static ObjFunction * Create(const std::string &name, Context const *ctx)
Create an objective function according to name.
Definition objective.cc:20
A device-and-host vector abstraction layer.
Copyright 2015-2023 by XGBoost Contributors.
Copyright 2021-2023 by XGBoost Contributors.
Copyright 2022-2023 by XGBoost contributors.
Definition custom_obj.cc:13
void InitMakePairTest(Context const *ctx, MetaInfo *out_info, HostDeviceVector< float > *out_predt)
Initialize test data for make pair tests.
Definition test_lambdarank_obj.cc:148
Copyright 2014-2023 by XGBoost Contributors.