mmc.plot_tree()
- mmochi.plotting.plot_tree(hierarchy, level, tree_number=random.randint(1, 10), save='tree.png')
Plots a tree from the random forest at a specified level of the classifier. Note these plots are often very unwieldy. See export_graphviz for details.
requires Graphviz which can be obtained with sudo apt-get install graphviz
- Parameters:
hierarchy – Hierarchy object which random forest is plotting on
level (
str) – Name of the level of interest to pull the tree, must have a trained classifier attached to ittree_number (
int(default:random.randint(1,10))) – The tree to pick. If undefined, a random tree.save (
str(default:'tree.png')) – The name to save the plot as a .png format. This must be done before displaying the plot as well