knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

supprecipe

The goal of supprecipe is to supplement the recipe, especially in feature engineering.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("yzhizai/supprecipe")

Example

This is a basic example which shows you how to solve a common problem:

library(tidymodels)
library(supprecipe)
## basic example code

data(cells)
cells <- select(cells, -case)
names(cells)[1] <- 'Label' # when use your own data, make sure the first column is your target label, and named it with 'Label'

a.rec <- recipe(Label~., data = cells) %>% 
  step_zv(all_predictors()) %>% 
  step_normalize(all_predictors()) %>% 
  step_anova(all_predictors(), skip = T) %>% 
  step_mrmr(all_predictors(), skip = T)


a.mod <- rand_forest() %>% 
  set_engine('randomForest') %>% 
  set_mode('classification')

a.wflow <- workflow() %>% 
  add_recipe(a.rec) %>% 
  add_model(a.mod)


a.model <- fit(a.wflow, data = cells)

predict(a.model, new_data = cells)


yzhizai/supprecipe documentation built on Dec. 23, 2021, 9:11 p.m.