Skip to content

Commit

Permalink
update snapshots for new error format
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Nov 9, 2023
1 parent 1085be5 commit e596b8a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 34 deletions.
15 changes: 9 additions & 6 deletions tests/testthat/_snaps/glmnet-linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
Code
linear_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
Error <rlang_error>
`penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
Condition
Error in `.check_glmnet_penalty_predict()`:
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.

---

Code
linear_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
Error <rlang_error>
For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
Condition
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
* There are 0 values for `penalty`.
* To try multiple values for total regularization, use the tune package.
* To predict multiple penalties, use `multi_predict()`
Expand All @@ -21,6 +23,7 @@
Code
linear_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars) %>%
multi_predict(mtcars, type = "class")
Error <rlang_error>
For class predictions, the object should be a classification model.
Condition
Error in `check_pred_type()`:
! For class predictions, the object should be a classification model.

20 changes: 12 additions & 8 deletions tests/testthat/_snaps/glmnet-logistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@

Code
multi_predict(class_fit, newdata = wa_churn[1:4, vars], type = "prob")
Error <rlang_error>
Please use `new_data` instead of `newdata`.
Condition
Error in `multi_predict()`:
! Please use `new_data` instead of `newdata`.

# error traps

Code
logistic_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(Class ~ log(
funded_amnt) + int_rate + term, data = lending_club) %>% predict(lending_club,
penalty = 0:1)
Error <rlang_error>
`penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
Condition
Error in `.check_glmnet_penalty_predict()`:
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.

---

Code
logistic_reg() %>% set_engine("glmnet") %>% fit(Class ~ log(funded_amnt) +
int_rate + term, data = lending_club)
Error <rlang_error>
For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
Condition
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
* There are 0 values for `penalty`.
* To try multiple values for total regularization, use the tune package.
* To predict multiple penalties, use `multi_predict()`
Expand All @@ -31,6 +34,7 @@
logistic_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(Class ~ log(
funded_amnt) + int_rate + term, data = lending_club) %>% multi_predict(
lending_club, type = "time")
Error <rlang_error>
For event time predictions, the object should be a censored regression.
Condition
Error in `check_pred_type()`:
! For event time predictions, the object should be a censored regression.

20 changes: 12 additions & 8 deletions tests/testthat/_snaps/glmnet-multinom.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

Code
multi_predict(xy_fit, newdata = hpc[rows, 1:4], penalty = c(0.1, 0.5))
Error <rlang_error>
Please use `new_data` instead of `newdata`.
Condition
Error in `multi_predict()`:
! Please use `new_data` instead of `newdata`.

# error traps

Code
multinom_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data) %>%
predict(hpc_data, penalty = 0:1)
Error <rlang_error>
`penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
Condition
Error in `.check_glmnet_penalty_predict()`:
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.

---

Code
multinom_reg() %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data)
Error <rlang_error>
For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
Condition
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
* There are 0 values for `penalty`.
* To try multiple values for total regularization, use the tune package.
* To predict multiple penalties, use `multi_predict()`
Expand All @@ -28,6 +31,7 @@
Code
multinom_reg(penalty = 0.01) %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data) %>%
multi_predict(hpc_data, type = "numeric")
Error <rlang_error>
For numeric predictions, the object should be a regression model.
Condition
Error in `check_pred_type()`:
! For numeric predictions, the object should be a regression model.

10 changes: 6 additions & 4 deletions tests/testthat/_snaps/glmnet-poisson.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
Code
poisson_reg(penalty = 0.1) %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
Error <rlang_error>
`penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
Condition
Error in `.check_glmnet_penalty_predict()`:
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.

---

Code
poisson_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
Error <rlang_error>
For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
Condition
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
* There are 0 values for `penalty`.
* To try multiple values for total regularization, use the tune package.
* To predict multiple penalties, use `multi_predict()`
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/_snaps/parsnip-extension-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Code
bag_tree() %>% set_engine("rpart") %>% set_mode("regression")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` regression model specifications using the `rpart` engine.
i The parsnip extension package baguette implements support for this specification.
i Please install (if needed) and load to continue.
Expand All @@ -20,7 +20,7 @@

Code
bag_tree() %>% set_mode("censored regression")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` censored regression model specifications.
i The parsnip extension package censored implements support for this specification.
i Please install (if needed) and load to continue.
Expand All @@ -38,7 +38,7 @@

Code
bag_tree()
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` model specifications.
i The parsnip extension packages censored and baguette implement support for this specification.
i Please install (if needed) and load to continue.
Expand All @@ -56,7 +56,7 @@

Code
bag_tree() %>% set_engine("rpart")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` model specifications using the `rpart` engine.
i The parsnip extension packages censored and baguette implement support for this specification.
i Please install (if needed) and load to continue.
Expand Down Expand Up @@ -102,7 +102,7 @@

Code
bag_tree() %>% set_mode("regression") %>% set_engine("rpart")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` regression model specifications using the `rpart` engine.
i The parsnip extension package baguette implements support for this specification.
i Please install (if needed) and load to continue.
Expand All @@ -120,7 +120,7 @@

Code
bag_tree() %>% set_mode("classification") %>% set_engine("C5.0")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `bag_tree` classification model specifications using the `C5.0` engine.
i The parsnip extension package baguette implements support for this specification.
i Please install (if needed) and load to continue.
Expand Down Expand Up @@ -182,7 +182,7 @@

Code
decision_tree() %>% set_engine("partykit") %>% set_mode("regression")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `decision_tree` regression model specifications using the `partykit` engine.
i The parsnip extension package bonsai implements support for this specification.
i Please install (if needed) and load to continue.
Expand Down Expand Up @@ -216,7 +216,7 @@

Code
decision_tree() %>% set_mode("regression") %>% set_engine("partykit")
Message <rlang_message>
Message
! parsnip could not locate an implementation for `decision_tree` regression model specifications using the `partykit` engine.
i The parsnip extension package bonsai implements support for this specification.
i Please install (if needed) and load to continue.
Expand Down

0 comments on commit e596b8a

Please sign in to comment.