Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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)

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)
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.