lgb.Dataset.set.categorical.Rd 1.03 KB
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
4
5
6
7
8
9
10
11
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{lgb.Dataset.set.categorical}
\alias{lgb.Dataset.set.categorical}
\title{Set categorical feature of \code{lgb.Dataset}}
\usage{
lgb.Dataset.set.categorical(dataset, categorical_feature)
}
\arguments{
\item{dataset}{object of class \code{lgb.Dataset}}

12
13
14
\item{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.
\code{c(1L, 10L)} to say "the first and tenth columns").}
Guolin Ke's avatar
Guolin Ke committed
15
16
17
18
19
}
\value{
passed dataset
}
\description{
20
21
Set the categorical features of an \code{lgb.Dataset} object. Use this function
             to tell LightGBM which features should be treated as categorical.
Guolin Ke's avatar
Guolin Ke committed
22
23
24
25
26
27
28
29
}
\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")
30
lgb.Dataset.set.categorical(dtrain, 1L:2L)
Guolin Ke's avatar
Guolin Ke committed
31
32

}