Skip to content

Commit

Permalink
Merge pull request #519 from laurabrianna/declutter-reference-page
Browse files Browse the repository at this point in the history
Fixes #475 - Documentation edits-decluttering the top of the refs page
  • Loading branch information
hfrick authored Sep 4, 2024
2 parents 3ea1266 + 5b4733d commit 2c0def3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* Removed trailing space in printing of `mc_cv()` objects (@ccani007, #464).

* Improved documentation for `initial_split()` and friends (@laurabrianna, #519).

## Bug fixes

* `vfold_cv()` now utilizes the `breaks` argument correctly for repeated cross-validation (@ZWael, #471).
Expand Down
18 changes: 10 additions & 8 deletions R/initial_split.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#' Simple Training/Test Set Splitting
#'
#' `initial_split` creates a single binary split of the data into a training
#' set and testing set. `initial_time_split` does the same, but takes the
#' `initial_split()` creates a single binary split of the data into a training
#' set and testing set. `initial_time_split()` does the same, but takes the
#' _first_ `prop` samples for training, instead of a random selection.
#' `group_initial_split` creates splits of the data based
#' `group_initial_split()` creates splits of the data based
#' on some grouping variable, so that all data in a "group" is assigned to
#' the same split.
#' `training` and `testing` are used to extract the resulting data.
#' the same split.
#'
#' @details `training()` and `testing()` are used to extract the resulting data.
#'
#' @template strata_details
#' @inheritParams vfold_cv
#' @inheritParams make_strata
#' @param prop The proportion of data to be retained for modeling/analysis.
#' @export
#' @return An `rsplit` object that can be used with the `training` and `testing`
#' @return An `rsplit` object that can be used with the `training()` and `testing()`
#' functions to extract the data in each split.
#' @examplesIf rlang::is_installed("modeldata")
#' set.seed(1353)
Expand Down Expand Up @@ -176,12 +178,12 @@ group_initial_split <- function(data, group, prop = 3 / 4, ..., strata = NULL, p
attrib <- .get_split_args(res, allow_strata_false = TRUE)

res <- res$splits[[1]]

attrib$times <- NULL
for (i in names(attrib)) {
attr(res, i) <- attrib[[i]]
}
class(res) <- c("group_initial_split", "initial_split", class(res))

res
}
5 changes: 3 additions & 2 deletions R/initial_validation_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#' `group_initial_validation_split()` creates similar random splits of the data
#' based on some grouping variable, so that all data in a "group" are assigned
#' to the same partition.
#' `training()`, `validation()`, and `testing()` can be used to extract the
#'
#' @details [training()], [validation()], and [testing()] can be used to extract the
#' resulting data sets.
#' Use [`validation_set()`] to create an `rset` object for use with functions from
#' Use [validation_set()] to create an `rset` object for use with functions from
#' the tune package such as `tune::tune_grid()`.
#'
#' @template strata_details
Expand Down
2 changes: 2 additions & 0 deletions R/validation_set.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Create a Validation Split for Tuning
#'
#' `validation_set()` creates a the validation split for model tuning.
#'
#' @param split An object of class `initial_validation_split`, such as resulting
#' from [initial_validation_split()] or [group_initial_validation_split()].
#' @param x An `rsplit` object produced by `validation_set()`.
Expand Down
11 changes: 6 additions & 5 deletions man/initial_split.Rd

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

7 changes: 4 additions & 3 deletions man/initial_validation_split.Rd

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

2 changes: 1 addition & 1 deletion man/validation_set.Rd

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

0 comments on commit 2c0def3

Please sign in to comment.