实例
from sklearn.datasets import load_iris
from sklearn import tree
import matplotlib.pyplot as plt# Load iris dataset
iris = load_iris()
X, y = iris.data, iris.target# Fit the classifier
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, y)# Plot the decision tree
plt.figure(figsize=(15, 10))
tree.plot_tree(clf)
plt.show()