| 726 | } |
| 727 | |
| 728 | void Tree::RecomputeMaxDepth() { |
| 729 | if (num_leaves_ == 1) { |
| 730 | max_depth_ = 0; |
| 731 | } else { |
| 732 | if (leaf_depth_.size() == 0) { |
| 733 | RecomputeLeafDepths(0, 0); |
| 734 | } |
| 735 | max_depth_ = leaf_depth_[0]; |
| 736 | for (int i = 1; i < num_leaves(); ++i) { |
| 737 | if (max_depth_ < leaf_depth_[i]) max_depth_ = leaf_depth_[i]; |
| 738 | } |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | } // namespace LightGBM |