one_hot_encode: One Hot Encode

Description Usage Arguments Value Examples

Description

One hot encodes a data.frame or data.table to a matrix in efficient manner. Function also adds a couple of package specific attributes to returned matrix so one can pass the result throuh impute_xgboost-function to one_hot_decode-function which then knows how to reverse the one hot encoding. At this point only supported categorical column types are factor and character.

Usage

1

Arguments

dt

a data.table or data.frame wanted to one hot encode

Value

A matrix created from one hot encoded data.frame or data.table with special attributes for one_hot_decode-function

Examples

1
2
3
mat = one_hot_encode(iris)
mis_mat = generate_na(mat)
imp_mat = impute_xgboost(mis_mat)

yatzy/xgbimpute documentation built on June 7, 2019, 8:16 p.m.