Skip to content

Commit 9bb5d0a

Browse files
committed
adjust xgboost error context (closes #1196)
1 parent 143fd7d commit 9bb5d0a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

R/boost_tree.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,15 @@ recalc_param <- function(x, counts, denom) {
371371
x
372372
}
373373

374-
maybe_proportion <- function(x, nm, call = rlang::caller_env()) {
374+
maybe_proportion <- function(x, nm) {
375375
if (x < 1) {
376376
cli::cli_abort(
377377
c(
378378
"The option `counts = TRUE` was used but {.arg {nm}} was given
379379
as {signif(x, 3)}.",
380380
"i" = "Please use a value >= 1 or use {.code counts = FALSE}."
381381
),
382-
call = call
382+
call = call2("xgb_train")
383383
)
384384
}
385385
}

tests/testthat/_snaps/boost_tree_xgboost.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
boost_tree(mtry = 0.9, trees = 4) %>% set_engine("xgboost") %>% set_mode(
8585
"regression") %>% fit(mpg ~ ., data = mtcars)
8686
Condition
87-
Error in `recalc_param()`:
87+
Error in `xgb_train()`:
8888
! The option `counts = TRUE` was used but `colsample_bynode` was given as 0.9.
8989
i Please use a value >= 1 or use `counts = FALSE`.
9090

0 commit comments

Comments
 (0)