Unverified Commit 431556a0 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] remove support for '...' in `create_valid()` (#4865)

* [R-package] remove support for '...' in create_valid()

* remove importFrom
parent 3ede5fa2
...@@ -106,22 +106,7 @@ Dataset <- R6::R6Class( ...@@ -106,22 +106,7 @@ Dataset <- R6::R6Class(
weight = NULL, weight = NULL,
group = NULL, group = NULL,
init_score = NULL, init_score = NULL,
params = list(), params = list()) {
...) {
additional_params <- list(...)
if (length(additional_params) > 0L) {
warning(paste0(
"Dataset$create_valid(): 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.create.valid for documentation on how to call this function."
))
}
# anything passed into '...' should be overwritten by things passed to 'params'
params <- modifyList(additional_params, params)
# the Dataset's existing parameters should be overwritten by any passed in to this call # the Dataset's existing parameters should be overwritten by any passed in to this call
params <- modifyList(self$get_params(), params) params <- modifyList(self$get_params(), params)
...@@ -863,8 +848,6 @@ lgb.Dataset <- function(data, ...@@ -863,8 +848,6 @@ lgb.Dataset <- function(data,
#' The "Dataset Parameters" section of the documentation} for a list of parameters #' The "Dataset Parameters" section of the documentation} for a list of parameters
#' and valid values. If this is an empty list (the default), the validation Dataset #' and valid values. If this is an empty list (the default), the validation Dataset
#' will have the same parameters as the Dataset passed to argument \code{dataset}. #' will have the same parameters as the Dataset passed to argument \code{dataset}.
#' @param ... additional \code{lgb.Dataset} parameters.
#' NOTE: As of v3.3.0, use of \code{...} is deprecated. Add parameters to \code{params} directly.
#' #'
#' @return constructed dataset #' @return constructed dataset
#' #'
...@@ -912,7 +895,6 @@ lgb.Dataset <- function(data, ...@@ -912,7 +895,6 @@ lgb.Dataset <- function(data,
#' ) #' )
#' dvalid$construct() #' dvalid$construct()
#' } #' }
#' @importFrom utils modifyList
#' @export #' @export
lgb.Dataset.create.valid <- function(dataset, lgb.Dataset.create.valid <- function(dataset,
data, data,
...@@ -920,23 +902,12 @@ lgb.Dataset.create.valid <- function(dataset, ...@@ -920,23 +902,12 @@ lgb.Dataset.create.valid <- function(dataset,
weight = NULL, weight = NULL,
group = NULL, group = NULL,
init_score = NULL, init_score = NULL,
params = list(), params = list()) {
...) {
if (!lgb.is.Dataset(x = dataset)) { if (!lgb.is.Dataset(x = dataset)) {
stop("lgb.Dataset.create.valid: input data should be an lgb.Dataset object") stop("lgb.Dataset.create.valid: input data should be an lgb.Dataset object")
} }
additional_params <- list(...)
if (length(additional_params) > 0L) {
warning(paste0(
"lgb.Dataset.create.valid: 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.create.valid for documentation on how to call this function."
))
}
# Create validation dataset # Create validation dataset
return(invisible( return(invisible(
dataset$create_valid( dataset$create_valid(
...@@ -945,7 +916,7 @@ lgb.Dataset.create.valid <- function(dataset, ...@@ -945,7 +916,7 @@ lgb.Dataset.create.valid <- function(dataset,
, weight = weight , weight = weight
, group = group , group = group
, init_score = init_score , init_score = init_score
, params = utils::modifyList(params, additional_params) , params = params
) )
)) ))
......
...@@ -11,8 +11,7 @@ lgb.Dataset.create.valid( ...@@ -11,8 +11,7 @@ lgb.Dataset.create.valid(
weight = NULL, weight = NULL,
group = NULL, group = NULL,
init_score = NULL, init_score = NULL,
params = list(), params = list()
...
) )
} }
\arguments{ \arguments{
...@@ -40,9 +39,6 @@ second group, etc.} ...@@ -40,9 +39,6 @@ second group, etc.}
The "Dataset Parameters" section of the documentation} for a list of parameters The "Dataset Parameters" section of the documentation} for a list of parameters
and valid values. If this is an empty list (the default), the validation Dataset and valid values. If this is an empty list (the default), the validation Dataset
will have the same parameters as the Dataset passed to argument \code{dataset}.} will have the same parameters as the Dataset passed to argument \code{dataset}.}
\item{...}{additional \code{lgb.Dataset} parameters.
NOTE: As of v3.3.0, use of \code{...} is deprecated. Add parameters to \code{params} directly.}
} }
\value{ \value{
constructed dataset constructed dataset
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment