Skip to content

Commit

Permalink
Better tie-breaking: favor lower featureID, kLeftDir
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Sep 15, 2021
1 parent ce86fdc commit 7b8bf95
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tree/gpu_hist/evaluate_splits.cu
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ void EvaluateSplits(common::Span<DeviceSplitCandidate> out_splits,
reduce_val, thrust::make_discard_iterator(), out_reduce.data(),
thrust::equal_to<int>{},
[param] __device__(DeviceSplitCandidate l, DeviceSplitCandidate r) {
if (l.loss_chg == r.loss_chg
&& l.left_sum.GetHess() >= param.min_child_weight
&& l.right_sum.GetHess() >= param.min_child_weight
&& r.left_sum.GetHess() >= param.min_child_weight
&& r.right_sum.GetHess() >= param.min_child_weight) {
// tie-breaking logic
// 1. Favor lower feature ID
if (l.findex != r.findex) {
return (l.findex < r.findex) ? l : r;
}
// 2. If using same feature ID, favor kLeftDir direction
if (l.dir == DefaultDirection::kLeftDir) {
return l;
}
if (r.dir == DefaultDirection::kLeftDir) {
return r;
}
}
l.Update(r, param);
return l;
});
Expand Down

0 comments on commit 7b8bf95

Please sign in to comment.