make_groups | R Documentation |
This function powers grouped resampling by splitting the data based upon a grouping variable and returning the assessment set indices for each split.
make_groups(
data,
group,
v,
balance = c("groups", "observations", "prop"),
strata = NULL,
...
)
data |
A data frame. |
group |
A variable in |
v |
The number of partitions of the data set. |
balance |
If |
strata |
A variable in |
... |
Arguments passed to balance functions. |
Not all balance
options are accepted – or make sense – for all resampling
functions. For instance, balance = "prop"
assigns groups to folds at
random, meaning that any given observation is not guaranteed to be in one
(and only one) assessment set. That means balance = "prop"
can't
be used with group_vfold_cv()
, and so isn't an option available for that
function.
Similarly, group_mc_cv()
and its derivatives don't assign data to one (and
only one) assessment set, but rather allow each observation to be in an
assessment set zero-or-more times. As a result, those functions don't have
a balance
argument, and under the hood always specify balance = "prop"
when they call make_groups()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.