Skip to content

Commit

Permalink
handle ambiguous type when all-custom postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed May 2, 2024
1 parent 33ab426 commit cd6a2eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/validation-rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ check_duplicates <- function(x, call) {
}

infer_type <- function(orderings) {
if (all(orderings$output_all)) {
return("unknown")
}

if (all(orderings$output_numeric | orderings$output_all)) {
return("regression")
}
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-validation-rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,14 @@ test_that("validation of operations (classification)", {
adjust_probability_threshold(threshold = .4)
)
})

test_that("validation of operations (ambiguous type)", {
expect_no_condition(
ambiguous_ctr <-
container() %>%
adjust_predictions_custom(squared = .pred^2) %>%
adjust_predictions_custom(boop = boop)
)

expect_equal(ambiguous_ctr$type, "unknown")
})

0 comments on commit cd6a2eb

Please sign in to comment.