Skip to content

Instantly share code, notes, and snippets.

@carlleston
Created October 26, 2019 02:18
Show Gist options
  • Save carlleston/ced7d8d3f6d1e8a3d3ec4b8a2b3c4e75 to your computer and use it in GitHub Desktop.
Save carlleston/ced7d8d3f6d1e8a3d3ec4b8a2b3c4e75 to your computer and use it in GitHub Desktop.
from sklearn.externals.six import StringIO
from IPython.display import Image
from sklearn.tree import export_graphviz
import pydotplus
import os
os.environ['PATH'] = os.environ['PATH']+';'+os.environ['CONDA_PREFIX']+r"\Library\bin\graphviz"
dot_data = StringIO()
export_graphviz(pipe.named_steps['regressor'].estimators_[0], out_file=dot_data)
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(graph.create_png())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment