# NOT RUN {
library(recipes)
library(modeldata)
data(okc)
sort(table(okc$Class, useNA = "always"))
ds_rec <- recipe(Class ~ age + height, data = okc) %>%
step_meanimpute(all_predictors()) %>%
step_adasyn(Class) %>%
prep()
sort(table(juice(ds_rec)$Class, useNA = "always"))
# since `skip` defaults to TRUE, baking the step has no effect
baked_okc <- bake(ds_rec, new_data = okc)
table(baked_okc$Class, useNA = "always")
library(ggplot2)
ggplot(circle_example, aes(x, y, color = class)) +
geom_point() +
labs(title = "Without ADASYN")
recipe(class ~ ., data = circle_example) %>%
step_adasyn(class) %>%
prep() %>%
juice() %>%
ggplot(aes(x, y, color = class)) +
geom_point() +
labs(title = "With ADASYN")
# }
Run the code above in your browser using DataLab