Construct lgb.Dataset object from dense matrix, sparse matrix or local file (that was created previously by saving an lgb.Dataset).

lgb.Dataset(data, params = list(), reference = NULL, colnames = NULL,
  categorical_feature = NULL, free_raw_data = TRUE, info = list(),
  ...)

Arguments

data

a matrix object, a dgCMatrix object or a character representing a filename

params

a list of parameters

reference

reference dataset

colnames

names of columns

categorical_feature

categorical features

free_raw_data

TRUE for need to free raw data after construct

info

a list of information of the lgb.Dataset object

...

other information to pass to info or parameters pass to params

Value

constructed dataset

Examples

library(lightgbm) data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) lgb.Dataset.save(dtrain, "lgb.Dataset.data") dtrain <- lgb.Dataset("lgb.Dataset.data") lgb.Dataset.construct(dtrain)