tidymodels / tidymodels/rsample

Treat `prop` as the minimum proportion

Open
#396 2 comments 2 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

If prop doesn't translate to an full number of observations to put into the training/analysis set, we currently round down. That means you can end up with a proportion of nearly prop. If we round up, we get a proportion of at least prop.

n_total <- 101
prop <- 0.8

# currently
(n_train <- floor(n_total * prop))
#> [1] 80
n_train / n_total
#> [1] 0.7920792

# proposed
(n_train <- ceiling(n_total * prop))
#> [1] 81
n_train / n_total
#> [1] 0.8019802

Created on 2022-12-06 with reprex v2.0.2

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

Locate the implementation that converts prop into the training/analysis observation count and inspect the existing tests around that behavior. Confirm the current floor-based result for fractional counts, then update the behavior so the resulting proportion is at least prop and verify the relevant test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.