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

update partykit_tree_info() to handle classification outputs #118

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

EmilHvitfeldt
Copy link
Member

Left todo:

  • add tests
  • make sure the stat_mode() helper does what partykit would have done (i doubt it does right now)

@EmilHvitfeldt EmilHvitfeldt marked this pull request as draft November 20, 2024 21:39
@EmilHvitfeldt
Copy link
Member Author

example

library(parsnip)
library(bonsai)
library(tidypredict)

tree_cls <- decision_tree("classification", "partykit")

fit(tree_cls, Species ~., iris) |>
  tidypredict_fit()
#> case_when(Petal.Length <= 1.9 ~ "versicolor", Petal.Length <= 
#>     4.8 & Petal.Width <= 1.7 & Petal.Length > 1.9 ~ "setosa", 
#>     Petal.Length > 4.8 & Petal.Width <= 1.7 & Petal.Length > 
#>         1.9 ~ "setosa", Petal.Width > 1.7 & Petal.Length > 1.9 ~ 
#>         "setosa")

Created on 2024-11-20 with reprex v2.1.0

@EmilHvitfeldt EmilHvitfeldt marked this pull request as ready for review December 17, 2024 23:08
@EmilHvitfeldt EmilHvitfeldt merged commit 81a15bc into main Dec 17, 2024
9 checks passed
@EmilHvitfeldt EmilHvitfeldt deleted the partykit-classification-prediction branch December 17, 2024 23:13
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