Skip to content

Commit

Permalink
Merge pull request #497 from tidymodels/inner_split-explicit-classes
Browse files Browse the repository at this point in the history
Manual classes for `inner_split()` splits
  • Loading branch information
hfrick authored May 24, 2024
2 parents 3d8b275 + 3ad24a7 commit f228edf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions R/inner_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ inner_split.mc_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "mc_split_inner"
split_inner <- add_class(split_inner, class_inner)
split_inner
}
Expand All @@ -64,7 +64,7 @@ inner_split.group_mc_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "group_mc_split_inner"
split_inner <- add_class(split_inner, class_inner)
split_inner
}
Expand Down Expand Up @@ -93,7 +93,7 @@ inner_split.vfold_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "vfold_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand Down Expand Up @@ -121,7 +121,7 @@ inner_split.group_vfold_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "group_vfold_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -145,7 +145,7 @@ inner_split.boot_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "boot_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -166,7 +166,7 @@ inner_split.group_boot_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "group_boot_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand Down Expand Up @@ -194,7 +194,7 @@ inner_split.val_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "val_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -219,7 +219,7 @@ inner_split.group_val_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "group_val_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -243,7 +243,7 @@ inner_split.time_val_split <- function(x, split_args, ...) {
)
# no need to pick the first split, as `initial_time_split()` only returns one

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "time_val_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -265,7 +265,7 @@ inner_split.clustering_split <- function(x, split_args, ...) {
)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "clustering_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}
Expand All @@ -283,7 +283,7 @@ inner_split.apparent_split <- function(x, ...) {
split_inner <- apparent(analysis_set)
split_inner <- split_inner$splits[[1]]

class_inner <- paste0(class(x)[1], "_inner")
class_inner <- "apparent_split_inner"
class(split_inner) <- c(class_inner, class(x))
split_inner
}

0 comments on commit f228edf

Please sign in to comment.