rsample icon indicating copy to clipboard operation
rsample copied to clipboard

Treat `prop` as the minimum proportion

Open hfrick opened this issue 2 years ago • 2 comments
trafficstars

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

hfrick avatar Dec 06 '22 18:12 hfrick

We should also document what kind of rounding is being done for the prop argument.

EmilHvitfeldt avatar Dec 06 '22 20:12 EmilHvitfeldt

Yep! and check rev deps, too

hfrick avatar Dec 07 '22 10:12 hfrick