Get a new lgb.Dataset containing the specified rows of
original lgb.Dataset object
slice(dataset, ...) # S3 method for lgb.Dataset slice(dataset, idxset, ...)
| dataset | Object of class "lgb.Dataset" |
|---|---|
| ... | other parameters (currently not used) |
| idxset | a integer vector of indices of rows needed |
constructed sub dataset
library(lightgbm) data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) dsub <- lightgbm::slice(dtrain, 1:42) lgb.Dataset.construct(dsub) labels <- lightgbm::getinfo(dsub, "label")