Skip to content

Commit

Permalink
Use stable sort.
Browse files Browse the repository at this point in the history
  • Loading branch information
btrotta committed Aug 14, 2019
1 parent 5b21573 commit 2be599a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/io/bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace LightGBM {
if (num_to_insert > 0) {
bin_upper_bound.insert(bin_upper_bound.end(), forced_upper_bounds.begin(), forced_upper_bounds.begin() + num_to_insert);
}
std::sort(bin_upper_bound.begin(), bin_upper_bound.end());
std::stable_sort(bin_upper_bound.begin(), bin_upper_bound.end());

// find remaining bounds
std::vector<double> bounds_to_add;
Expand All @@ -238,7 +238,7 @@ namespace LightGBM {
bounds_to_add.insert(bounds_to_add.end(), new_upper_bounds.begin(), new_upper_bounds.end() - 1); // last bound is infinity
}
bin_upper_bound.insert(bin_upper_bound.end(), bounds_to_add.begin(), bounds_to_add.end());
std::sort(bin_upper_bound.begin(), bin_upper_bound.end());
std::stable_sort(bin_upper_bound.begin(), bin_upper_bound.end());
CHECK(bin_upper_bound.size() <= max_bin);
return bin_upper_bound;
}
Expand Down

0 comments on commit 2be599a

Please sign in to comment.