Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree visualisation #48

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Tree visualisation #48

merged 2 commits into from
Jun 22, 2023

Conversation

thesps
Copy link
Owner

@thesps thesps commented Jun 22, 2023

Add Decision Tree and Model draw methods to visualise tree structure showing:

  • feature and threshold for non-leaves
  • score/value for leaves

The plotting uses Graphviz and pydot for drawing, which are not added to the dependencies, but will not break import if not available, and print a helpful message if drawing is attempted without them.

Here's an example for one tree (e.g. conifer_model.trees[0][0].draw(filename='tree.png')):
tree

and here's an example for a model (e.g. conifer_model.draw(filename='model.png')):
model

@thesps
Copy link
Owner Author

thesps commented Jun 22, 2023

Tests pass ✅

@thesps thesps merged commit f52409a into master Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant