MCPcopy
hub / github.com/ddbourgin/numpy-ml / grow

Function grow

numpy_ml/tests/test_trees.py:23–30  ·  view source on GitHub ↗
(node_id)

Source from the content-addressed store, hash-verified

21 values = dtree.tree_.value
22
23 def grow(node_id):
24 l, r = children_left[node_id], children_right[node_id]
25 if l == r:
26 return Leaf(values[node_id].argmax())
27 n = Node(None, None, (feature[node_id], threshold[node_id]))
28 n.left = grow(l)
29 n.right = grow(r)
30 return n
31
32 node_id = 0
33 root = Node(None, None, (feature[node_id], threshold[node_id]))

Callers 1

clone_treeFunction · 0.85

Calls 2

LeafClass · 0.90
NodeClass · 0.90

Tested by

no test coverage detected