Skip to content

Add support for C5.0 decision tree models#245

Merged
EmilHvitfeldt merged 4 commits into
mainfrom
add-c50-decision-tree-engine
Jul 16, 2026
Merged

Add support for C5.0 decision tree models#245
EmilHvitfeldt merged 4 commits into
mainfrom
add-c50-decision-tree-engine

Conversation

@EmilHvitfeldt

Copy link
Copy Markdown
Member

Adds tidypredict support for C50::C5.0() classification trees, including decision_tree() parsnip models fitted with the "C5.0" engine. The parser reads the tree structure C5.0 serializes as text rather than converting through partykit::as.party(), since that conversion re-evaluates the fitting call to recover the training data, which is unavailable when the model is fit through the x/y interface (as parsnip does). Boosted (trials > 1) and rule-based (rules = TRUE) models are not representable as a single tree and raise an error.

Relates to #232; the decision_tree()/C5.0 checkbox can be checked there.

partykit's split varid indexes the columns of model$data, not the terms
list. These coincide for ctree (response first) but not for parties
converted from other models, where the mapping mislabeled every split.
Parse the tree structure C5.0 stores as text, rather than converting via
partykit::as.party(), which needs the training data unavailable in x/y
fits. Boosted and rule-based models are rejected.
@EmilHvitfeldt
EmilHvitfeldt merged commit d6c1e61 into main Jul 16, 2026
9 checks passed
@EmilHvitfeldt
EmilHvitfeldt deleted the add-c50-decision-tree-engine branch July 16, 2026 17:26
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