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] Ensure print.lgb.Booster() works when objective is not explicitly set #6850

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Correcting whitespace
  • Loading branch information
walkerjameschris committed Mar 1, 2025
commit bad407ca5004cac95cd7cd301ae48cb0f9eb6607
9 changes: 3 additions & 6 deletions R-package/tests/testthat/test_lgb.Booster.R
Original file line number Diff line number Diff line change
@@ -1604,7 +1604,7 @@ test_that("Booster's print, show, and summary work correctly for built-in object
, nrounds = 5L
)
.check_methods_work(model)

data("iris")
model <- lgb.train(
params = list(objective = "multiclass", num_class = 3L, num_threads = .LGB_MAX_THREADS)
@@ -1618,9 +1618,7 @@ test_that("Booster's print, show, and summary work correctly for built-in object
.check_methods_work(model)
})

test_that("Booster's print, show, and summary work correctly for custom objective", {

# with custom objective
test_that("Booster's print, show, and summary work correctly for custom objective", {
.logregobj <- function(preds, dtrain) {
labels <- get_field(dtrain, "label")
preds <- 1.0 / (1.0 + exp(-preds))
@@ -1656,8 +1654,7 @@ test_that("Booster's print, show, and summary work correctly for custom objectiv
.check_methods_work(model)
})

test_that("Booster's print, show, and summary work correctly when objective is not provided", {

test_that("Booster's print, show, and summary work correctly when objective is not provided", {
data("iris")
model <- lgb.train(
data = lgb.Dataset(
Loading
Oops, something went wrong.