-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from tidymodels/better-errors-on-incompatible-m…
…odels throw better errors when methods doesn't exists
- Loading branch information
Showing
7 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ Suggests: | |
dplyr, | ||
dtplyr, | ||
jsonlite, | ||
kknn, | ||
parsnip, | ||
recipes (>= 1.0.10.9000), | ||
testthat (>= 3.0.0), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# multiplication works | ||
|
||
Code | ||
orbital(wf_fit) | ||
Condition | ||
Error in `orbital()`: | ||
! A model of class <train.kknn> is not supported. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# multiplication works | ||
|
||
Code | ||
orbital(wf_fit) | ||
Condition | ||
Error in `orbital()`: | ||
! The recipe step `step_impute_knn()` is not supported. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("multiplication works", { | ||
skip_if_not_installed("recipes") | ||
skip_if_not_installed("parsnip") | ||
skip_if_not_installed("workflows") | ||
skip_if_not_installed("tidypredict") | ||
skip_if_not_installed("kknn") | ||
|
||
rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% | ||
recipes::step_normalize(recipes::all_numeric_predictors()) | ||
|
||
lm_spec <- parsnip::nearest_neighbor(mode = "regression") | ||
|
||
wf_spec <- workflows::workflow(rec_spec, lm_spec) | ||
|
||
wf_fit <- parsnip::fit(wf_spec, mtcars) | ||
|
||
expect_snapshot( | ||
error = TRUE, | ||
orbital(wf_fit) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
test_that("multiplication works", { | ||
skip_if_not_installed("recipes") | ||
skip_if_not_installed("parsnip") | ||
skip_if_not_installed("workflows") | ||
skip_if_not_installed("tidypredict") | ||
|
||
rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% | ||
recipes::step_impute_knn(recipes::all_numeric_predictors()) | ||
|
||
lm_spec <- parsnip::linear_reg() | ||
|
||
wf_spec <- workflows::workflow(rec_spec, lm_spec) | ||
|
||
wf_fit <- parsnip::fit(wf_spec, mtcars) | ||
|
||
expect_snapshot( | ||
error = TRUE, | ||
orbital(wf_fit) | ||
) | ||
}) |