R: Set categorical feature of 'lgb.Dataset'

lgb.Dataset.set.categorical {lightgbm} | R Documentation

## Set categorical feature of `lgb.Dataset`

### Description

Set categorical feature of `lgb.Dataset`

### Usage

    lgb.Dataset.set.categorical(dataset, categorical_feature)

### Arguments

`dataset` | object of class `lgb.Dataset`
`categorical_feature` | categorical features

### Value

passed dataset

### Examples

    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)

[Package lightgbm version 2.2.2 Index]