Skip to content

Commit

Permalink
adding pretty method to validation_set
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Jan 10, 2024
1 parent f476210 commit d393a8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ S3method(pretty,rolling_origin)
S3method(pretty,sliding_index)
S3method(pretty,sliding_period)
S3method(pretty,sliding_window)
S3method(pretty,validation_set)
S3method(pretty,validation_split)
S3method(pretty,vfold_cv)
S3method(print,apparent)
Expand Down
13 changes: 13 additions & 0 deletions R/printing.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ pretty.mc_cv <- function(x, ...) {
res
}

#' @export
pretty.validation_set <- function(x, ...) {
details <- attributes(x)
res <- paste0(
"Validation Set (",
signif(details$prop[1] / sum(details$prop), 2),
"/",
signif(details$prop[2] / sum(details$prop), 2),
")"
)
res
}

#' @export
pretty.validation_split <- function(x, ...) {
details <- attributes(x)
Expand Down

0 comments on commit d393a8a

Please sign in to comment.