Learn R Programming

DriveML (version 0.1.0)

generateFeature: Automated column transformer

Description

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

Usage

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

Arguments

data

dataframe or data.table

varlist

variable list to generate the additional features

type

variable transformation type 'Dummy','Outlier','Frequent', 'Interaction'

method

input for variabe transforamtion. For type = 'Frequent' then type should be 'Frequency' or 'Percent'. Other type method list is provided in details

Value

generated transformed features

Details

This function is for generating features based on diffenret transformation methods like interaction, outliers, Dummy coding etc.

Interaction type

  • multiply - multipliaction

  • add - addition

  • substract - substraction

  • divide - division

Frequency type

  • Frequency - Frequency

  • Percent - Percentage

Outlier type

  • Flag - Falg outlier values like 1 or 0

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

Date type

  • Year

  • Month

  • Quarter

  • Week

Examples

Run this code
# NOT RUN {
# 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")

# }

Run the code above in your browser using DataLab