The coding is not defined

I am trying to run this coding after successfully install the pip install graphviz. However, there is error “tree is not defined”

NameError                                 Traceback (most recent call last)
Cell In[3], line 3
      1 import graphviz
      2 # DOT data
----> 3 dot_data = tree.export_graphviz(classifier, out_file=None, label="all",
      4     filled=True)
      6 # Draw graph
      7 graph = graphviz.Source(dot_data, format="png") 

NameError: name 'tree' is not defined

Expecting to get an output after grapviz installation

  • Where do you think the tree is coming from? You clearly do not have a tree there.

    – 

  • Probably it needs sklearn. check out this doc

    – 

Leave a Comment