Open
Conversation
hfrick
reviewed
Sep 17, 2024
| # ------------------------------------------------------------------------------ | ||
|
|
||
| is_torch_working <- function() { | ||
| res <- try(torch::torch_tensor(1), silent = TRUE) |
Member
There was a problem hiding this comment.
This is causing a warning in R CMD check as an undeclared dependency, can we not just add torch to Suggests?
Comment on lines
+1
to
+30
| library(modeldata) | ||
| library(rsample) | ||
|
|
||
| set.seed(392) | ||
| binary_tr <- sim_logistic(200, ~ .1 + 2 * A - 3 * B + 1 * A *B, corr = .7) | ||
| binary_rs <- vfold_cv(binary_tr) | ||
| binary_te <- sim_logistic(2, ~ .1 + 2 * A - 3 * B + 1 * A *B, corr = .7) | ||
|
|
||
| ### | ||
|
|
||
| set.seed(392) | ||
| three_class_tr <- | ||
| sim_multinomial( | ||
| 500, | ||
| ~ -0.5 + 0.6 * abs(A), | ||
| ~ ifelse(A > 0 & B > 0, 1.0 + 0.2 * A / B, - 2), | ||
| ~ -0.6 * A + 0.50 * B - A * B) | ||
| three_class_rs <- vfold_cv(three_class_tr) | ||
| three_class_te <- | ||
| sim_multinomial( | ||
| 2, | ||
| ~ -0.5 + 0.6 * abs(A), | ||
| ~ ifelse(A > 0 & B > 0, 1.0 + 0.2 * A / B, - 2), | ||
| ~ -0.6 * A + 0.50 * B - A * B) | ||
|
|
||
| ### | ||
|
|
||
| num_tr <- sim_regression(200) | ||
| num_rs <- vfold_cv(num_tr) | ||
| num_te <- sim_regression(2) |
Member
There was a problem hiding this comment.
This runs really fast, can we move all of this into functions?
| @@ -0,0 +1,43 @@ | |||
| test_that("linear regression via brulee", { | |||
| skip_if_not_installed("torch") | |||
| skip_if_not(any(get_from_env("linear_reg")$engine == "brulee")) | |||
Member
There was a problem hiding this comment.
Can these require a specific version of parsnip instead?
| expect_true(nrow(ols_pred) == 2) | ||
| expect_named(ols_pred, ".pred") | ||
|
|
||
| # ------------------------------------------------------------------------------ |
Member
There was a problem hiding this comment.
Can you split these into two separate tests with more specific test descriptions, please? Applies to all tests with the # ---- separation header.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See tidymodels/parsnip#1187