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

# \donttest{ data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) data_file <- tempfile(fileext = ".data") lgb.Dataset.save(dtrain, data_file)
#> [LightGBM] [Info] Saving data to binary file /tmp/RtmpaV8Xit/file7d17e21657.data
dtrain <- lgb.Dataset(data_file) lgb.Dataset.construct(dtrain) # }