question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

export_graphviz should fail with a better error message if a not-fitted decision tree is provided.

See original GitHub issue

Description

export_graphviz should fail with a better error message if a not-fitted decision tree is provided.

Steps/Code to Reproduce

from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier()
export_graphviz(dtc)
AttributeError: 'DecisionTreeClassifier' object has no attribute 'tree_'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
morrmecommented, Apr 22, 2017

guess someone else beat me to the punch!

0reactions
MechCodercommented, Apr 22, 2017

too bad.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 2.7 - export graphviz during decision tree giving error
To do that - you have to get tree classifier from your pipeline and pass it into export_graphviz. Try to run your code...
Read more >
sklearn.tree.export_graphviz — scikit-learn 1.2.0 documentation
Export a decision tree in DOT format. This function generates a GraphViz representation of the decision tree, which is then written into out_file...
Read more >
Scikit-Learn Decision Trees Explained - Towards Data Science
Here is a YouTube tutorial that shows you how to process such a file with graphviz. The end result should be similar to...
Read more >
sandbox | Decision trees in python with scikit-learn and pandas
In this post I will cover decision trees (for classification) in python, using scikit-learn and pandas . The emphasis will be on the...
Read more >
[Example code]-GridSearchCV is not fitted yet error when ...
So I trained a Decision Tree classifier model and I am using the GridSearchCV output to plot the tree plot. Here is my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found