Skip to content

Commit

Permalink
fix #1994
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Feb 3, 2019
1 parent 90127b5 commit b7a61c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/objective/regression_objective.hpp
Expand Up @@ -58,7 +58,11 @@ namespace LightGBM {
CHECK(threshold < weighted_cdf[pos]);\
T v1 = data_reader(sorted_idx[pos - 1]);\
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);\
}\
}\

/*!
Expand Down

0 comments on commit b7a61c3

Please sign in to comment.