* This function creates a branching node tagged using nodeId with the * specified branch criteria. The methods below -- setBranchNodeTrueChild * and setBranchNodeFalseChild must both be called on this node, or an * error will be raised during final construction. The nodeId is * user-determined and must simply be a unique identifier of * the node. * * branchMode
| 92 | * } |
| 93 | */ |
| 94 | void TreeEnsembleBase::setupBranchNode |
| 95 | (size_t treeId, size_t nodeId, size_t feature_index, |
| 96 | BranchMode branchMode, |
| 97 | double feature_value, |
| 98 | size_t trueChildNodeId, size_t falseChildNodeId) { |
| 99 | |
| 100 | auto& node = _getNode(treeId, nodeId, true); |
| 101 | |
| 102 | // TODO: Error checking routines -- make sure this node hasn't been requested before. |
| 103 | node.set_branchfeatureindex(feature_index); |
| 104 | node.set_nodebehavior(static_cast<Specification::TreeEnsembleParameters::TreeNode::TreeNodeBehavior>(branchMode)); |
| 105 | node.set_branchfeaturevalue(feature_value); |
| 106 | node.set_truechildnodeid(trueChildNodeId); |
| 107 | node.set_falsechildnodeid(falseChildNodeId); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Some of the optimizations require an estimate of the relative hit rates as |
no outgoing calls