Commit 6fac4702 authored by Guolin Ke's avatar Guolin Ke
Browse files

avoid NaN output.

parent 8a6bd5ec
...@@ -84,9 +84,9 @@ int Tree::Split(int leaf, int feature, BinType bin_type, uint32_t threshold_bin, ...@@ -84,9 +84,9 @@ int Tree::Split(int leaf, int feature, BinType bin_type, uint32_t threshold_bin,
// save current leaf value to internal node before change // save current leaf value to internal node before change
internal_value_[new_node_idx] = leaf_value_[leaf]; internal_value_[new_node_idx] = leaf_value_[leaf];
internal_count_[new_node_idx] = left_cnt + right_cnt; internal_count_[new_node_idx] = left_cnt + right_cnt;
leaf_value_[leaf] = left_value; leaf_value_[leaf] = std::isnan(left_value) ? 0.0f : left_value;
leaf_count_[leaf] = left_cnt; leaf_count_[leaf] = left_cnt;
leaf_value_[num_leaves_] = right_value; leaf_value_[num_leaves_] = std::isnan(right_value) ? 0.0f : right_value;
leaf_count_[num_leaves_] = right_cnt; leaf_count_[num_leaves_] = right_cnt;
// update leaf depth // update leaf depth
leaf_depth_[num_leaves_] = leaf_depth_[leaf] + 1; leaf_depth_[num_leaves_] = leaf_depth_[leaf] + 1;
......
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