Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Co-authored-by: ‘topepo’ <‘[email protected]’>
  • Loading branch information
topepo and ‘topepo’ authored Oct 22, 2024
1 parent 44cb0a9 commit 62e6620
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
10 changes: 7 additions & 3 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Lifecycle
tidymodels
cron
GH
GHA
PRs
cron
dev
repo
repos
tidymodels
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/glmnet-linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
linear_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
Condition
Error in `.check_glmnet_penalty_predict()`:
Error in `predict()`:
! `penalty` should be a single numeric value.
i `multi_predict()` can be used to get multiple predictions per row of data.

Expand All @@ -13,7 +13,7 @@
Code
linear_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
Condition
Error in `.check_glmnet_penalty_fit()`:
Error in `translate()`:
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
! There are 0 values for `penalty`.
i To try multiple values for total regularization, use the tune package.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/glmnet-logistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
funded_amnt) + int_rate + term, data = lending_club) %>% predict(lending_club,
penalty = 0:1)
Condition
Error in `.check_glmnet_penalty_predict()`:
Error in `predict()`:
! `penalty` should be a single numeric value.
i `multi_predict()` can be used to get multiple predictions per row of data.

Expand All @@ -23,7 +23,7 @@
logistic_reg() %>% set_engine("glmnet") %>% fit(Class ~ log(funded_amnt) +
int_rate + term, data = lending_club)
Condition
Error in `.check_glmnet_penalty_fit()`:
Error in `translate()`:
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
! There are 0 values for `penalty`.
i To try multiple values for total regularization, use the tune package.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/glmnet-multinom.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
multinom_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data) %>%
predict(hpc_data, penalty = 0:1)
Condition
Error in `.check_glmnet_penalty_predict()`:
Error in `predict()`:
! `penalty` should be a single numeric value.
i `multi_predict()` can be used to get multiple predictions per row of data.

Expand All @@ -21,7 +21,7 @@
Code
multinom_reg() %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data)
Condition
Error in `.check_glmnet_penalty_fit()`:
Error in `translate()`:
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
! There are 0 values for `penalty`.
i To try multiple values for total regularization, use the tune package.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/glmnet-poisson.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Code
poisson_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
Condition
Error in `.check_glmnet_penalty_fit()`:
Error in `translate()`:
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
! There are 0 values for `penalty`.
i To try multiple values for total regularization, use the tune package.
Expand All @@ -15,7 +15,7 @@
poisson_reg(penalty = 0.1) %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
Condition
Error in `.check_glmnet_penalty_predict()`:
Error in `predict()`:
! `penalty` should be a single numeric value.
i `multi_predict()` can be used to get multiple predictions per row of data.

2 changes: 1 addition & 1 deletion tests/testthat/test-glmnet-linear.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ test_that('multi_predict() with default or single penalty value', {

test_that('error traps', {
skip_if_not_installed("glmnet")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9002")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9003")

expect_snapshot(error = TRUE, {
linear_reg(penalty = 0.01) %>%
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-glmnet-logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ test_that("class predictions are factors with all levels", {

test_that('error traps', {
skip_if_not_installed("glmnet")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9002")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9003")

data("lending_club", package = "modeldata", envir = rlang::current_env())

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-glmnet-multinom.R
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ test_that("class predictions are factors with all levels", {

test_that('error traps', {
skip_if_not_installed("glmnet")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9002")
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9003")

data("hpc_data", package = "modeldata", envir = rlang::current_env())

Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-glmnet-poisson.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ library(poissonreg)

test_that("glmnet model object", {
skip_if_not_installed("glmnet")

data(seniors, package = "poissonreg", envir = rlang::current_env())
seniors_x <- model.matrix(~ ., data = seniors[, -4])[, -1]
seniors_y <- seniors$count
Expand Down Expand Up @@ -122,9 +121,9 @@ test_that("formula interface can deal with missing values", {
})

test_that("model errors on missing penalty value", {
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9003")
skip_if_not_installed("glmnet")

skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
expect_snapshot(error = TRUE, {
poisson_reg() %>%
set_engine("glmnet") %>%
Expand Down

0 comments on commit 62e6620

Please sign in to comment.