Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align class name for grouped MC splits #482

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* `vfold_cv()` now utilizes the `breaks` argument correctly for repeated cross-validation (@ZWael, #471).

## Breaking changes

* The class of grouped MC splits is now `group_mc_split` instead of `grouped_mc_split`, aligning it with the other grouped splits (#478).

* The `rsplit` objects of an `apparent()` split now have the correct class inheritance structure. The order is now `apparent_split` and then `rsplit` rather than the other way around (#477).


Expand Down
2 changes: 1 addition & 1 deletion R/mc.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ group_mc_splits <- function(data, group, prop = 3 / 4, times = 25, strata = NULL
indices,
make_splits,
data = data,
class = c("grouped_mc_split", "mc_split")
class = c("group_mc_split", "mc_split")
)

all_assessable <- purrr::map(split_objs, function(x) nrow(assessment(x)))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-initial.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("default time param with lag", {

test_that("default group param", {
rs1 <- group_initial_split(dat1, c)
expect_equal(class(rs1), c("group_initial_split", "initial_split", "grouped_mc_split", "mc_split", "rsplit"))
expect_equal(class(rs1), c("group_initial_split", "initial_split", "group_mc_split", "mc_split", "rsplit"))
tr1 <- training(rs1)
ts1 <- testing(rs1)
expect_equal(nrow(tr1), nrow(dat1) * 3 / 4)
Expand Down Expand Up @@ -103,7 +103,7 @@ test_that("grouping -- strata", {

test_that("`prop` computes the proportion for group analysis", {
rs1 <- group_initial_split(dat1, c, prop = 1 / 2)
expect_equal(class(rs1), c("group_initial_split", "initial_split", "grouped_mc_split", "mc_split", "rsplit"))
expect_equal(class(rs1), c("group_initial_split", "initial_split", "group_mc_split", "mc_split", "rsplit"))
tr1 <- training(rs1)
ts1 <- testing(rs1)
expect_equal(nrow(tr1), nrow(dat1) * 1 / 2)
Expand Down
Loading