Decision trees conceive nodes that split into either left or right depending on the splitval of that node.
This split is learned from the data, where factors with the highest gini coefficient is used to split the tree first.
Decision trees in Python can be defined by matrices, with each row being the node used to split the tree further down.
This can be done with a numpy array
In the context of animals

Build decision trees using a matrix or array method
For the above tree, we can construct a matrix as such (tabular view):

Using absolute indexing

Using relative indexing
For the right node, it can be either absolute or relative (for e.g., in node 1, the right child is at node 5 or node (1+4=5))
If it is a leaf node, then the factor will be -1 and the left and right nodes is set as -1 (terminal node)
The left and right column values are references into the rows of the matrix
Determine the best feature to split on
Get the median value based on that feature for the splitval
Randomly select a feature to split on
Randomly select 2 rows and use the mean from that feature for splitval
<aside> 📌 SUMMARY:
</aside>