11# ' Limits the size of the training window to the most recent observations
22# '
3- # ' `step_training_window2 ` creates a *specification* of a recipe step that
3+ # ' `step_epi_training_window ` creates a *specification* of a recipe step that
44# ' limits the size of the training window to the `n_recent` most recent
55# ' observations in `time_value` per group, where the groups are formed
66# ' based on the remaining `epi_keys`.
4040# ' as_epi_df()
4141# '
4242# ' epi_recipe(y ~ x, data = tib) %>%
43- # ' step_training_window2 (n_recent = 3) %>%
43+ # ' step_epi_training_window (n_recent = 3) %>%
4444# ' prep(tib) %>%
4545# ' bake(new_data = NULL)
4646# '
4747# ' epi_recipe(y ~ x, data = tib) %>%
4848# ' step_epi_naomit() %>%
49- # ' step_training_window2 (n_recent = 3) %>%
49+ # ' step_epi_training_window (n_recent = 3) %>%
5050# ' prep(tib) %>%
5151# ' bake(new_data = NULL)
52- step_training_window2 <-
52+ step_epi_training_window <-
5353 function (recipe ,
5454 role = NA ,
5555 n_recent = 50 ,
5656 seasonal = FALSE ,
5757 seasonal_forward_window = 14 ,
5858 seasonal_backward_window = 35 ,
5959 epi_keys = NULL ,
60- id = rand_id(" training_window2 " )) {
60+ id = rand_id(" epi_training_window " )) {
6161 epipredict ::: arg_is_scalar(n_recent , id , seasonal , seasonal_forward_window , seasonal_backward_window )
6262 epipredict ::: arg_is_pos(n_recent , seasonal_forward_window , seasonal_backward_window )
6363 if (is.finite(n_recent )) epipredict ::: arg_is_pos_int(n_recent )
6464 epipredict ::: arg_is_chr(id )
6565 epipredict ::: arg_is_chr(epi_keys , allow_null = TRUE )
6666 add_step(
6767 recipe ,
68- step_training_window2_new (
68+ step_epi_training_window_new (
6969 role = role ,
7070 trained = FALSE ,
7171 n_recent = n_recent ,
@@ -79,10 +79,10 @@ step_training_window2 <-
7979 )
8080 }
8181
82- step_training_window2_new <-
82+ step_epi_training_window_new <-
8383 function (role , trained , n_recent , seasonal , seasonal_forward_window , seasonal_backward_window , epi_keys , skip , id ) {
8484 step(
85- subclass = " training_window2 " ,
85+ subclass = " epi_training_window " ,
8686 role = role ,
8787 trained = trained ,
8888 n_recent = n_recent ,
@@ -96,13 +96,13 @@ step_training_window2_new <-
9696 }
9797
9898# ' @export
99- prep.step_training_window2 <- function (x , training , info = NULL , ... ) {
99+ prep.step_epi_training_window <- function (x , training , info = NULL , ... ) {
100100 ekt <- epipredict ::: epi_keys_only(training )
101101 ek <- x $ epi_keys %|| % ekt %|| % character (0L )
102102
103103 hardhat :: validate_column_names(training , ek )
104104
105- step_training_window2_new (
105+ step_epi_training_window_new (
106106 role = x $ role ,
107107 trained = TRUE ,
108108 n_recent = x $ n_recent ,
@@ -116,7 +116,7 @@ prep.step_training_window2 <- function(x, training, info = NULL, ...) {
116116}
117117
118118# ' @export
119- bake.step_training_window2 <- function (object , new_data , ... ) {
119+ bake.step_epi_training_window <- function (object , new_data , ... ) {
120120 hardhat :: validate_column_names(new_data , object $ epi_keys )
121121
122122 if (object $ n_recent < Inf ) {
@@ -155,7 +155,7 @@ bake.step_training_window2 <- function(object, new_data, ...) {
155155}
156156
157157# ' @export
158- print.step_training_window2 <-
158+ print.step_epi_training_window <-
159159 function (x , width = max(20 , options()$ width - 30 ), ... ) {
160160 if (x $ seasonal ) {
161161 title <- " # of seasonal observations per key limited to:"
0 commit comments