tidymodels / tidymodels/rsample

document algorithm in group_vfold_cv

Open
#608 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
R
Stars
343
Forks
67
Avg merge
1h 9m
Merged PRs (30d)
2

Description

I expected some description of the underlying algorithm on ?group_vfold_cv.
In particular I wonder how the assignment works when you specify group, strata, and balance="observations".
Currently I see:

   group: A variable in 'data' (single character or name) used for
          grouping observations with the same value to either the
          analysis or assessment set within a fold.
…
 balance: If 'v' is less than the number of unique groups, how should
          groups be combined into folds? Should be one of '"groups"',
          which will assign roughly the same number of groups to each
          fold, or '"observations"', which will assign roughly the same
          number of observations to each fold.
…
  strata: A variable in 'data' (single character or name) used to
          conduct stratified sampling. When not 'NULL', each resample
          is created within the stratification variable. Numeric
          'strata' are binned into quartiles.

Can you please explain what algorithm is used to assign "roughly the same number of observations to each fold" ?
And can you please clarify, is it

  • roughly the same number of overall observations? or
  • roughly the same number of observations per stratum?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ?group_vfold_cv entry point and review the current descriptions of group, strata, and balance. Trace the assignment behavior needed to explain how groups are allocated with balance="observations" and strata, including whether balancing applies overall or within each stratum. Done means the documentation clearly describes the algorithm and answers both questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.