Fix issue introduced from correction to log2 (#1837)

https://github.com/dmlc/xgboost/pull/1642
This commit is contained in:
JohnStott 2016-12-04 19:11:56 +00:00 committed by Tianqi Chen
parent a44032d095
commit 1683e07461

View File

@ -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<int>(sorted_list[pos_idx].label);
int neg_label = static_cast<int>(sorted_list[neg_idx].label);
bst_float original =