ml_mean_target_encoder: Mean Target encoding is the process of replacing a...

Description Usage Arguments Value See Also

View source: R/ml_mean_target_encoder.R

Description

This function convert input columns to mean target encoding columns, inspired from https://www.kaggle.com/ogrellier/python-target-encoding-for-categorical-features

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ml_mean_target_encoder(
  mean_target_colnames,
  target_colname,
  training_data,
  test_data = NULL,
  fold = NULL,
  min_samples_leaf = 0,
  smoothing = 1,
  impute_missing = T
)

Arguments

mean_target_colnames

list of column names that needs mean target encoding

target_colname

target column name, should be numeric column

training_data

dataset we used to build mean targeting table

test_data

dataset we used to apply mean target encoding

fold

list of fold index for training dataset, suggest to use caret::createFolds

min_samples_leaf

minimum quantity per column value we consider needs to be calculate mean.

smoothing

used to control rate of transition between the particular column level’s posterior probability and the grand target mean, default is set to 1 to ignore this effect

impute_missing

determine if we want to impute missing when new dataste levels could not be found in mapping table, defualt is to impute

Value

a list that contains datasets that haven been applied mean target encoding and also a mapping table named calculate_columns_mean_table to use for ml_mean_target_apply function ta apply mean targeting encoding on new dataset

See Also

ml+mean_target_apply


ddzr/XL.RPackage documentation built on June 8, 2020, 12:36 a.m.