"vscode:/vscode.git/clone" did not exist on "8fd7e185e62032395d8ff4434402ad69ec56b7d2"
Commit 0f224c05 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix a bug in WeightedPercentile function.

parent 2204e45f
......@@ -48,8 +48,8 @@ namespace LightGBM {
}\
double threshold = weighted_cdf[cnt_data - 1] * alpha;\
size_t pos = std::upper_bound(weighted_cdf.begin(), weighted_cdf.end(), threshold) - weighted_cdf.begin();\
if (pos == 0) {\
return data_reader(sorted_idx[0]);\
if (pos == 0 || pos == cnt_data - 1) {\
return data_reader(sorted_idx[pos]);\
}\
CHECK(threshold >= weighted_cdf[pos - 1]);\
CHECK(threshold < weighted_cdf[pos]);\
......
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