Skip to content

Commit

Permalink
add a test to error when used with a classifier
Browse files Browse the repository at this point in the history
  • Loading branch information
dajmcdon committed Nov 29, 2023
1 parent 6576454 commit 1bd025a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/testthat/test-layer_residual_quantiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,24 @@ test_that("Returns expected number or rows and columns", {
expect_equal(nrow(unnested), 9L)
expect_equal(unique(unnested$quantile_levels), c(.0275, .8, .95))
})


test_that("Errors when used with a classifier", {
tib <- tibble(
y = factor(rep(c("a", "b"), length.out = 100)),
x1 = rnorm(100),
x2 = rnorm(100),
time_value = 1:100,
geo_value = "ak"
) %>% as_epi_df()

r <- epi_recipe(y~x1+x2, data = tib)
wf <- epi_workflow(r, parsnip::logistic_reg()) %>% fit(tib)
f <- frosting() %>%
layer_predict() %>%
layer_residual_quantiles()
wf <- wf %>% add_frosting(f)
expect_error(predict(wf, tib))
})


0 comments on commit 1bd025a

Please sign in to comment.