Skip to content

Commit c0231b8

Browse files
committed
moved from using parsnip's depracted step_upsample function to using themis's step_upsample function
1 parent 3333834 commit c0231b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

classification1.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,11 +1184,13 @@ fairly nuanced, and a careful treatment would require a lot more detail and math
11841184
For the present purposes, it will suffice to rebalance the data by *oversampling* the rare class. \index{oversampling}
11851185
In other words, we will replicate rare observations multiple times in our data set to give them more
11861186
voting power in the $K$-nearest neighbor algorithm. In order to do this, we will add an oversampling
1187-
step to the earlier `uc_recipe` recipe with the `step_upsample` function. \index{recipe!step\_upsample}
1187+
step to the earlier `uc_recipe` recipe with the `step_upsample` function from the `themis` package. \index{recipe!step\_upsample}
11881188
We show below how to do this, and also
11891189
use the `group_by` and `summarize` functions to see that our classes are now balanced:
11901190

11911191
```{r 05-upsample-cancer, warning=FALSE}
1192+
library(themis)
1193+
11921194
ups_recipe <- recipe(Class ~ ., data = rare_cancer) |>
11931195
step_upsample(Class, over_ratio = 1, skip = FALSE) |>
11941196
prep()

0 commit comments

Comments
 (0)