I do not understand the meaning of colors in nodes/leaves when building decision trees by sklearn.tree DecisionTreeClassifier
.
Here's my code:
from sklearn import tree
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
iris = datasets.load_iris()
X = iris.data[:, [2, 3]]
y = iris.target
tree_model = DecisionTreeClassifier(criterion='gini',
max_depth=4,
random_state=1)
tree_model.fit(X,y)
plt.rcParams["figure.figsize"] = (12,10)
tree.plot_tree(tree_model,filled=True)
plt.show()
Is there any logic in the choice of colors by scikit-learn? It doesn't seem so.