h2o.target_encode_create(data, x, y, fold_column =NULL)
Arguments
data: An H2OFrame object with which to create the target encoding map.
x: A list containing the names or indices of the variables to encode. A target encoding map will be created for each element in the list. Items in the list can be multiple columns. For example, if x = list(c("A"), c("B", "C")), then there will be one mapping frame for A and one mapping frame for B & C (in this case, we group by two columns).
y: The name or column index of the response variable in the data. The response variable can be either numeric or binary.
fold_column: (Optional) The name or column index of the fold column in the data. Defaults to NULL (no fold_column).
Returns
Returns a list of H2OFrame objects containing the target encoding mapping for each column in x.
Examples
## Not run:library(h2o)h2o.init()# Get Target Encoding Map on bank-additional-full data with numeric responsedata <- h2o.importFile(path ="https://s3.amazonaws.com/h2o-public-test-data/smalldata/demos/bank-additional-full.csv")mapping_age <- h2o.target_encode_create(data = data, x = list(c("job"), c("job","marital")), y ="age")head(mapping_age)# Get Target Encoding Map on bank-additional-full data with binary responsemapping_y <- h2o.target_encode_create(data = data, x = list(c("job"), c("job","marital")), y ="y")head(mapping_y)## End(Not run)
See Also
h2o.target_encode_apply for applying the target encoding mapping to a frame.