scikit-learn / scikit-learn/scikit-learn
sklearn.tree.export_dict
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 67.3k
- Forks
- 27.4k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 58
Description
Currently, there are two options to get the decision tree representations: export_graphviz and export_text.
I would like to add export_dict, which will output the decision as a nested dictionary.
While you can convert the graphviz representation using cli tools, it's a bit unruly and is a weird workflow. When converting back, the nesting is also kind of weird, with /n chars floating around.
The main utility for json/dict representations are
- That they're far easier to work with for any front-end work.
- Working with a dict allows you to use the representation easily for any downstream tasks using the decision tree (that aren't raw inference).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing export_graphviz and export_text entry points to understand how decision-tree representations are produced. Define the nested dictionary shape with the project discussion, then add export_dict and tests demonstrating that the returned structure represents the tree without graphviz or text parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100