Skip to contents

colino provides a collection of additional step objects related to feature selection to be used with the 'recipes' package.

Author

Steven Pawley, dr.stevenpawley@gmail.com

Examples

library(parsnip)
library(recipes)
library(magrittr)

# load the example iris dataset
data(iris)

# 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 <- iris %>%
 recipe(Species ~ .) %>%
 step_select_vip(all_predictors(), model = base_model, top_p = 2,
                 outcome = "Species")

prepped <- prep(rec)

# create a model specification
clf <- decision_tree(mode = "classification") %>%
    set_engine("rpart")

clf_fitted <- clf %>%
    fit(Species ~ ., juice(prepped))