Skip to content

Commit 06df10d

Browse files
committed
classifier chunk comments
1 parent 23baa02 commit 06df10d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

vignettes/custom_epiworkflows.Rmd

+7-6
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,16 @@ such as `step_growth_rate()`.
519519

520520
```{r class_recipe}
521521
classifier_recipe <- epi_recipe(training_data) |>
522-
# Turn `time_value` into predictor
522+
# Label `time_value` as predictor and do no other processing
523523
add_role(time_value, new_role = "predictor") |>
524-
# Turn `geo_value_factor` into predictor by adding indicators for each value
524+
# Use one-hot encoding on `geo_value_factor` and label each resulting column as a predictor
525525
step_dummy(geo_value_factor) |>
526-
# Create and lag growth rate
526+
# Create and lag `case_rate` growth rate
527527
step_growth_rate(case_rate, role = "none", prefix = "gr_") |>
528528
step_epi_lag(starts_with("gr_"), lag = c(0, 7, 14)) |>
529529
step_epi_ahead(starts_with("gr_"), ahead = 7, role = "none") |>
530-
# Divide growth rate into 3 bins.
531-
# Note `recipes::step_cut()` has a bug, or we could use that here.
530+
# Divide growth rate into 3 bins, and label as outcome variable
531+
# Note `recipes::step_cut()` has a bug that prevents us from using it here
532532
step_mutate(
533533
response = cut(
534534
ahead_7_gr_7_rel_change_case_rate,
@@ -539,7 +539,8 @@ classifier_recipe <- epi_recipe(training_data) |>
539539
),
540540
role = "outcome"
541541
) |>
542-
# Drop unused columns, not strictly necessary
542+
# Drop unused columns based on role assignments. This is not strictly
543+
# necessary, as columns with roles unused in the model will be ignored anyway.
543544
step_rm(has_role("none"), has_role("raw")) |>
544545
step_epi_naomit()
545546
```

0 commit comments

Comments
 (0)