Commit 1a1c2fd7 authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

use stable_sort for splits (#2169)

parent abbbbd75
...@@ -190,7 +190,7 @@ void VotingParallelTreeLearner<TREELEARNER_T>::GlobalVoting(int leaf_idx, const ...@@ -190,7 +190,7 @@ void VotingParallelTreeLearner<TREELEARNER_T>::GlobalVoting(int leaf_idx, const
// get top k // get top k
std::vector<LightSplitInfo> top_k_splits; std::vector<LightSplitInfo> top_k_splits;
ArrayArgs<LightSplitInfo>::MaxK(feature_best_split, top_k_, &top_k_splits); ArrayArgs<LightSplitInfo>::MaxK(feature_best_split, top_k_, &top_k_splits);
std::sort(top_k_splits.begin(), top_k_splits.end(), std::greater<LightSplitInfo>()); std::stable_sort(top_k_splits.begin(), top_k_splits.end(), std::greater<LightSplitInfo>());
for (auto& split : top_k_splits) { for (auto& split : top_k_splits) {
if (split.gain == kMinScore || split.feature == -1) { if (split.gain == kMinScore || split.feature == -1) {
continue; continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment