【Sklearn】tree.export_graphviz 可視化函數

Parameters:

decision_tree : decision tree regressor or classifier

The decision tree to be exported to GraphViz.

out_file : file object or string, optional (default=None)

Handle or name of the output file. If None, the result is returned as a string.

Changed in version 0.20: Default of out_file changed from “tree.dot” to None.

max_depth : int, optional (default=None)

The maximum depth of the representation. If None, the tree is fully generated.

feature_names : list of strings, optional (default=None)

Names of each of the features.

class_names : list of strings, bool or None, optional (default=None)

Names of each of the target classes in ascending numerical order. Only relevant for classification and not supported for multi-output. If True, shows a symbolic representation of the class name.

label : {‘all’, ‘root’, ‘none’}, optional (default=’all’)

Whether to show informative labels for impurity, etc. Options include ‘all’ to show at every node, ‘root’ to show only at the top root node, or ‘none’ to not show at any node.

filled : bool, optional (default=False)

When set to True, paint nodes to indicate majority class for classification, extremity of values for regression, or purity of node for multi-output.

leaves_parallel : bool, optional (default=False)

When set to True, draw all leaf nodes at the bottom of the tree.

impurity : bool, optional (default=True)

When set to True, show the impurity at each node.

node_ids : bool, optional (default=False)

When set to True, show the ID number on each node.

proportion : bool, optional (default=False)

When set to True, change the display of ‘values’ and/or ‘samples’ to be proportions and percentages respectively.

rotate : bool, optional (default=False)

When set to True, orient tree left to right rather than top-down.

rounded : bool, optional (default=False)

When set to True, draw node boxes with rounded corners and use Helvetica fonts instead of Times-Roman.

special_characters : bool, optional (default=False)

When set to False, ignore special characters for PostScript compatibility.

precision : int, optional (default=3)

Number of digits of precision for floating point in the values of impurity, threshold and value attributes of each node.

Returns:

dot_data : string

String representation of the input tree in GraphViz dot format. Only returned if out_file is None.

New in version 0.18.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章