apply_rfe: Apply recursive feature elimination

Description Usage Arguments Examples

Description

This function performes Recursive Feature Elimination (RFE) based on the implementation in the caret package. It is currently only implemented for classification problems. The best subset of variables is selected through maximizing the F1 score. The RFE process is performed by applying bootstrap sampling.

Usage

1
2
apply_rfe(df, target, subsets = c(4, 8, 16, 24, 32), number = 25,
  ntree = 500, downsample = "yes")

Arguments

df

A a data frame

target

Target variable

subsets

Provide a vector of the number of variables to fit models to. Defaults to c(4, 8, 16, 24, 32)

number

Number of repeats of the RFE process. Defaults to 25

ntree

Number of random forest trees to fit. Defaults to 500

downsample

Should the majority class be downsampled during resampling? Defaults to "yes"

Examples

1
2
3
4
5
6
7
data <- recipes::credit_data %>%
  first_to_lower() %>%
  apply_recipe(status) %>%
  prep(retain = TRUE) %>%
  juice()

rfe <- apply_rfe(data, status, number = 10, subsets = c(5, 10, 15))

konradsemsch/aider documentation built on May 22, 2019, 2:40 p.m.