Export

The documentation of the export module.

id3.export.export_graphviz(decision_tree, out_file=<id3.export.DotTree instance>, feature_names=None, extensive=False)[source]

Export a decision tree in DOT format. This function generates a GraphViz representation of the decision tree, which is then written into out_file. Once exported, graphical renderings can be generated using, for example:

$ dot -Tpdf tree.dot -o tree.pdf (PDF format) $ dot -Tpng tree.dot -o tree.png (PNG format)
decision_tree : decision tree classifier
The decision tree to be exported to GraphViz.
out_file : string, optional (default=DotTree)
Name of the output file. If None, the result is returned as a string.
feature_names : list of strings, optional (default=None)
Names of each of the features.

extensive : displays aditional information, optional (default=False)

Returns:

dot_data : string

String representation of the input tree in GraphViz dot format.

id3.export.export_text(decision_tree, feature_names=None)[source]

Export a decision tree in WEKA like string format. Parameters ———- decision_tree : decision tree classifier feature_names : list of strings, optional (default=None)

Names of each of the features.

ret : string