Learn R Programming

lightgbm (version 3.2.1)

lgb.Dataset: Construct lgb.Dataset object

Description

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

Usage

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

Run this code
# NOT RUN {
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)
dtrain <- lgb.Dataset(data_file)
lgb.Dataset.construct(dtrain)
# }

Run the code above in your browser using DataLab