Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
112db8ab
Unverified
Commit
112db8ab
authored
Aug 17, 2021
by
James Lamb
Committed by
GitHub
Aug 17, 2021
Browse files
[R-package] add deprecation warnings about some uses of '...' (#4522)
Co-authored-by:
Nikita Titov
<
nekit94-12@hotmail.com
>
parent
521a5c47
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
9 deletions
+62
-9
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+33
-3
R-package/R/lgb.cv.R
R-package/R/lgb.cv.R
+12
-1
R-package/R/lgb.train.R
R-package/R/lgb.train.R
+10
-0
R-package/man/dim.Rd
R-package/man/dim.Rd
+1
-1
R-package/man/getinfo.Rd
R-package/man/getinfo.Rd
+1
-1
R-package/man/lgb.cv.Rd
R-package/man/lgb.cv.Rd
+2
-1
R-package/man/lgb.train.Rd
R-package/man/lgb.train.Rd
+2
-1
R-package/man/setinfo.Rd
R-package/man/setinfo.Rd
+1
-1
No files found.
R-package/R/lgb.Dataset.R
View file @
112db8ab
...
@@ -831,7 +831,7 @@ lgb.Dataset.construct <- function(dataset) {
...
@@ -831,7 +831,7 @@ lgb.Dataset.construct <- function(dataset) {
#' @title Dimensions of an \code{lgb.Dataset}
#' @title Dimensions of an \code{lgb.Dataset}
#' @description Returns a vector of numbers of rows and of columns in an \code{lgb.Dataset}.
#' @description Returns a vector of numbers of rows and of columns in an \code{lgb.Dataset}.
#' @param x Object of class \code{lgb.Dataset}
#' @param x Object of class \code{lgb.Dataset}
#' @param ... other parameters
#' @param ... other parameters
(ignored)
#'
#'
#' @return a vector of numbers of rows and of columns
#' @return a vector of numbers of rows and of columns
#'
#'
...
@@ -853,6 +853,16 @@ lgb.Dataset.construct <- function(dataset) {
...
@@ -853,6 +853,16 @@ lgb.Dataset.construct <- function(dataset) {
#' @export
#' @export
dim.lgb.Dataset
<-
function
(
x
,
...
)
{
dim.lgb.Dataset
<-
function
(
x
,
...
)
{
additional_args
<-
list
(
...
)
if
(
length
(
additional_args
)
>
0L
)
{
warning
(
paste0
(
"dim.lgb.Dataset: Found the following passed through '...': "
,
paste
(
names
(
additional_args
),
collapse
=
", "
)
,
". These are ignored. In future releases of lightgbm, this warning will become an error. "
,
"See ?dim.lgb.Dataset for documentation on how to call this function."
))
}
# Check if dataset is not a dataset
# Check if dataset is not a dataset
if
(
!
lgb.is.Dataset
(
x
=
x
))
{
if
(
!
lgb.is.Dataset
(
x
=
x
))
{
stop
(
"dim.lgb.Dataset: input data should be an lgb.Dataset object"
)
stop
(
"dim.lgb.Dataset: input data should be an lgb.Dataset object"
)
...
@@ -978,7 +988,7 @@ slice.lgb.Dataset <- function(dataset, idxset, ...) {
...
@@ -978,7 +988,7 @@ slice.lgb.Dataset <- function(dataset, idxset, ...) {
#' @description Get one attribute of a \code{lgb.Dataset}
#' @description Get one attribute of a \code{lgb.Dataset}
#' @param dataset Object of class \code{lgb.Dataset}
#' @param dataset Object of class \code{lgb.Dataset}
#' @param name the name of the information field to get (see details)
#' @param name the name of the information field to get (see details)
#' @param ... other parameters
#' @param ... other parameters
(ignored)
#' @return info data
#' @return info data
#'
#'
#' @details
#' @details
...
@@ -1017,6 +1027,16 @@ getinfo <- function(dataset, ...) {
...
@@ -1017,6 +1027,16 @@ getinfo <- function(dataset, ...) {
#' @export
#' @export
getinfo.lgb.Dataset
<-
function
(
dataset
,
name
,
...
)
{
getinfo.lgb.Dataset
<-
function
(
dataset
,
name
,
...
)
{
additional_args
<-
list
(
...
)
if
(
length
(
additional_args
)
>
0L
)
{
warning
(
paste0
(
"getinfo.lgb.Dataset: Found the following passed through '...': "
,
paste
(
names
(
additional_args
),
collapse
=
", "
)
,
". These are ignored. In future releases of lightgbm, this warning will become an error. "
,
"See ?getinfo.lgb.Dataset for documentation on how to call this function."
))
}
# Check if dataset is not a dataset
# Check if dataset is not a dataset
if
(
!
lgb.is.Dataset
(
x
=
dataset
))
{
if
(
!
lgb.is.Dataset
(
x
=
dataset
))
{
stop
(
"getinfo.lgb.Dataset: input dataset should be an lgb.Dataset object"
)
stop
(
"getinfo.lgb.Dataset: input dataset should be an lgb.Dataset object"
)
...
@@ -1032,7 +1052,7 @@ getinfo.lgb.Dataset <- function(dataset, name, ...) {
...
@@ -1032,7 +1052,7 @@ getinfo.lgb.Dataset <- function(dataset, name, ...) {
#' @param dataset Object of class \code{lgb.Dataset}
#' @param dataset Object of class \code{lgb.Dataset}
#' @param name the name of the field to get
#' @param name the name of the field to get
#' @param info the specific field of information to set
#' @param info the specific field of information to set
#' @param ... other parameters
#' @param ... other parameters
(ignored)
#' @return the dataset you passed in
#' @return the dataset you passed in
#'
#'
#' @details
#' @details
...
@@ -1071,6 +1091,16 @@ setinfo <- function(dataset, ...) {
...
@@ -1071,6 +1091,16 @@ setinfo <- function(dataset, ...) {
#' @export
#' @export
setinfo.lgb.Dataset
<-
function
(
dataset
,
name
,
info
,
...
)
{
setinfo.lgb.Dataset
<-
function
(
dataset
,
name
,
info
,
...
)
{
additional_args
<-
list
(
...
)
if
(
length
(
additional_args
)
>
0L
)
{
warning
(
paste0
(
"setinfo.lgb.Dataset: Found the following passed through '...': "
,
paste
(
names
(
additional_args
),
collapse
=
", "
)
,
". These are ignored. In future releases of lightgbm, this warning will become an error. "
,
"See ?setinfo.lgb.Dataset for documentation on how to call this function."
))
}
if
(
!
lgb.is.Dataset
(
x
=
dataset
))
{
if
(
!
lgb.is.Dataset
(
x
=
dataset
))
{
stop
(
"setinfo.lgb.Dataset: input dataset should be an lgb.Dataset object"
)
stop
(
"setinfo.lgb.Dataset: input dataset should be an lgb.Dataset object"
)
}
}
...
...
R-package/R/lgb.cv.R
View file @
112db8ab
...
@@ -52,6 +52,7 @@ CVBooster <- R6::R6Class(
...
@@ -52,6 +52,7 @@ CVBooster <- R6::R6Class(
#' not the number of threads (most CPU using hyper-threading to generate 2 threads
#' not the number of threads (most CPU using hyper-threading to generate 2 threads
#' per CPU core).}
#' per CPU core).}
#' }
#' }
#' NOTE: As of v3.3.0, use of \code{...} is deprecated. Add parameters to \code{params} directly.
#' @inheritSection lgb_shared_params Early Stopping
#' @inheritSection lgb_shared_params Early Stopping
#' @return a trained model \code{lgb.CVBooster}.
#' @return a trained model \code{lgb.CVBooster}.
#'
#'
...
@@ -108,13 +109,23 @@ lgb.cv <- function(params = list()
...
@@ -108,13 +109,23 @@ lgb.cv <- function(params = list()
}
}
# Setup temporary variables
# Setup temporary variables
params
<-
append
(
params
,
list
(
...
))
additional_params
<-
list
(
...
)
params
<-
append
(
params
,
additional_params
)
params
$
verbose
<-
verbose
params
$
verbose
<-
verbose
params
<-
lgb.check.obj
(
params
=
params
,
obj
=
obj
)
params
<-
lgb.check.obj
(
params
=
params
,
obj
=
obj
)
params
<-
lgb.check.eval
(
params
=
params
,
eval
=
eval
)
params
<-
lgb.check.eval
(
params
=
params
,
eval
=
eval
)
fobj
<-
NULL
fobj
<-
NULL
eval_functions
<-
list
(
NULL
)
eval_functions
<-
list
(
NULL
)
if
(
length
(
additional_params
)
>
0L
)
{
warning
(
paste0
(
"lgb.cv: 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.cv for documentation on how to call this function."
))
}
# set some parameters, resolving the way they were passed in with other parameters
# set some parameters, resolving the way they were passed in with other parameters
# in `params`.
# in `params`.
# this ensures that the model stored with Booster$save() correctly represents
# this ensures that the model stored with Booster$save() correctly represents
...
...
R-package/R/lgb.train.R
View file @
112db8ab
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#' not the number of threads (most CPU using hyper-threading to generate 2 threads
#' not the number of threads (most CPU using hyper-threading to generate 2 threads
#' per CPU core).}
#' per CPU core).}
#' }
#' }
#' NOTE: As of v3.3.0, use of \code{...} is deprecated. Add parameters to \code{params} directly.
#' @inheritSection lgb_shared_params Early Stopping
#' @inheritSection lgb_shared_params Early Stopping
#' @return a trained booster model \code{lgb.Booster}.
#' @return a trained booster model \code{lgb.Booster}.
#'
#'
...
@@ -91,6 +92,15 @@ lgb.train <- function(params = list(),
...
@@ -91,6 +92,15 @@ lgb.train <- function(params = list(),
fobj
<-
NULL
fobj
<-
NULL
eval_functions
<-
list
(
NULL
)
eval_functions
<-
list
(
NULL
)
if
(
length
(
additional_params
)
>
0L
)
{
warning
(
paste0
(
"lgb.train: 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.train for documentation on how to call this function."
))
}
# set some parameters, resolving the way they were passed in with other parameters
# set some parameters, resolving the way they were passed in with other parameters
# in `params`.
# in `params`.
# this ensures that the model stored with Booster$save() correctly represents
# this ensures that the model stored with Booster$save() correctly represents
...
...
R-package/man/dim.Rd
View file @
112db8ab
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
\arguments{
\arguments{
\item{x}{Object of class \code{lgb.Dataset}}
\item{x}{Object of class \code{lgb.Dataset}}
\item{...}{other parameters}
\item{...}{other parameters
(ignored)
}
}
}
\value{
\value{
a vector of numbers of rows and of columns
a vector of numbers of rows and of columns
...
...
R-package/man/getinfo.Rd
View file @
112db8ab
...
@@ -12,7 +12,7 @@ getinfo(dataset, ...)
...
@@ -12,7 +12,7 @@ getinfo(dataset, ...)
\arguments{
\arguments{
\item{dataset}{Object of class \code{lgb.Dataset}}
\item{dataset}{Object of class \code{lgb.Dataset}}
\item{...}{other parameters}
\item{...}{other parameters
(ignored)
}
\item{name}{the name of the information field to get (see details)}
\item{name}{the name of the information field to get (see details)}
}
}
...
...
R-package/man/lgb.cv.Rd
View file @
112db8ab
...
@@ -128,7 +128,8 @@ into a predictor model which frees up memory and the original datasets}
...
@@ -128,7 +128,8 @@ into a predictor model which frees up memory and the original datasets}
the number of real CPU cores(\code{parallel::detectCores(logical = FALSE)}),
the number of real CPU cores(\code{parallel::detectCores(logical = FALSE)}),
not the number of threads (most CPU using hyper-threading to generate 2 threads
not the number of threads (most CPU using hyper-threading to generate 2 threads
per CPU core).}
per CPU core).}
}}
}
NOTE: As of v3.3.0, use of \code{...} is deprecated. Add parameters to \code{params} directly.}
}
}
\value{
\value{
a trained model \code{lgb.CVBooster}.
a trained model \code{lgb.CVBooster}.
...
...
R-package/man/lgb.train.Rd
View file @
112db8ab
...
@@ -110,7 +110,8 @@ the "Parameters" section of the documentation} for more information. A few key p
...
@@ -110,7 +110,8 @@ the "Parameters" section of the documentation} for more information. A few key p
the
number
of
real
CPU
cores
(\
code
{
parallel
::
detectCores
(
logical
=
FALSE
)}),
the
number
of
real
CPU
cores
(\
code
{
parallel
::
detectCores
(
logical
=
FALSE
)}),
not
the
number
of
threads
(
most
CPU
using
hyper
-
threading
to
generate
2
threads
not
the
number
of
threads
(
most
CPU
using
hyper
-
threading
to
generate
2
threads
per
CPU
core
).}
per
CPU
core
).}
}}
}
NOTE
:
As
of
v3
.3.0
,
use
of
\
code
{...}
is
deprecated
.
Add
parameters
to
\
code
{
params
}
directly
.}
}
}
\
value
{
\
value
{
a
trained
booster
model
\
code
{
lgb
.
Booster
}.
a
trained
booster
model
\
code
{
lgb
.
Booster
}.
...
...
R-package/man/setinfo.Rd
View file @
112db8ab
...
@@ -12,7 +12,7 @@ setinfo(dataset, ...)
...
@@ -12,7 +12,7 @@ setinfo(dataset, ...)
\arguments{
\arguments{
\item{dataset}{Object of class \code{lgb.Dataset}}
\item{dataset}{Object of class \code{lgb.Dataset}}
\item{...}{other parameters}
\item{...}{other parameters
(ignored)
}
\item{name}{the name of the field to get}
\item{name}{the name of the field to get}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment