step_profile for categorical pdp

following code here:

slightly modified code :


grid <- 
  recipe(target ~ ., data = df) %>% 
  step_profile(all_predictors(), -target, profile = vars(my_var)) %>% 
  prep() %>% 

predict(workflow_fit, grid) %>% 
  bind_cols(grid %>% select(my_var)) %>% 
  ggplot(aes(y = .pred, x = my_var)) + 
  geom_bar()

Worked flawlessly for numerical variables.
I have tried to apply the same procedure for categorical variables but all bars have the same lenght.

any hint on getting pdp plots for categorical variables using tidymodels?

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.