决策树分类器sklearn中节点的不同颜色表示什么?

what does different color of nodes in decision tree classifier sklearn indicate?

我正在尝试可视化决策树分类器的输出。这是我的代码

from sklearn import tree
import matplotlib.pyplot as plt

plt.figure(figsize=(30,15))
tree.plot_tree(dt2,filled=True,fontsize=8)
plt.show()
plt.savefig('dtree.jpg')

这是我得到的图像。

这些颜色代表什么?我应该如何解读它们?

根据 plot_tree 的文档,其 filled 参数:

filled: bool, 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.

所以在class化任务中,颜色表示每个节点的class大多数样本属于哪个。