Set categorical feature of lgb.Dataset
lgb.Dataset
Set the categorical features of an lgb.Dataset object. Use this function to tell LightGBM which features should be treated as categorical.
lgb.Dataset.set.categorical(dataset, categorical_feature)
dataset
categorical_feature
c(1L, 10L)
the dataset you passed in
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.set.categorical(dtrain, 1L:2L)
Useful links