diff --git a/R-package/R/lgb.Dataset.R b/R-package/R/lgb.Dataset.R index c7e4d871ef45..b22021cef211 100644 --- a/R-package/R/lgb.Dataset.R +++ b/R-package/R/lgb.Dataset.R @@ -377,9 +377,9 @@ Dataset <- R6Class( ) ) -#' Contruct lgb.Dataset object +#' Construct lgb.Dataset object #' -#' Contruct lgb.Dataset object from dense matrix, sparse matrix +#' Construct 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 @@ -424,9 +424,9 @@ lgb.Dataset <- function(data, } -#' Contruct validation data +#' Construct validation data #' -#' Contruct validation data according to training data +#' Construct validation data according to training 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 diff --git a/R-package/man/lgb.Dataset.Rd b/R-package/man/lgb.Dataset.Rd index 2a1b784ff4a8..657c45f2800b 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{Contruct lgb.Dataset object} +\title{Construct lgb.Dataset object} \usage{ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, categorical_feature = NULL, free_raw_data = TRUE, info = list(), ...) @@ -28,7 +28,7 @@ lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL, constructed dataset } \description{ -Contruct lgb.Dataset object from dense matrix, sparse matrix +Construct 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 c3ce8b28a22b..f6fe1f807e93 100644 --- a/R-package/man/lgb.Dataset.create.valid.Rd +++ b/R-package/man/lgb.Dataset.create.valid.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/lgb.Dataset.R \name{lgb.Dataset.create.valid} \alias{lgb.Dataset.create.valid} -\title{Contruct validation data} +\title{Construct validation data} \usage{ lgb.Dataset.create.valid(dataset, data, info = list(), ...) } @@ -19,7 +19,7 @@ lgb.Dataset.create.valid(dataset, data, info = list(), ...) constructed dataset } \description{ -Contruct validation data according to training data +Construct validation data according to training data } \examples{ \dontrun{ diff --git a/docs/FAQ.md b/docs/FAQ.md index d7d1fbd82774..5762c9d4a774 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -20,11 +20,11 @@ LightGBM FAQ - **Solution 1**: this error should be solved in latest version. If you still meet this error, try to remove lightgbm.egg-info folder in your python-package and reinstall, or check [this thread on stackoverflow](http://stackoverflow.com/questions/18085571/pip-install-error-setup-script-specifies-an-absolute-path). -- **Question 2**: I see error messages like `Cannot get/set label/weight/init_score/group/num_data/num_feature before construct dataset`, but I already contruct dataset by some code like `train = lightgbm.Dataset(X_train, y_train)`, or error messages like `Cannot set predictor/reference/categorical feature after freed raw data, set free_raw_data=False when construct Dataset to avoid this.`. +- **Question 2**: I see error messages like `Cannot get/set label/weight/init_score/group/num_data/num_feature before construct dataset`, but I already construct dataset by some code like `train = lightgbm.Dataset(X_train, y_train)`, or error messages like `Cannot set predictor/reference/categorical feature after freed raw data, set free_raw_data=False when construct Dataset to avoid this.`. -- **Solution 2**: Because LightGBM contructs bin mappers to build trees, and train and valid Datasets within one Booster share the same bin mappers, categorical features and feature names etc., the Dataset objects are constructed when contruct a Booster. And if you set free_raw_data=True (default), the raw data (with python data struct) will be freed. So, if you want to: +- **Solution 2**: Because LightGBM constructs bin mappers to build trees, and train and valid Datasets within one Booster share the same bin mappers, categorical features and feature names etc., the Dataset objects are constructed when construct a Booster. And if you set free_raw_data=True (default), the raw data (with python data struct) will be freed. So, if you want to: - + get label(or weight/init_score/group) before contruct dataset, it's same as get `self.label` - + set label(or weight/init_score/group) before contruct dataset, it's same as `self.label=some_label_array` - + get num_data(or num_feature) before contruct dataset, you can get data with `self.data`, then if your data is `numpy.ndarray`, use some code like `self.data.shape` - + set predictor(or reference/categorical feature) after contruct dataset, you should set free_raw_data=False or init a Dataset object with the same raw data + + get label(or weight/init_score/group) before construct dataset, it's same as get `self.label` + + set label(or weight/init_score/group) before construct dataset, it's same as `self.label=some_label_array` + + get num_data(or num_feature) before construct dataset, you can get data with `self.data`, then if your data is `numpy.ndarray`, use some code like `self.data.shape` + + set predictor(or reference/categorical feature) after construct dataset, you should set free_raw_data=False or init a Dataset object with the same raw data