# NOT RUN {
data(grants, package = "modeldata")
if (is_tf_available()) {
# This may take a while:
rec <-
recipe(class ~ sponsor_code, data = grants_other) %>%
step_feature_hash(sponsor_code, num_hash = 2^6, keep_original_cols = TRUE) %>%
prep()
# How many of the 298 locations ended up in each hash column?
results <-
bake(rec, new_data = NULL, starts_with("sponsor_code")) %>%
distinct()
apply(results %>% select(-sponsor_code), 2, sum) %>% table()
}
# }
Run the code above in your browser using DataLab