| set_field {lightgbm} | R Documentation |
lgb.Dataset objectSet one attribute of a lgb.Dataset
set_field(dataset, field_name, data) ## S3 method for class 'lgb.Dataset' set_field(dataset, field_name, data)
dataset |
Object of class |
field_name |
String with the name of the attribute to set. One of the following.
|
data |
The data for the field. See examples. |
The lgb.Dataset you passed in.
data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) lgb.Dataset.construct(dtrain) labels <- lightgbm::get_field(dtrain, "label") lightgbm::set_field(dtrain, "label", 1 - labels) labels2 <- lightgbm::get_field(dtrain, "label") stopifnot(all.equal(labels2, 1 - labels))