export_graphviz should fail with a better error message if a not-fitted decision tree is provided.
See original GitHub issueDescription
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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
guess someone else beat me to the punch!
too bad.