-
Notifications
You must be signed in to change notification settings - Fork 47
add rlang type checkers #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b73dc6e
93b286f
b5a9fe9
5bd2329
022644e
163236b
f66e2af
d2d9810
9474ee8
ff1494f
1533820
723f65a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ Version: 1.2.1.9000 | |
| Authors@R: c( | ||
| person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre"), | ||
| comment = c(ORCID = "0000-0003-2402-136X")), | ||
| person(given = "Posit Software, PBC", role = c("cph", "fnd")) | ||
| person("Posit Software, PBC", role = c("cph", "fnd")) | ||
| ) | ||
| Description: The ability to tune models is important. 'tune' contains | ||
| functions and classes to be used in conjunction with other | ||
|
|
@@ -27,12 +27,12 @@ Imports: | |
| ggplot2, | ||
| glue (>= 1.6.2), | ||
| GPfit, | ||
| hardhat (>= 1.2.0), | ||
| hardhat (>= 1.4.0.9002), | ||
| lifecycle (>= 1.0.0), | ||
| parsnip (>= 1.2.0), | ||
| parsnip (>= 1.2.1.9003), | ||
| purrr (>= 1.0.0), | ||
| recipes (>= 1.0.4), | ||
| rlang (>= 1.1.0), | ||
| recipes (>= 1.1.0.9001), | ||
| rlang (>= 1.1.4), | ||
| rsample (>= 1.2.1.9000), | ||
| tailor, | ||
| tibble (>= 3.1.0), | ||
|
|
@@ -57,8 +57,11 @@ Suggests: | |
| xgboost, | ||
| xml2 | ||
| Remotes: | ||
| tidymodels/hardhat, | ||
| tidymodels/parsnip, | ||
| tidymodels/recipes, | ||
| tidymodels/rsample, | ||
| tidymodels/tailor, | ||
| tidymodels/tailor, | ||
| tidymodels/workflows | ||
| Config/Needs/website: pkgdown, tidymodels, kknn, doParallel, doFuture, | ||
| tidyverse/tidytemplate | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -493,26 +493,6 @@ get_objective_name <- function(x, metrics) { | |
| x | ||
| } | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # acq functions | ||
|
|
||
| check_direction <- function(x) { | ||
| if (!is.logical(x) || length(x) != 1) { | ||
| rlang::abort("`maximize` should be a single logical.") | ||
| } | ||
| invisible(NULL) | ||
| } | ||
|
|
||
|
|
||
| check_best <- function(x) { | ||
| if (!is.numeric(x) || length(x) != 1 || is.na(x)) { | ||
| rlang::abort("`best` should be a single, non-missing numeric.") | ||
| } | ||
| invisible(NULL) | ||
| } | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| check_class_or_null <- function(x, cls = "numeric") { | ||
|
|
@@ -537,6 +517,7 @@ val_class_or_null <- function(x, cls = "numeric", where = NULL) { | |
| } | ||
| invisible(NULL) | ||
| } | ||
| # TODO remove this once finetune is updated | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to myself and @simonpcouch to make similar changes to finetune so that we can remove these three checking functions |
||
|
|
||
| check_class_and_single <- function(x, cls = "numeric") { | ||
| isTRUE(inherits(x, cls) & length(x) == 1) | ||
|
|
@@ -558,7 +539,7 @@ val_class_and_single <- function(x, cls = "numeric", where = NULL) { | |
| } | ||
| invisible(NULL) | ||
| } | ||
|
|
||
| # TODO remove this once finetune is updated | ||
|
|
||
| # Check the data going into the GP. If there are all missing values, fail. If some | ||
| # are missing, remove them and send a warning. If all metrics are the same, fail. | ||
|
|
@@ -644,3 +625,11 @@ check_eval_time <- function(eval_time, metrics) { | |
| invisible(NULL) | ||
|
|
||
| } | ||
|
|
||
| check_time_limit_arg <- function(x, call = rlang::caller_env()) { | ||
| if (!inherits(x, c("logical", "numeric")) || length(x) != 1L) { | ||
| cli::cli_abort("{.arg time_limit} should be either a single numeric or | ||
| logical value.", call = call) | ||
| } | ||
| invisible(NULL) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL that this control option existed😆 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DELETE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SO SATISFYING