Set categorical feature of lgb.Dataset
lgb.Dataset.set.categorical(dataset, categorical_feature)
dataset | object of class |
---|---|
categorical_feature | categorical features |
passed dataset
library(lightgbm) data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) lgb.Dataset.save(dtrain, "lgb.Dataset.data") dtrain <- lgb.Dataset("lgb.Dataset.data") lgb.Dataset.set.categorical(dtrain, 1:2)