Set ndcg to default for LTR. (#8822)

- Add document.
- Add tests.
- Use `ndcg` with `topk` as default.
This commit is contained in:
Jiaming Yuan
2023-06-09 23:31:33 +08:00
committed by GitHub
parent e4dd6051a0
commit 1fcc26a6f8
18 changed files with 842 additions and 19 deletions

View File

@@ -130,11 +130,11 @@ def test_ranking():
params = {
"tree_method": "exact",
"objective": "rank:pairwise",
"learning_rate": 0.1,
"gamma": 1.0,
"min_child_weight": 0.1,
"max_depth": 6,
"eval_metric": "ndcg",
"n_estimators": 4,
}
model = xgb.sklearn.XGBRanker(**params)
@@ -163,7 +163,6 @@ def test_ranking():
"gamma": 1.0,
"min_child_weight": 0.1,
"max_depth": 6,
"eval_metric": "ndcg",
}
xgb_model_orig = xgb.train(
params_orig, train_data, num_boost_round=4, evals=[(valid_data, "validation")]