tidymodels / tidymodels/rsample

Add random seed argument to resampling functions

Open
#281 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Instead of having to set the random seed outside of calls to create resample objects, it would be helpful to a allow passing the seed as an argument. This would help with reproducibility as the seed would be part of the function and could even be preserved as an attribute in an rset object.

For example, something like this:

resample_function(<current arguments>, seed = NULL){
  if(!is.null(seed) && is.numeric(seed)) set.seed(seed)
  ...
}

The default would still allow setting the seed outside the function as currently supported. It would act similar to sklearn's random_state argument.

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 by reviewing the resampling functions and their current seed-handling behavior. Determine the scope of functions affected, then verify that an optional seed supports reproducible resampling while preserving existing external seeding and can be retained on an rset object.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.