src.plot.rand_forest_plot

Classes

RandForestPlot(trees, **kwargs)

class src.plot.rand_forest_plot.RandForestPlot(trees, **kwargs)
Author:

Alberto M. Esmoris Pena

Class to plot the evaluation of trained random forest models. See RandomForestEvaluation.

Variables:
  • trees (list) – The trees to be plotted.

  • max_depth (int or None) – The maximum depth to consider when plotting a tree. It is optional. When not given, full trees will be plotted.

  • fnames (list) – The feature names.

__init__(trees, **kwargs)

Initialize/instantiate a RandForestPlot.

Parameters:
  • trees – The tree-like estimators.

  • fnames – The feature names.

  • kwargs – The attributes for the RandForestPlot.

plot(**kwargs)

Do one plot per tree-like estimator representing the many decisions defining the model.

See plot.Plot.plot().

plot_tree(tree, i)

Do the plot for a single tree.

Parameters:
  • tree – The tree to be plotted.

  • i – The number of the tree. NOTE it is not the index of the tree in the ensemble, unless all trees are considered. Instead, it is the number of the tree in the local context of selected trees.