Skip to content

Commit

Permalink
Merge pull request #520 from seb09/Update-example-for-nested_cv
Browse files Browse the repository at this point in the history
Updated example for nested_cv()
  • Loading branch information
hfrick authored Aug 15, 2024
2 parents 90b2a87 + a80cd6f commit bb202b5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Started moving error messages to cli (#499, #502). With contributions from @JamesHWade (#518).

* Fixed example for `nested_cv()` (@seb09, #520).

## Bug fixes

* `vfold_cv()` now utilizes the `breaks` argument correctly for repeated cross-validation (@ZWael, #471).
Expand Down
18 changes: 9 additions & 9 deletions R/nest.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
#' inside = vfold_cv(v = 3)
#' )
#'
#' first_outer_split <- bad_idea$splits[[1]]
#' outer_analysis <- as.data.frame(first_outer_split)
#' sum(grepl("Volvo 142E", rownames(outer_analysis)))
#' first_outer_split <- get_rsplit(bad_idea, 1)
#' outer_analysis <- analysis(first_outer_split)
#' sum(grepl("Camaro Z28", rownames(outer_analysis)))
#'
#' ## For the 3-fold CV used inside of each bootstrap, how are the replicated
#' ## `Volvo 142E` data partitioned?
#' first_inner_split <- bad_idea$inner_resamples[[1]]$splits[[1]]
#' inner_analysis <- as.data.frame(first_inner_split)
#' inner_assess <- as.data.frame(first_inner_split, data = "assessment")
#' ## `Camaro Z28` data partitioned?
#' first_inner_split <- get_rsplit(bad_idea$inner_resamples[[1]], 1)
#' inner_analysis <- analysis(first_inner_split)
#' inner_assess <- assessment(first_inner_split)
#'
#' sum(grepl("Volvo 142E", rownames(inner_analysis)))
#' sum(grepl("Volvo 142E", rownames(inner_assess)))
#' sum(grepl("Camaro Z28", rownames(inner_analysis)))
#' sum(grepl("Camaro Z28", rownames(inner_assess)))
#' @export
nested_cv <- function(data, outside, inside) {
cl <- match.call()
Expand Down
18 changes: 9 additions & 9 deletions man/nested_cv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb202b5

Please sign in to comment.