Skip to content

Commit

Permalink
Update vignettes/Common_Patterns.Rmd
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Mahoney <[email protected]>
  • Loading branch information
nmercadeb and mikemahoney218 authored Aug 15, 2024
1 parent bdda1c5 commit 7303662
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vignettes/Common_Patterns.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,13 @@ And if you want to set the size of windows based on units of time, for instance
sliding_period(Chicago, date, "year") %>%
head(2)
```
All of these functions produce analysis sets of the same size, with the start and end of the analysis set "sliding" down your data frame. If you'd rather have your analysis set get progressively larger, so that you're predicting new data based upon a growing set of older observations, you can use the `sliding_window()` function with `lookback = -Inf`:

```{r}
sliding_window(Chicago, lookback = Inf) %>%
head(2)
```

This is commonly referred to as "evaluation on a rolling forecasting origin", or more colloquially, "rolling origin cross-validation".

Note that all of these time-based resampling functions are deterministic: unlike the rest of the package, running these functions repeatedly under different random seeds will always return the same results.

0 comments on commit 7303662

Please sign in to comment.