text_plain_output_1.png image_output_1.png
from sklearn import datasets

from sklearn.tree import DecisionTreeClassifier

from sklearn import datasets
iris = datasets.load_iris()
list(iris.keys())

X = iris.data[:, 2:]
y = iris.target

tree_clf = DecisionTreeClassifier(max_depth=2)
tree_clf.fit(X, y)