TabularPredictor.plot_ensemble_model#

TabularPredictor.plot_ensemble_model(model: str = 'best', *, prune_unused_nodes: bool = True, filename: str = 'ensemble_model.png') str[source]#

Output the visualized stack ensemble architecture of a model trained by fit(). The plot is stored to a file, ensemble_model.png in folder predictor.path (or by the name specified in filename)

This function requires graphviz and pygraphviz to be installed because this visualization depends on those package. Unless this function will raise ImportError without being able to generate the visual of the ensemble model.

To install the required package, run the below commands (for Ubuntu linux):

$ sudo apt-get install graphviz graphviz-dev $ pip install pygraphviz

For other platforms, refer to https://graphviz.org/ for Graphviz install, and https://pygraphviz.github.io/documentation.html for PyGraphviz.

Parameters
  • model (str, default 'best') – The model to highlight in golden orange, with all component models highlighted in yellow. If ‘best’, will default to the best model returned from self.get_model_best()

  • prune_unused_nodes (bool, default True) – If True, only plot the models that are components of the specified model. If False, will plot all models.

  • filename (str, default 'ensemble_model.png') – The filename to save the plot as. Will be located under the self.path folder.

Return type

The file name with the full path to the saved graphic on disk.

Examples

>>> from autogluon.tabular import TabularDataset, TabularPredictor
>>> train_data = TabularDataset('train.csv')
>>> predictor = TabularPredictor(label='class').fit(train_data)
>>> path_to_png = predictor.plot_ensemble_model()
>>>
>>> # To view the plot inside a Jupyter Notebook, use the below code:
>>> from IPython.display import Image, display
>>> display(Image(filename=path_to_png))