Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new validation_time_split() function #256

Merged
merged 11 commits into from Sep 21, 2021
Merged

Conversation

juliasilge
Copy link
Member

No description provided.

@juliasilge
Copy link
Member Author

cc @mine-cetinkaya-rundel

@juliasilge juliasilge changed the title Start PR for validation_time_split() Create new validation_time_split() function Sep 20, 2021
@juliasilge
Copy link
Member Author

Closes #251

library(rsample)
data(drinks, package = "modeldata")
rs <- validation_time_split(drinks)
rs
#> # Validation Set Split (0.75/0.25)  
#> # A tibble: 1 × 2
#>   splits           id        
#>   <list>           <chr>     
#> 1 <split [231/78]> validation
testing(rs$splits[[1]])
#> # A tibble: 78 × 2
#>    date       S4248SM144NCEN
#>    <date>              <dbl>
#>  1 2011-04-01           9281
#>  2 2011-05-01           9967
#>  3 2011-06-01          11344
#>  4 2011-07-01           9106
#>  5 2011-08-01          10469
#>  6 2011-09-01          10085
#>  7 2011-10-01           9612
#>  8 2011-11-01          10328
#>  9 2011-12-01          11483
#> 10 2012-01-01           7486
#> # … with 68 more rows

Created on 2021-09-20 by the reprex package (v2.0.1)

This allows folks to do something like this:

library(rsample)
nested_cv(mtcars, outside = vfold_cv(v = 3), inside = validation_time_split(prop = 0.8))
#> # Nested resampling:
#> #  outer: 3-fold cross-validation
#> #  inner: Validation Set Split (0.8/0.2) 
#> # A tibble: 3 × 3
#>   splits          id    inner_resamples           
#>   <list>          <chr> <list>                    
#> 1 <split [21/11]> Fold1 <validation_split [1 × 2]>
#> 2 <split [21/11]> Fold2 <validation_split [1 × 2]>
#> 3 <split [22/10]> Fold3 <validation_split [1 × 2]>

Created on 2021-09-20 by the reprex package (v2.0.1)

@juliasilge juliasilge marked this pull request as ready for review September 20, 2021 21:10
R/validation_split.R Outdated Show resolved Hide resolved
juliasilge and others added 2 commits September 21, 2021 11:09
Co-authored-by: Hannah Frick <hfrick@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Oct 6, 2021

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants