This function encodes categorical variables using the popular onehot method for each category.
onehot_encoder(X_train, X_test = NULL, cat_columns)
X_train | A tibble representing the training data set containing some categorical features/columns. |
---|---|
X_test | A tibble representing the test set, containing some set of categorical features/columns. |
cat_columns | A character vector containing the names of the categorical columns in the tibble or data frame that should be encoded. |
A list with processed training and test sets, in which the named categorical columns are replaced with their encodings.