-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Open
Labels
Description
delta_metric have been introduced from version 2 refactoring:
xgboost/src/objective/lambdarank_obj.h
Lines 111 to 126 in 600be4d
| // Use double whenever possible as we are working on the exp space. | |
| double delta_score = std::abs(s_high - s_low); | |
| double const sigmoid = common::Sigmoid(s_high - s_low); | |
| // Change in metric score like \delta NDCG or \delta MAP | |
| double delta_metric = std::abs(delta(y_high, y_low, rank_high, rank_low)); | |
| if (best_score != worst_score) { | |
| delta_metric /= (delta_score + 0.01); | |
| } | |
| if (unbiased) { | |
| *p_cost = std::log(1.0 / (1.0 - sigmoid)) * delta_metric; | |
| } | |
| auto lambda_ij = (sigmoid - 1.0) * delta_metric; | |
| auto hessian_ij = std::max(sigmoid * (1.0 - sigmoid), Eps64()) * delta_metric * 2.0; |
respect the way of computing gradient and hessians in 1.7 versions:
xgboost/src/objective/rank_obj.cu
Lines 876 to 892 in 36eb41c
| LambdaWeightComputerT::GetLambdaWeight(lst, &pairs); | |
| // rescale each gradient and hessian so that the lst have constant weighted | |
| float scale = 1.0f / param_.num_pairsample; | |
| if (param_.fix_list_weight != 0.0f) { | |
| scale *= param_.fix_list_weight / (gptr[k + 1] - gptr[k]); | |
| } | |
| for (auto & pair : pairs) { | |
| const ListEntry &pos = lst[pair.pos_index]; | |
| const ListEntry &neg = lst[pair.neg_index]; | |
| const bst_float w = pair.weight * scale; | |
| const float eps = 1e-16f; | |
| bst_float p = common::Sigmoid(pos.pred - neg.pred); | |
| bst_float g = p - 1.0f; | |
| bst_float h = std::max(p * (1.0f - p), eps); | |
| // accumulate gradient and hessian in both pid, and nid | |
| gpair[pos.rindex] += GradientPair(g * w, 2.0f*w*h); | |
| gpair[neg.rindex] += GradientPair(-g * w, 2.0f*w*h); |
Where is defined delta and which is its default value in master version?
My cases of use don't need any delta function to overweight top elements of each query as I'm optimizing spearman correlation of the whole query.
I would like not use delta function to weight pairs.
Is possible disable it or set to identity function?