Skip to content

Tree Utilities#

adaXT implements several methods that can be used to analyze and visualize fitted decision trees.

All methods are available in the decision tree module.

import adaXT.decision_tree.tree_utils

DecisionTreePlotter #

DecisionTreePlotter(impurity=True, node_ids=False, precision=3)

plot_node #

plot_node(node)

Helper function used to plot each node of a DecisionTree

Parameters:

Name Type Description Default
ax Axes

axes to plot on

required
node Node

node type of a tree

required
node_positions tuple

(left_child position, right_child position, nodes own position)

required

plot_tree #

plot_tree(tree, impurity=True, node_ids=False, precision=3, ax=None)

Generates the tree in a subplot of plt. To show the plot, the user needs to call matplotlib.pyplot.show().

Parameters:

Name Type Description Default
tree DecisionTree

the tree to plot

required