Skip to content

Commit

Permalink
[R-package] remove support for '...' in lgb.Dataset() (#4874)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Dec 10, 2021
1 parent de08d14 commit ea87dd8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
17 changes: 1 addition & 16 deletions R-package/R/lgb.Dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ Dataset <- R6::R6Class(
#' This reduces LightGBM's memory consumption, but it means that the Dataset object
#' cannot be changed after it has been constructed. If you'd prefer to be able to
#' change the Dataset object after construction, set \code{free_raw_data = FALSE}.
#' @param ... other parameters passed to \code{params}
#'
#' @return constructed dataset
#'
Expand All @@ -800,22 +799,8 @@ lgb.Dataset <- function(data,
label = NULL,
weight = NULL,
group = NULL,
init_score = NULL,
...) {

additional_params <- list(...)
params <- modifyList(params, additional_params)

if (length(additional_params) > 0L) {
warning(paste0(
"lgb.Dataset: Found the following passed through '...': "
, paste(names(additional_params), collapse = ", ")
, ". These will be used, but in future releases of lightgbm, this warning will become an error. "
, "Add these to 'params' instead. See ?lgb.Dataset for documentation on how to call this function."
))
}
init_score = NULL) {

# Create new dataset
return(
invisible(Dataset$new(
data = data
Expand Down
5 changes: 1 addition & 4 deletions R-package/man/lgb.Dataset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,9 @@ test_that("lgb.train() works with linear learners and data where a feature has o
return(lgb.Dataset(
data = X
, label = 2L * X[, 1L] + runif(nrow(X), 0L, 0.1)
, feature_pre_filter = FALSE
, params = list(
feature_pre_filter = FALSE
)
))
}

Expand Down

0 comments on commit ea87dd8

Please sign in to comment.