Reputation: 155
I'm trying to draw a tree through sklearn lib tree, but the problem is that column indexes are written in the picture.
tree.plot_tree(clf_decision)
Upvotes: 2
Views: 3386
Reputation: 210842
make use of feature_names
and class_names
parameters:
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
clf = tree.DecisionTreeClassifier(random_state=0).fit(iris.data, iris.target)
tree.plot_tree(clf, feature_names=iris.feature_names, class_names=iris.target_names)
Upvotes: 5