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

Wrap trees for better display #50

Merged
merged 3 commits into from
Mar 5, 2023
Merged

Wrap trees for better display #50

merged 3 commits into from
Mar 5, 2023

Conversation

ablaom
Copy link
Member

@ablaom ablaom commented Feb 28, 2023

Closes #45

using MLJBase, MLJDecisionTreeInterface
mach = machine(DecisionTreeClassifier(), (@load_iris)...) |> fit!

julia> tree = fitted_params(mach).tree
petal_width < 0.8
├─ setosa (50/50)
└─ petal_width < 1.75
   ├─ petal_length < 4.95
   │  ├─ petal_width < 1.65
   │  │  ├─ versicolor (47/47)
   │  │  └─ virginica (1/1)
   │  └─ petal_width < 1.55
   │     ├─ virginica (3/3)
   │     └─ sepal_length < 6.95
   │        ├─ versicolor (2/2)
   │        └─ virginica (1/1)
   └─ petal_length < 4.85
      ├─ sepal_width < 3.1
      │  ├─ virginica (2/2)
      │  └─ versicolor (1/1)
      └─ virginica (43/43)

# using Plots, TreeRecipe
# plot(tree)

@ablaom ablaom requested a review from roland-KA February 28, 2023 03:19
@ablaom
Copy link
Member Author

ablaom commented Feb 28, 2023

@roland-KA Would you have time to give this a quick once over the next week?

@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2023

Codecov Report

Merging #50 (ae29ef4) into dev (ebd0c7c) will decrease coverage by 0.56%.
The diff coverage is 94.44%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##              dev      #50      +/-   ##
==========================================
- Coverage   98.40%   97.84%   -0.56%     
==========================================
  Files           1        1              
  Lines         125      139      +14     
==========================================
+ Hits          123      136      +13     
- Misses          2        3       +1     
Impacted Files Coverage Δ
src/MLJDecisionTreeInterface.jl 97.84% <94.44%> (-0.56%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@roland-KA roland-KA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite good to me ... and it is a real improvement with respect to usability; good idea!

@ablaom
Copy link
Member Author

ablaom commented Mar 5, 2023

@roland-KA Thanks for your review.

@ablaom ablaom merged commit de9a8c8 into dev Mar 5, 2023
This was referenced Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrap trees using DecisionTree.wrap for more convenient display
3 participants