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 | object of class |
---|---|
categorical_feature | categorical features. This can either be a character vector of feature
names or an integer vector with the indices of the features (e.g.
|
passed dataset
# \dontrun{ 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)#> [LightGBM] [Info] Saving data to binary file /var/folders/xq/wktq4zdx4jd3qdpk34d28m940000gn/T//RtmpqMPu1E/file1452441ed692.data