Ways to illustrate decision tree with tidymodels.

Greetings.

So far, what I know is this: I can use extract fit parsnip engine and summary to present the rules from a decision tree model in tidymodels framework.

What I want to know is, is there a way to visualize the rules in better prettier ways? Like if? Can we integrate outside package to visualize decision tree with the summary from tidymodels extracted parsnip engine output?


I used C5 engine, and I found Plot a decision tree — plot.C5.0 • C50.
So I tried:

c5_obj_final <- whole_fit %>% 
  extract_fit_engine()

plot(c5_obj_final)

But it gave me an error:

Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
cannot coerce class ‘c("gg", "ggplot")’ to a data.frame

I found r - How to plot a tree produced by C5.0 in tidymodels? - Stack Overflow
and I tried that but got an error:

Error in `check_training_set()`:
! To prep new steps after prepping the original recipe, `retain = TRUE` must be set each time that the recipe is trained.

Then I added retain = TRUE in the prep() but it still gives out the same error.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.