Tidymodels "recipe 1/4: Error: could not find function \"all_numeric\""

Hi,

I am currently trying to tune a model using the new tidymodels package
This is basically a learning exercise for me
All my models fail with the error message:

  .notes                                                      
  <chr>                                                       
1 "recipe 1/4: Error: could not find function \"all_numeric\""
2 "recipe 2/4: Error: could not find function \"all_numeric\""
3 "recipe 3/4: Error: could not find function \"all_numeric\""
4 "recipe 4/4: Error: could not find function \"all_numeric\""

This isn't something I could find when i googled around.
I am able to get this to run on an old laptop but not when i move it to my work PC
I have re-installed both the tidyverse and tidymodels.
Does anyone have any suggestions?

Thank you for your time

library(tidyverse)
library(tidymodels)

mydf <- iris %>% 
  mutate(tgt_setosa = ifelse(.$Species == 'setosa', 'Y', 'N')) %>% 
  select(-Species)

# Higlight what we have created for the top ten rows
glimpse(mydf, 10)

# CREATE A MODELLING WORKFLOW ---------------------------------------------
flower_rec <- recipe(tgt_setosa ~ ., data = mydf) %>%
  step_nzv(all_numeric(), -all_outcomes()) %>%
  step_normalize(all_numeric(), -all_outcomes()) %>%
  step_center(all_numeric(), -all_outcomes()) %>% 
  step_upsample(tgt_setosa, over_ratio = tune()) %>% 
  step_corr(all_numeric(), -all_outcomes(), threshold = tune())

# Create the specification
tree_spec <- decision_tree(cost_complexity = tune(), tree_depth = tune()) %>%
  set_engine("rpart") %>%
  set_mode("classification")

# Set up the cross validation for this
cv_splits <- vfold_cv(mydf, strata = "tgt_setosa", repeats = 1)

# Set up the grid
mygrid <- grid_regular(
  over_ratio(),
  threshold(),
  cost_complexity(),
  tree_depth(),
  levels = 2
)

# Fit the models
tree_results <- tune_grid(
  object = flower_rec,
  model = tree_spec,
  resamples = cv_splits,
  grid = mygrid,
  metrics = metric_set(roc_auc, sens, spec)
)

tree_results$.notes[[1]]

It runs without that error but tree_results$.notes entries are all empty. For the error message try

library(recipes)

You probably need to update recipes. Giving us session info would help.

1 Like

Hi @Max

Updating recipes did the trick

Thanks

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