Commit b7a61c32 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix #1994

parent 90127b52
...@@ -58,7 +58,11 @@ namespace LightGBM { ...@@ -58,7 +58,11 @@ namespace LightGBM {
CHECK(threshold < weighted_cdf[pos]);\ CHECK(threshold < weighted_cdf[pos]);\
T v1 = data_reader(sorted_idx[pos - 1]);\ T v1 = data_reader(sorted_idx[pos - 1]);\
T v2 = data_reader(sorted_idx[pos]);\ T v2 = data_reader(sorted_idx[pos]);\
return static_cast<T>((threshold - weighted_cdf[pos]) / (weighted_cdf[pos + 1] - weighted_cdf[pos]) * (v2 - v1) + v1);\ if(weighted_cdf[pos + 1] - weighted_cdf[pos] > kEpsilon){\
return static_cast<T>((threshold - weighted_cdf[pos]) / (weighted_cdf[pos + 1] - weighted_cdf[pos]) * (v2 - v1) + v1); \
} else {\
return static_cast<T>(v2);\
}\
}\ }\
/*! /*!
......
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