| 464 | } |
| 465 | |
| 466 | bool BoostedTreesEnsembleResource::IsTerminalSplitNode( |
| 467 | const int32 tree_id, const int32 node_id) const { |
| 468 | const auto& node = tree_ensemble_->trees(tree_id).nodes(node_id); |
| 469 | DCHECK_EQ(node.node_case(), boosted_trees::Node::kBucketizedSplit); |
| 470 | const int32 left_id = node.bucketized_split().left_id(); |
| 471 | const int32 right_id = node.bucketized_split().right_id(); |
| 472 | return is_leaf(tree_id, left_id) && is_leaf(tree_id, right_id); |
| 473 | } |
| 474 | |
| 475 | // For each pruned node, finds the leaf where it finally ended up and |
| 476 | // calculates the total update from that pruned node prediction. |