stevenpawley / recipeselectors

Additional recipes for supervised feature selection to be used with the tidymodels recipes package
https://stevenpawley.github.io/recipeselectors/
Other
55 stars 7 forks source link

`terms_select()` was deprecated in recipes 1.0.6 and is now defunct in step_select_Boruta #15

Closed Bendlexane closed 9 months ago

Bendlexane commented 9 months ago

Hi!

I was trying to use step_select_vip or step_select_boruta but I get this error message:

Error in `step_select_boruta()`:
Caused by error:
! `terms_select()` was deprecated in recipes 1.0.6 and is now defunct.
ℹ Please use `recipes_eval_select()` instead.
Backtrace:
  1. recipes::prep(rec)
  2. recipes:::prep.recipe(rec)
  7. recipeselectors:::prep.step_select_boruta(...)
  8. recipes::terms_select(terms = x$terms, info = info)
  9. lifecycle::deprecate_stop("1.0.6", "terms_select()", "recipes_eval_select()")
 10. lifecycle:::deprecate_stop0(msg)

this is my code trying to replicate the examples :

 {r cleaning data using features selection}
install.packages("tidymodels")
install.packages("conflict")
install.packages("devtools")
devtools::install_github("stevenpawley/recipeselectors")
library(tidymodels)
library(devtools)
library(recipeselectors)
tidymodels_prefer(quiet = FALSE)

# define a base model to use for feature importances
base_model <- rand_forest(mode = "classification") %>%
    set_engine("ranger", importance = "permutation")

# create a preprocessing recipe
rec <- morfocol_sic_cal_clean %>%
 recipe(taxon ~ .) %>%
 recipeselectors::step_select_vip(all_numeric_predictors(), 
                                  model = base_model, top_p = 2,
                 outcome = "taxon") %>% 
  step_nzv(all_numeric_predictors()) %>% 
  step_corr(all_numeric_predictors(), threshold = 0.9)

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.1.1

Could these lines be related to the error?https://github.com/stevenpawley/recipeselectors/blob/94c88e8dd9e58e26eef546b1f8da479fc90e59bf/R/step_select_boruta.R#L96-L104

Thanks!

stevenpawley commented 9 months ago

Hello, could you try the 'colino' package? (it has superseded this package) - https://github.com/stevenpawley/colino

Bendlexane commented 9 months ago

Oh sorry! I missed that, I haven't, I'm going to give it a try! Thanks!