-
Notifications
You must be signed in to change notification settings - Fork 106
No more quosures #737
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
No more quosures #737
Conversation
|
|
||
| .x_expr <- rlang::get_expr(x) | ||
| .x_env <- rlang::get_env(x, parent.frame()) | ||
| .x_env <- rlang::get_env(x, parent.frame(n = 3)) |
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.
since x is no longer a quosure, we have to find the environment differently sometimes. parent.frame(n = 3) get us to the right one
|
I am closing this PR since the implementation isn't good enough. In particular the following can't be done which is a dealbreaker library(parsnip)
boost_tree(mode = "regression") %>%
fit(mpg ~ ., data = mtcars)
#> parsnip model object
#>
#> ##### xgb.Booster
#> raw: 21.5 Kb
#> call:
#> xgboost::xgb.train(params = list(eta = 0.3, max_depth = 6, gamma = 0,
#> colsample_bytree = 1, colsample_bynode = 1, min_child_weight = 1,
#> subsample = 1, objective = "reg:squarederror"), data = x$data,
#> nrounds = 15, watchlist = x$watchlist, verbose = 0, nthread = 1)
#> params (as set within xgb.train):
#> eta = "0.3", max_depth = "6", gamma = "0", colsample_bytree = "1", colsample_bynode = "1", min_child_weight = "1", subsample = "1", objective = "reg:squarederror", nthread = "1", validate_parameters = "TRUE"
#> xgb.attributes:
#> niter
#> callbacks:
#> cb.evaluation.log()
#> # of features: 10
#> niter: 15
#> nfeatures : 10
#> evaluation_log:
#> iter training_rmse
#> 1 14.9313149
#> 2 10.9568064
#> ---
#> 14 0.5628964
#> 15 0.4603055
f <- function(mtry = 2) {
boost_tree(mode = "regression", mtry = mtry) %>%
fit(mpg ~ ., data = mtcars)
}
f()
#> Error in FUN(X[[i]], ...): object 'mtry' not foundCreated on 2022-06-03 by the reprex package (v2.0.1) |
|
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
This PR aims to close #713.
The changes are minimal and very invasive. Mainly involving from
enquo()->enexpr()andenquos()->enexprs()everywhere, updating tests and making sure that the helper functions don't usequo_get_expr()as it is no longer needed.TODO:
requires_descrs()convert_args()andconvert_arg()