lightgbm.create_tree_digraph

lightgbm.create_tree_digraph(booster, tree_index=0, show_info=None, precision=3, old_name=None, old_comment=None, old_filename=None, old_directory=None, old_format=None, old_engine=None, old_encoding=None, old_graph_attr=None, old_node_attr=None, old_edge_attr=None, old_body=None, old_strict=False, **kwargs)[source]

Create a digraph representation of specified tree.

Note

For more information please visit https://graphviz.readthedocs.io/en/stable/api.html#digraph.

Parameters:
  • booster (Booster or LGBMModel) – Booster or LGBMModel instance to be converted.
  • tree_index (int, optional (default=0)) – The index of a target tree to convert.
  • show_info (list of strings or None, optional (default=None)) – What information should be shown in nodes. Possible values of list items: ‘split_gain’, ‘internal_value’, ‘internal_count’, ‘internal_weight’, ‘leaf_count’, ‘leaf_weight’, ‘data_percentage’.
  • precision (int or None, optional (default=3)) – Used to restrict the display of floating point values to a certain precision.
  • **kwargs – Other parameters passed to Digraph constructor. Check https://graphviz.readthedocs.io/en/stable/api.html#digraph for the full list of supported parameters.
Returns:

graph – The digraph representation of specified tree.

Return type:

graphviz.Digraph