Skip to content
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

[R-package] De-couple evaluation monitoring from booster verbosity #6172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix tests
  • Loading branch information
david-cortes committed Nov 8, 2023
commit 7935005e29edf45d59bdacc815a2904e99e76a7b
6 changes: 5 additions & 1 deletion R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
@@ -3256,7 +3256,7 @@ test_that("lightgbm() accepts 'weight' and 'weights'", {
expect_equal(record_evals[["valid"]][["auc"]][["eval_err"]], list())
}

.train_for_verbosity_test <- function(train_function, verbose_kwarg, verbose_param) {
.train_for_verbosity_test <- function(train_function, verbose_kwarg, verbose_param, print_metrics = FALSE) {
set.seed(708L)
nrounds <- 5L
params <- list(
@@ -3301,6 +3301,7 @@ test_that("lightgbm() accepts 'weight' and 'weights'", {
)
train_kwargs[["nfold"]] <- 3L
train_kwargs[["showsd"]] <- FALSE
train_kwargs[["print_metrics"]] <- print_metrics
}
log_txt <- capture.output({
bst <- do.call(
@@ -3549,6 +3550,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = -1L
, print_metrics = FALSE
, train_function = lgb.cv
)
.assert_has_expected_logs(
@@ -3583,6 +3585,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = 1L
, print_metrics = TRUE
, train_function = lgb.cv
)
.assert_has_expected_logs(
@@ -3638,6 +3641,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = 1L
, print_metrics = TRUE
, train_function = lgb.cv
)
.assert_has_expected_logs(