lgb.slice.Dataset: Slice a dataset

View source: R/lgb.Dataset.R

lgb.slice.DatasetR Documentation

Slice a dataset

Description

Get a new lgb.Dataset containing the specified rows of original lgb.Dataset object

Renamed from slice() in 4.4.0

Usage

lgb.slice.Dataset(dataset, idxset)

Arguments

dataset

Object of class lgb.Dataset

idxset

an integer vector of indices of rows needed

Value

constructed sub dataset

Examples




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

dsub <- lgb.slice.Dataset(dtrain, seq_len(42L))
lgb.Dataset.construct(dsub)
labels <- lightgbm::get_field(dsub, "label")


lightgbm documentation built on Sept. 11, 2024, 8:44 p.m.