Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juliaai/treerecipe.jl

Plot recipe for plotting (decision) trees
https://github.com/juliaai/treerecipe.jl

Last synced: 7 days ago
JSON representation

Plot recipe for plotting (decision) trees

Awesome Lists containing this project

README

        

[![Build status (Github Actions)](https://github.com/JuliaAI/TreeRecipe.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/TreeRecipe.jl/actions)
[![codecov.io](http://codecov.io/github/JuliaAI/TreeRecipe.jl/coverage.svg?branch=main)](http://codecov.io/github/JuliaAI/TreeRecipe.jl?branch=main)

# TreeRecipe.jl

A Plot recipe for plotting (decision) trees.

A plot recipe (based on `RecipeBase.jl`) to create a graphical representation of a tree.
The recipe has originally been designed to plot decision trees, but it is able to plot all sort
of trees which conform to the following rules:

- The tree must be wrapped in an `AbstractTrees`-interface. I.e. it has
- to be a subtype of `AbstractTrees.AbstractNode{T}`
- implement `AbstractTrees.children()`
- implement `AbstractTrees.printnode()`

See [`DecisionTree.jl/abstract_trees.jl`](https://github.com/JuliaAI/DecisionTree.jl/blob/9dab9c12fcf2d54d4591b23fc87512964fb664b8/src/abstract_trees.jl) for
an exemplary implementation of the concept. In addition there are examples in the `examples`-folder which show how the recipe can be applied to plot decision trees from the `DecisionTree.jl`-package as well as from the `BetaML.jl`-package.

This approach taken by `TreeRecipe` ensures that a tree implementation can be plotted without having any dependencies to a graphics package and it ensures furthermore, that the recipe is independent of the implementation details of the tree.

For more information have a look at the article
["If things are not ready to use"](https://towardsdatascience.com/part-iii-if-things-are-not-ready-to-use-59d2db378bec) in *Towards Data Science* where the basic ideas are explained.

And here you get an impression on how a plot of a decision tree might look like (in this case a `DecsionTree` with the Iris dataset):

image