generateFeature: Automated column transformer

View source: R/autoFeature.R

generateFeatureR Documentation

Automated column transformer

Description

This function automatically scans through each variable and generate features based on the type listed in the "details"

Usage

generateFeature(data, varlist, type = "Frequent", method = NULL)

Arguments

data

[data.frame | Required] dataframe or data.table

varlist

[text | Required] variable list to generate the additional features

type

[text | Required] variable transformation with type - 'Dummy','Outlier','Frequent' or 'Interaction'

method

[text | Required] input for variabe transformation for type = 'Frequent' then the method should be 'Frequency' or 'Percent'. Please refer to the "details" section to know more

Details

This function is for generating features based on different transformation methods such as interaction, outliers, Dummy coding, etc.

Interaction type

  • multiply - multiplication

  • add - addition

  • substract - substraction

  • divide - division

Frequency type

  • Frequency - frequency

  • Percent - percentage

Outlier type

  • Flag - flag outlier values like 1 or 0

  • Capping - impute outlier value by 95th or 5th percentile value

Date type

  • Year

  • Month

  • Quarter

  • Week

Value

generated transformed features

Examples

# Generate interaction features
generateFeature(heart, varlist = c("cp", "chol", "trestbps"), type = "Interaction",
method = "add")
generateFeature(heart, varlist = c("cp", "chol", "trestbps"), type = "Interaction",
method = "multiply")

# Generate frequency features
generateFeature(heart, varlist = c("cp", "thal"), type = "Frequent", method = "Percent")
generateFeature(heart, varlist = c("cp", "thal"), type = "Frequent", method = "Frequency")


DriveML documentation built on Dec. 2, 2022, 5:14 p.m.