From 1683e074615494320e13f38eca3f5317e295455d Mon Sep 17 00:00:00 2001 From: JohnStott Date: Sun, 4 Dec 2016 19:11:56 +0000 Subject: [PATCH] Fix issue introduced from correction to log2 (#1837) https://github.com/dmlc/xgboost/pull/1642 --- src/objective/rank_obj.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective/rank_obj.cc b/src/objective/rank_obj.cc index 97a749b8d..f5776e025 100644 --- a/src/objective/rank_obj.cc +++ b/src/objective/rank_obj.cc @@ -196,8 +196,8 @@ class LambdaRankObjNDCG : public LambdaRankObj { for (size_t i = 0; i < pairs.size(); ++i) { unsigned pos_idx = pairs[i].pos_index; unsigned neg_idx = pairs[i].neg_index; - float pos_loginv = 1.0f / std::log(pos_idx + 2.0f); - float neg_loginv = 1.0f / std::log(neg_idx + 2.0f); + float pos_loginv = 1.0f / std::log2(pos_idx + 2.0f); + float neg_loginv = 1.0f / std::log2(neg_idx + 2.0f); int pos_label = static_cast(sorted_list[pos_idx].label); int neg_label = static_cast(sorted_list[neg_idx].label); bst_float original =