knn_preprocess: knn Preprocess

Description Usage Arguments Value Author(s) Examples

View source: R/knn_preprocess.R

Description

This function applies step functions of recipes package

Usage

1
2
3
knn_preprocess(formula, data, methods = is.character(),
  apply_on = c("numeric", "categorical"), role = c("predictor",
  "outcome"))

Arguments

formula

Formula that will be evaluated in knn algorithm (for example: Species ~ .)

data

Dataframe that will be modified

methods

Steps functions of the recipes package to be applied. For example( c("step_center", "step_scale", "step_range"))

apply_on

"Categorical" or "Numeric". The column type in which step functions will be applied.

role

"Predictor" or "Outcome". Outcome is the target variable and "Predictor" represent all the rest in "formula".

Value

Returns a data frame with all the changes applied.

Author(s)

Alberto Almui?a

Examples

1
2
data<-knn_preprocess(Species ~ ., iris, c("step_center", "step_scale", "step_range"), "Numeric", "Predictor")
data<-knn_preprocess(Species ~ ., iris, c("step_dummy"), "Categorical", "Outcome")

AlbertoAlmuinha/knnClassifier documentation built on Oct. 30, 2019, 4:48 a.m.