You can do this by using the impurity=False
argument. Here is a reproducible piece of code for you -
from sklearn.datasets import load_iris
from sklearn import tree
import matplotlib.pyplot as plt
#load data
iris = load_iris()
#model training
clf = tree.DecisionTreeClassifier(random_state=0)
clf.fit(iris.data, iris.target)
#plotting
fig = plt.figure(figsize=(10,10))
tree.plot_tree(clf, filled=True, impurity=False) #<-----------
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.