to_indicator_matrix#
- static FTreeNode.to_indicator_matrix(nodes: list[Node]) ndarray #
Turn a list of nodes into an indicator matrix.
The indicator matrix is the matrix containing, in its rows, the path-from-root-indicators of the nodes given. The rows are sorted the same way the nodes are.
Parameters#
- nodeslist of Node
The nodes to encode in the matrix.
Returns#
- np.ndarray
The indicator matrix of shape (
len(num_nodes)
, max_depth), where max_depth is the maximum depth of a node in nodes.