diff --git a/R-package/R/lgb.Dataset.R b/R-package/R/lgb.Dataset.R index 345eb22f95e0..edfaba901110 100644 --- a/R-package/R/lgb.Dataset.R +++ b/R-package/R/lgb.Dataset.R @@ -635,9 +635,9 @@ Dataset <- R6::R6Class( ) ) -#' Construct lgb.Dataset object +#' Construct \code{lgb.Dataset} object #' -#' Construct lgb.Dataset object from dense matrix, sparse matrix +#' Construct \code{lgb.Dataset} object from dense matrix, sparse matrix #' or local file (that was created previously by saving an \code{lgb.Dataset}). #' #' @param data a \code{matrix} object, a \code{dgCMatrix} object or a character representing a filename @@ -646,7 +646,7 @@ Dataset <- R6::R6Class( #' @param colnames names of columns #' @param categorical_feature categorical features #' @param free_raw_data TRUE for need to free raw data after construct -#' @param info a list of information of the lgb.Dataset object +#' @param info a list of information of the \code{lgb.Dataset} object #' @param ... other information to pass to \code{info} or parameters pass to \code{params} #' #' @return constructed dataset @@ -690,7 +690,7 @@ lgb.Dataset <- function(data, #' #' @param dataset \code{lgb.Dataset} object, training data #' @param data a \code{matrix} object, a \code{dgCMatrix} object or a character representing a filename -#' @param info a list of information of the lgb.Dataset object +#' @param info a list of information of the \code{lgb.Dataset} object #' @param ... other information to pass to \code{info}. #' #' @return constructed dataset @@ -741,7 +741,7 @@ lgb.Dataset.construct <- function(dataset) { } -#' Dimensions of an lgb.Dataset +#' Dimensions of an \code{lgb.Dataset} #' #' Returns a vector of numbers of rows and of columns in an \code{lgb.Dataset}. #' @param x Object of class \code{lgb.Dataset} @@ -852,9 +852,9 @@ dimnames.lgb.Dataset <- function(x) { #' Slice a dataset #' #' Get a new \code{lgb.Dataset} containing the specified rows of -#' original lgb.Dataset object +#' original \code{lgb.Dataset} object #' -#' @param dataset Object of class "lgb.Dataset" +#' @param dataset Object of class \code{lgb.Dataset} #' @param idxset a integer vector of indices of rows needed #' @param ... other parameters (currently not used) #' @return constructed sub dataset @@ -888,7 +888,7 @@ slice.lgb.Dataset <- function(dataset, idxset, ...) { } -#' Get information of an lgb.Dataset object +#' Get information of an \code{lgb.Dataset} object #' #' @param dataset Object of class \code{lgb.Dataset} #' @param name the name of the information field to get (see details) @@ -901,8 +901,8 @@ slice.lgb.Dataset <- function(dataset, idxset, ...) { #' \itemize{ #' \item \code{label}: label lightgbm learn from ; #' \item \code{weight}: to do a weight rescale ; -#' \item \code{group}: group size -#' \item \code{init_score}: initial score is the base prediction lightgbm will boost from ; +#' \item \code{group}: group size ; +#' \item \code{init_score}: initial score is the base prediction lightgbm will boost from. #' } #' #' @examples @@ -937,9 +937,9 @@ getinfo.lgb.Dataset <- function(dataset, name, ...) { } -#' Set information of an lgb.Dataset object +#' Set information of an \code{lgb.Dataset} object #' -#' @param dataset Object of class "lgb.Dataset" +#' @param dataset Object of class \code{lgb.Dataset} #' @param name the name of the field to get #' @param info the specific field of information to set #' @param ... other parameters diff --git a/R-package/R/lgb.prepare.R b/R-package/R/lgb.prepare.R index e0f30d619be2..2f6d768c7ac4 100644 --- a/R-package/R/lgb.prepare.R +++ b/R-package/R/lgb.prepare.R @@ -1,30 +1,18 @@ #' Data preparator for LightGBM datasets (numeric) #' -#' Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric without integers. Please use \code{lgb.prepare_rules} if you want to apply this transformation to other datasets. +#' Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric without integers. Please use \code{lgb.prepare_rules} if you want to apply this transformation to other datasets. #' #' @param data A data.frame or data.table to prepare. #' -#' @return The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +#' @return The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. #' #' @examples #' library(lightgbm) #' data(iris) #' #' str(iris) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... #' #' str(lgb.prepare(data = iris)) # Convert all factors/chars to numeric -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : num 1 1 1 1 1 1 1 1 1 1 ... #' #' \dontrun{ #' # When lightgbm package is installed, and you do not want to load it diff --git a/R-package/R/lgb.prepare2.R b/R-package/R/lgb.prepare2.R index b0730fb7cb2f..59321f6912c8 100644 --- a/R-package/R/lgb.prepare2.R +++ b/R-package/R/lgb.prepare2.R @@ -1,31 +1,19 @@ #' Data preparator for LightGBM datasets (integer) #' -#' Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric (specifically: integer). Please use \code{lgb.prepare_rules2} if you want to apply this transformation to other datasets. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. +#' Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric (specifically: integer). Please use \code{lgb.prepare_rules2} if you want to apply this transformation to other datasets. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. #' #' @param data A data.frame or data.table to prepare. #' -#' @return The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +#' @return The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. #' #' @examples #' library(lightgbm) #' data(iris) #' #' str(iris) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... #' #' # Convert all factors/chars to integer #' str(lgb.prepare2(data = iris)) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : int 1 1 1 1 1 1 1 1 1 1 ... #' #' \dontrun{ #' # When lightgbm package is installed, and you do not want to load it diff --git a/R-package/R/lgb.prepare_rules.R b/R-package/R/lgb.prepare_rules.R index 354aec5d6b1c..ea4860b493cd 100644 --- a/R-package/R/lgb.prepare_rules.R +++ b/R-package/R/lgb.prepare_rules.R @@ -1,38 +1,23 @@ #' Data preparator for LightGBM datasets with rules (numeric) #' -#' Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric. In addition, keeps rules created so you can convert other datasets using this converter. +#' Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric. In addition, keeps rules created so you can convert other datasets using this converter. #' #' @param data A data.frame or data.table to prepare. #' @param rules A set of rules from the data preparator, if already used. #' -#' @return A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +#' @return A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. #' #' @examples #' library(lightgbm) #' data(iris) #' #' str(iris) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... #' #' new_iris <- lgb.prepare_rules(data = iris) # Autoconverter #' str(new_iris$data) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : num 1 1 1 1 1 1 1 1 1 1 ... #' #' data(iris) # Erase iris dataset #' iris$Species[1] <- "NEW FACTOR" # Introduce junk factor (NA) -#' # Warning message: -#' # In `[<-.factor`(`*tmp*`, 1, value = c(NA, 1L, 1L, 1L, 1L, 1L, 1L, : -#' # invalid factor level, NA generated #' #' # Use conversion using known rules #' # Unknown factors become 0, excellent for sparse datasets @@ -40,14 +25,11 @@ #' #' # Unknown factor is now zero, perfect for sparse datasets #' newer_iris$data[1, ] # Species became 0 as it is an unknown factor -#' # Sepal.Length Sepal.Width Petal.Length Petal.Width Species -#' # 1 5.1 3.5 1.4 0.2 0 #' #' newer_iris$data[1, 5] <- 1 # Put back real initial value #' #' # Is the newly created dataset equal? YES! #' all.equal(new_iris$data, newer_iris$data) -#' # [1] TRUE #' #' # Can we test our own rules? #' data(iris) # Erase iris dataset @@ -58,12 +40,6 @@ #' "virginica" = 1)) #' newest_iris <- lgb.prepare_rules(data = iris, rules = personal_rules) #' str(newest_iris$data) # SUCCESS! -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : num 3 3 3 3 3 3 3 3 3 3 ... #' #' @importFrom data.table set #' @export diff --git a/R-package/R/lgb.prepare_rules2.R b/R-package/R/lgb.prepare_rules2.R index 2aac7d2c8681..c32b68c805c4 100644 --- a/R-package/R/lgb.prepare_rules2.R +++ b/R-package/R/lgb.prepare_rules2.R @@ -1,38 +1,23 @@ #' Data preparator for LightGBM datasets with rules (integer) #' -#' Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric (specifically: integer). In addition, keeps rules created so you can convert other datasets using this converter. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. +#' Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric (specifically: integer). In addition, keeps rules created so you can convert other datasets using this converter. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. #' #' @param data A data.frame or data.table to prepare. #' @param rules A set of rules from the data preparator, if already used. #' -#' @return A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +#' @return A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. #' #' @examples #' library(lightgbm) #' data(iris) #' #' str(iris) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... #' #' new_iris <- lgb.prepare_rules2(data = iris) # Autoconverter #' str(new_iris$data) -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : int 1 1 1 1 1 1 1 1 1 1 ... #' #' data(iris) # Erase iris dataset #' iris$Species[1] <- "NEW FACTOR" # Introduce junk factor (NA) -#' # Warning message: -#' # In `[<-.factor`(`*tmp*`, 1, value = c(NA, 1L, 1L, 1L, 1L, 1L, 1L, : -#' # invalid factor level, NA generated #' #' # Use conversion using known rules #' # Unknown factors become 0, excellent for sparse datasets @@ -40,14 +25,11 @@ #' #' # Unknown factor is now zero, perfect for sparse datasets #' newer_iris$data[1, ] # Species became 0 as it is an unknown factor -#' # Sepal.Length Sepal.Width Petal.Length Petal.Width Species -#' # 1 5.1 3.5 1.4 0.2 0 #' #' newer_iris$data[1, 5] <- 1 # Put back real initial value #' #' # Is the newly created dataset equal? YES! #' all.equal(new_iris$data, newer_iris$data) -#' # [1] TRUE #' #' # Can we test our own rules? #' data(iris) # Erase iris dataset @@ -58,12 +40,6 @@ #' "virginica" = 1L)) #' newest_iris <- lgb.prepare_rules2(data = iris, rules = personal_rules) #' str(newest_iris$data) # SUCCESS! -#' # 'data.frame': 150 obs. of 5 variables: -#' # $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -#' # $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -#' # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -#' # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -#' # $ Species : int 3 3 3 3 3 3 3 3 3 3 ... #' #' @importFrom data.table set #' @export diff --git a/R-package/R/readRDS.lgb.Booster.R b/R-package/R/readRDS.lgb.Booster.R index dbc5653a505e..e654e0578316 100644 --- a/R-package/R/readRDS.lgb.Booster.R +++ b/R-package/R/readRDS.lgb.Booster.R @@ -1,11 +1,11 @@ -#' readRDS for lgb.Booster models +#' readRDS for \code{lgb.Booster} models #' #' Attempts to load a model using RDS. #' #' @param file a connection or the name of the file where the R object is saved to or read from. #' @param refhook a hook function for handling reference objects. #' -#' @return lgb.Booster. +#' @return \code{lgb.Booster}. #' #' @examples #' library(lightgbm) diff --git a/R-package/R/saveRDS.lgb.Booster.R b/R-package/R/saveRDS.lgb.Booster.R index 9cb4c2ad96ff..704a568de7e1 100644 --- a/R-package/R/saveRDS.lgb.Booster.R +++ b/R-package/R/saveRDS.lgb.Booster.R @@ -1,4 +1,4 @@ -#' saveRDS for lgb.Booster models +#' saveRDS for \code{lgb.Booster} models #' #' Attempts to save a model using RDS. Has an additional parameter (\code{raw}) which decides whether to save the raw model or not. #' diff --git a/R-package/man/dim.Rd b/R-package/man/dim.Rd index a8a567c9b85c..4fdb64252f7e 100644 --- a/R-package/man/dim.Rd +++ b/R-package/man/dim.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/lgb.Dataset.R \name{dim.lgb.Dataset} \alias{dim.lgb.Dataset} -\title{Dimensions of an lgb.Dataset} +\title{Dimensions of an \code{lgb.Dataset}} \usage{ \method{dim}{lgb.Dataset}(x, ...) } diff --git a/R-package/man/getinfo.Rd b/R-package/man/getinfo.Rd index 04116a46b474..b5b8112bd2d3 100644 --- a/R-package/man/getinfo.Rd +++ b/R-package/man/getinfo.Rd @@ -3,7 +3,7 @@ \name{getinfo} \alias{getinfo} \alias{getinfo.lgb.Dataset} -\title{Get information of an lgb.Dataset object} +\title{Get information of an \code{lgb.Dataset} object} \usage{ getinfo(dataset, ...) @@ -20,7 +20,7 @@ getinfo(dataset, ...) info data } \description{ -Get information of an lgb.Dataset object +Get information of an \code{lgb.Dataset} object } \details{ The \code{name} field can be one of the following: @@ -28,8 +28,8 @@ The \code{name} field can be one of the following: \itemize{ \item \code{label}: label lightgbm learn from ; \item \code{weight}: to do a weight rescale ; - \item \code{group}: group size - \item \code{init_score}: initial score is the base prediction lightgbm will boost from ; + \item \code{group}: group size ; + \item \code{init_score}: initial score is the base prediction lightgbm will boost from. } } \examples{ diff --git a/R-package/man/lgb.Dataset.Rd b/R-package/man/lgb.Dataset.Rd index e0d6b64aa98b..dd74fdf6626f 100644 --- a/R-package/man/lgb.Dataset.Rd +++ b/R-package/man/lgb.Dataset.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/lgb.Dataset.R \name{lgb.Dataset} \alias{lgb.Dataset} -\title{Construct lgb.Dataset object} +\title{Construct \code{lgb.Dataset} object} \usage{ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, categorical_feature = NULL, free_raw_data = TRUE, info = list(), @@ -21,7 +21,7 @@ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, \item{free_raw_data}{TRUE for need to free raw data after construct} -\item{info}{a list of information of the lgb.Dataset object} +\item{info}{a list of information of the \code{lgb.Dataset} object} \item{...}{other information to pass to \code{info} or parameters pass to \code{params}} } @@ -29,7 +29,7 @@ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, constructed dataset } \description{ -Construct lgb.Dataset object from dense matrix, sparse matrix +Construct \code{lgb.Dataset} object from dense matrix, sparse matrix or local file (that was created previously by saving an \code{lgb.Dataset}). } \examples{ diff --git a/R-package/man/lgb.Dataset.create.valid.Rd b/R-package/man/lgb.Dataset.create.valid.Rd index 0d0f3454a8e2..e48c93772a39 100644 --- a/R-package/man/lgb.Dataset.create.valid.Rd +++ b/R-package/man/lgb.Dataset.create.valid.Rd @@ -11,7 +11,7 @@ lgb.Dataset.create.valid(dataset, data, info = list(), ...) \item{data}{a \code{matrix} object, a \code{dgCMatrix} object or a character representing a filename} -\item{info}{a list of information of the lgb.Dataset object} +\item{info}{a list of information of the \code{lgb.Dataset} object} \item{...}{other information to pass to \code{info}.} } diff --git a/R-package/man/lgb.Dataset.save.Rd b/R-package/man/lgb.Dataset.save.Rd index f5664a9841a4..5ab6a0fe7c9e 100644 --- a/R-package/man/lgb.Dataset.save.Rd +++ b/R-package/man/lgb.Dataset.save.Rd @@ -18,7 +18,6 @@ passed dataset Save \code{lgb.Dataset} to a binary file } \examples{ - library(lightgbm) data(agaricus.train, package = "lightgbm") train <- agaricus.train diff --git a/R-package/man/lgb.cv.Rd b/R-package/man/lgb.cv.Rd index 28652ba1141e..5be785fa18d2 100644 --- a/R-package/man/lgb.cv.Rd +++ b/R-package/man/lgb.cv.Rd @@ -92,8 +92,8 @@ params <- list(objective = "regression", metric = "l2") model <- lgb.cv(params, dtrain, 10, - nfold = 5, + nfold = 3, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) } diff --git a/R-package/man/lgb.dump.Rd b/R-package/man/lgb.dump.Rd index a18483e3dad9..73226a36b1b2 100644 --- a/R-package/man/lgb.dump.Rd +++ b/R-package/man/lgb.dump.Rd @@ -29,11 +29,11 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) json_model <- lgb.dump(model) } diff --git a/R-package/man/lgb.get.eval.result.Rd b/R-package/man/lgb.get.eval.result.Rd index 52dd2b1dd18d..b13c151c9b57 100644 --- a/R-package/man/lgb.get.eval.result.Rd +++ b/R-package/man/lgb.get.eval.result.Rd @@ -36,11 +36,10 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) lgb.get.eval.result(model, "test", "l2") - } diff --git a/R-package/man/lgb.importance.Rd b/R-package/man/lgb.importance.Rd index 8e7fe941644e..6955fad34129 100644 --- a/R-package/man/lgb.importance.Rd +++ b/R-package/man/lgb.importance.Rd @@ -30,10 +30,9 @@ train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) params <- list(objective = "binary", - learning_rate = 0.01, num_leaves = 63, max_depth = -1, - min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) - model <- lgb.train(params, dtrain, 20) -model <- lgb.train(params, dtrain, 20) + learning_rate = 0.01, num_leaves = 63, max_depth = -1, + min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) +model <- lgb.train(params, dtrain, 10) tree_imp1 <- lgb.importance(model, percentage = TRUE) tree_imp2 <- lgb.importance(model, percentage = FALSE) diff --git a/R-package/man/lgb.interprete.Rd b/R-package/man/lgb.interprete.Rd index da28a542a852..62f5c58caa93 100644 --- a/R-package/man/lgb.interprete.Rd +++ b/R-package/man/lgb.interprete.Rd @@ -44,7 +44,7 @@ params <- list( , min_data_in_leaf = 1 , min_sum_hessian_in_leaf = 1 ) -model <- lgb.train(params, dtrain, 20) +model <- lgb.train(params, dtrain, 10) tree_interpretation <- lgb.interprete(model, test$data, 1:5) diff --git a/R-package/man/lgb.load.Rd b/R-package/man/lgb.load.Rd index bf298920e75d..943eb81ee2e3 100644 --- a/R-package/man/lgb.load.Rd +++ b/R-package/man/lgb.load.Rd @@ -31,11 +31,11 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) lgb.save(model, "model.txt") load_booster <- lgb.load(filename = "model.txt") model_string <- model$save_model_to_string(NULL) # saves best iteration diff --git a/R-package/man/lgb.model.dt.tree.Rd b/R-package/man/lgb.model.dt.tree.Rd index be622f428e43..c25d139fa12c 100644 --- a/R-package/man/lgb.model.dt.tree.Rd +++ b/R-package/man/lgb.model.dt.tree.Rd @@ -45,10 +45,9 @@ train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) params <- list(objective = "binary", - learning_rate = 0.01, num_leaves = 63, max_depth = -1, - min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) - model <- lgb.train(params, dtrain, 20) -model <- lgb.train(params, dtrain, 20) + learning_rate = 0.01, num_leaves = 63, max_depth = -1, + min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) +model <- lgb.train(params, dtrain, 10) tree_dt <- lgb.model.dt.tree(model) diff --git a/R-package/man/lgb.plot.importance.Rd b/R-package/man/lgb.plot.importance.Rd index 9e7e688d2bd9..84493b1e9e6c 100644 --- a/R-package/man/lgb.plot.importance.Rd +++ b/R-package/man/lgb.plot.importance.Rd @@ -43,7 +43,7 @@ params <- list( , min_sum_hessian_in_leaf = 1 ) -model <- lgb.train(params, dtrain, 20) +model <- lgb.train(params, dtrain, 10) tree_imp <- lgb.importance(model, percentage = TRUE) lgb.plot.importance(tree_imp, top_n = 10, measure = "Gain") diff --git a/R-package/man/lgb.plot.interpretation.Rd b/R-package/man/lgb.plot.interpretation.Rd index c69b8f3354e6..6d3637e9ea41 100644 --- a/R-package/man/lgb.plot.interpretation.Rd +++ b/R-package/man/lgb.plot.interpretation.Rd @@ -40,10 +40,9 @@ data(agaricus.test, package = "lightgbm") test <- agaricus.test params <- list(objective = "binary", - learning_rate = 0.01, num_leaves = 63, max_depth = -1, - min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) - model <- lgb.train(params, dtrain, 20) -model <- lgb.train(params, dtrain, 20) + learning_rate = 0.01, num_leaves = 63, max_depth = -1, + min_data_in_leaf = 1, min_sum_hessian_in_leaf = 1) +model <- lgb.train(params, dtrain, 10) tree_interpretation <- lgb.interprete(model, test$data, 1:5) lgb.plot.interpretation(tree_interpretation[[1]], top_n = 10) diff --git a/R-package/man/lgb.prepare.Rd b/R-package/man/lgb.prepare.Rd index 625cb5a8e2db..fd38d5046eb6 100644 --- a/R-package/man/lgb.prepare.Rd +++ b/R-package/man/lgb.prepare.Rd @@ -10,31 +10,20 @@ lgb.prepare(data) \item{data}{A data.frame or data.table to prepare.} } \value{ -The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. } \description{ -Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric without integers. Please use \code{lgb.prepare_rules} if you want to apply this transformation to other datasets. +Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric without integers. Please use \code{lgb.prepare_rules} if you want to apply this transformation to other datasets. } \examples{ library(lightgbm) data(iris) str(iris) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... str(lgb.prepare(data = iris)) # Convert all factors/chars to numeric -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : num 1 1 1 1 1 1 1 1 1 1 ... +\dontrun{ # When lightgbm package is installed, and you do not want to load it # You can still use the function! lgb.unloader() @@ -45,5 +34,6 @@ str(lightgbm::lgb.prepare(data = iris)) # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... # $ Species : num 1 1 1 1 1 1 1 1 1 1 ... +} } diff --git a/R-package/man/lgb.prepare2.Rd b/R-package/man/lgb.prepare2.Rd index 5739b03363d5..106ab21d587f 100644 --- a/R-package/man/lgb.prepare2.Rd +++ b/R-package/man/lgb.prepare2.Rd @@ -10,32 +10,21 @@ lgb.prepare2(data) \item{data}{A data.frame or data.table to prepare.} } \value{ -The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +The cleaned dataset. It must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. } \description{ -Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric (specifically: integer). Please use \code{lgb.prepare_rules2} if you want to apply this transformation to other datasets. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. +Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric (specifically: integer). Please use \code{lgb.prepare_rules2} if you want to apply this transformation to other datasets. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. } \examples{ library(lightgbm) data(iris) str(iris) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... # Convert all factors/chars to integer str(lgb.prepare2(data = iris)) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : int 1 1 1 1 1 1 1 1 1 1 ... +\dontrun{ # When lightgbm package is installed, and you do not want to load it # You can still use the function! lgb.unloader() @@ -46,5 +35,6 @@ str(lightgbm::lgb.prepare2(data = iris)) # $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... # $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... # $ Species : int 1 1 1 1 1 1 1 1 1 1 ... +} } diff --git a/R-package/man/lgb.prepare_rules.Rd b/R-package/man/lgb.prepare_rules.Rd index ac8a8d43ef45..939cb1fd58ef 100644 --- a/R-package/man/lgb.prepare_rules.Rd +++ b/R-package/man/lgb.prepare_rules.Rd @@ -12,37 +12,22 @@ lgb.prepare_rules(data, rules = NULL) \item{rules}{A set of rules from the data preparator, if already used.} } \value{ -A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. } \description{ -Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric. In addition, keeps rules created so you can convert other datasets using this converter. +Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric. In addition, keeps rules created so you can convert other datasets using this converter. } \examples{ library(lightgbm) data(iris) str(iris) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... new_iris <- lgb.prepare_rules(data = iris) # Autoconverter str(new_iris$data) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : num 1 1 1 1 1 1 1 1 1 1 ... data(iris) # Erase iris dataset iris$Species[1] <- "NEW FACTOR" # Introduce junk factor (NA) -# Warning message: -# In `[<-.factor`(`*tmp*`, 1, value = c(NA, 1L, 1L, 1L, 1L, 1L, 1L, : -# invalid factor level, NA generated # Use conversion using known rules # Unknown factors become 0, excellent for sparse datasets @@ -50,14 +35,11 @@ newer_iris <- lgb.prepare_rules(data = iris, rules = new_iris$rules) # Unknown factor is now zero, perfect for sparse datasets newer_iris$data[1, ] # Species became 0 as it is an unknown factor -# Sepal.Length Sepal.Width Petal.Length Petal.Width Species -# 1 5.1 3.5 1.4 0.2 0 newer_iris$data[1, 5] <- 1 # Put back real initial value # Is the newly created dataset equal? YES! all.equal(new_iris$data, newer_iris$data) -# [1] TRUE # Can we test our own rules? data(iris) # Erase iris dataset @@ -68,11 +50,5 @@ personal_rules <- list(Species = c("setosa" = 3, "virginica" = 1)) newest_iris <- lgb.prepare_rules(data = iris, rules = personal_rules) str(newest_iris$data) # SUCCESS! -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : num 3 3 3 3 3 3 3 3 3 3 ... } diff --git a/R-package/man/lgb.prepare_rules2.Rd b/R-package/man/lgb.prepare_rules2.Rd index 2422cbc073d0..5e2d909e9d6f 100644 --- a/R-package/man/lgb.prepare_rules2.Rd +++ b/R-package/man/lgb.prepare_rules2.Rd @@ -12,37 +12,22 @@ lgb.prepare_rules2(data, rules = NULL) \item{rules}{A set of rules from the data preparator, if already used.} } \value{ -A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in lgb.Dataset. +A list with the cleaned dataset (\code{data}) and the rules (\code{rules}). The data must be converted to a matrix format (\code{as.matrix}) for input in \code{lgb.Dataset}. } \description{ -Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric (specifically: integer). In addition, keeps rules created so you can convert other datasets using this converter. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. +Attempts to prepare a clean dataset to prepare to put in a \code{lgb.Dataset}. Factors and characters are converted to numeric (specifically: integer). In addition, keeps rules created so you can convert other datasets using this converter. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM. } \examples{ library(lightgbm) data(iris) str(iris) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 ... new_iris <- lgb.prepare_rules2(data = iris) # Autoconverter str(new_iris$data) -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : int 1 1 1 1 1 1 1 1 1 1 ... data(iris) # Erase iris dataset iris$Species[1] <- "NEW FACTOR" # Introduce junk factor (NA) -# Warning message: -# In `[<-.factor`(`*tmp*`, 1, value = c(NA, 1L, 1L, 1L, 1L, 1L, 1L, : -# invalid factor level, NA generated # Use conversion using known rules # Unknown factors become 0, excellent for sparse datasets @@ -50,14 +35,11 @@ newer_iris <- lgb.prepare_rules2(data = iris, rules = new_iris$rules) # Unknown factor is now zero, perfect for sparse datasets newer_iris$data[1, ] # Species became 0 as it is an unknown factor -# Sepal.Length Sepal.Width Petal.Length Petal.Width Species -# 1 5.1 3.5 1.4 0.2 0 newer_iris$data[1, 5] <- 1 # Put back real initial value # Is the newly created dataset equal? YES! all.equal(new_iris$data, newer_iris$data) -# [1] TRUE # Can we test our own rules? data(iris) # Erase iris dataset @@ -68,11 +50,5 @@ personal_rules <- list(Species = c("setosa" = 3L, "virginica" = 1L)) newest_iris <- lgb.prepare_rules2(data = iris, rules = personal_rules) str(newest_iris$data) # SUCCESS! -# 'data.frame': 150 obs. of 5 variables: -# $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... -# $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... -# $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... -# $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... -# $ Species : int 3 3 3 3 3 3 3 3 3 3 ... } diff --git a/R-package/man/lgb.save.Rd b/R-package/man/lgb.save.Rd index bad52ad603ad..f0ab4c593b42 100644 --- a/R-package/man/lgb.save.Rd +++ b/R-package/man/lgb.save.Rd @@ -31,11 +31,11 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) lgb.save(model, "model.txt") } diff --git a/R-package/man/lgb.train.Rd b/R-package/man/lgb.train.Rd index 7f1e9f957893..79b16ef88910 100644 --- a/R-package/man/lgb.train.Rd +++ b/R-package/man/lgb.train.Rd @@ -80,10 +80,9 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) - + early_stopping_rounds = 5) } diff --git a/R-package/man/lgb.unloader.Rd b/R-package/man/lgb.unloader.Rd index 9ea57f54a195..ab12dfe2cf23 100644 --- a/R-package/man/lgb.unloader.Rd +++ b/R-package/man/lgb.unloader.Rd @@ -31,16 +31,19 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) + +\dontrun{ lgb.unloader(restore = FALSE, wipe = FALSE, envir = .GlobalEnv) rm(model, dtrain, dtest) # Not needed if wipe = TRUE gc() # Not needed if wipe = TRUE library(lightgbm) # Do whatever you want again with LightGBM without object clashing +} } diff --git a/R-package/man/predict.lgb.Booster.Rd b/R-package/man/predict.lgb.Booster.Rd index 310375ba8742..480311889c76 100644 --- a/R-package/man/predict.lgb.Booster.Rd +++ b/R-package/man/predict.lgb.Booster.Rd @@ -55,11 +55,11 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) preds <- predict(model, test$data) } diff --git a/R-package/man/readRDS.lgb.Booster.Rd b/R-package/man/readRDS.lgb.Booster.Rd index 05f4eedb104e..cef1679ce53d 100644 --- a/R-package/man/readRDS.lgb.Booster.Rd +++ b/R-package/man/readRDS.lgb.Booster.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/readRDS.lgb.Booster.R \name{readRDS.lgb.Booster} \alias{readRDS.lgb.Booster} -\title{readRDS for lgb.Booster models} +\title{readRDS for \code{lgb.Booster} models} \usage{ readRDS.lgb.Booster(file = "", refhook = NULL) } @@ -12,7 +12,7 @@ readRDS.lgb.Booster(file = "", refhook = NULL) \item{refhook}{a hook function for handling reference objects.} } \value{ -lgb.Booster. +\code{lgb.Booster}. } \description{ Attempts to load a model using RDS. @@ -29,11 +29,11 @@ params <- list(objective = "regression", metric = "l2") valids <- list(test = dtest) model <- lgb.train(params, dtrain, - 100, + 10, valids, min_data = 1, learning_rate = 1, - early_stopping_rounds = 10) + early_stopping_rounds = 5) saveRDS.lgb.Booster(model, "model.rds") new_model <- readRDS.lgb.Booster("model.rds") diff --git a/R-package/man/saveRDS.lgb.Booster.Rd b/R-package/man/saveRDS.lgb.Booster.Rd index b302b2c3b6c0..54fd1d07867c 100644 --- a/R-package/man/saveRDS.lgb.Booster.Rd +++ b/R-package/man/saveRDS.lgb.Booster.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/saveRDS.lgb.Booster.R \name{saveRDS.lgb.Booster} \alias{saveRDS.lgb.Booster} -\title{saveRDS for lgb.Booster models} +\title{saveRDS for \code{lgb.Booster} models} \usage{ saveRDS.lgb.Booster(object, file = "", ascii = FALSE, version = NULL, compress = TRUE, refhook = NULL, raw = TRUE) @@ -41,11 +41,11 @@ valids <- list(test = dtest) model <- lgb.train( params , dtrain - , 100 + , 10 , valids , min_data = 1 , learning_rate = 1 - , early_stopping_rounds = 10 + , early_stopping_rounds = 5 ) saveRDS.lgb.Booster(model, "model.rds") } diff --git a/R-package/man/setinfo.Rd b/R-package/man/setinfo.Rd index 92da5034659a..861e5f0219ef 100644 --- a/R-package/man/setinfo.Rd +++ b/R-package/man/setinfo.Rd @@ -3,14 +3,14 @@ \name{setinfo} \alias{setinfo} \alias{setinfo.lgb.Dataset} -\title{Set information of an lgb.Dataset object} +\title{Set information of an \code{lgb.Dataset} object} \usage{ setinfo(dataset, ...) \method{setinfo}{lgb.Dataset}(dataset, name, info, ...) } \arguments{ -\item{dataset}{Object of class "lgb.Dataset"} +\item{dataset}{Object of class \code{lgb.Dataset}} \item{...}{other parameters} @@ -22,7 +22,7 @@ setinfo(dataset, ...) passed object } \description{ -Set information of an lgb.Dataset object +Set information of an \code{lgb.Dataset} object } \details{ The \code{name} field can be one of the following: diff --git a/R-package/man/slice.Rd b/R-package/man/slice.Rd index e126b89a837a..10040d11a2bc 100644 --- a/R-package/man/slice.Rd +++ b/R-package/man/slice.Rd @@ -10,7 +10,7 @@ slice(dataset, ...) \method{slice}{lgb.Dataset}(dataset, idxset, ...) } \arguments{ -\item{dataset}{Object of class "lgb.Dataset"} +\item{dataset}{Object of class \code{lgb.Dataset}} \item{...}{other parameters (currently not used)} @@ -21,7 +21,7 @@ constructed sub dataset } \description{ Get a new \code{lgb.Dataset} containing the specified rows of -original lgb.Dataset object +original \code{lgb.Dataset} object } \examples{ library(lightgbm)