gpb.Dataset.set.categorical: Set categorical feature of 'gpb.Dataset'

View source: R/gpb.Dataset.R

gpb.Dataset.set.categoricalR Documentation

Set categorical feature of gpb.Dataset

Description

Set the categorical features of an gpb.Dataset object. Use this function to tell GPBoost which features should be treated as categorical.

Usage

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

Arguments

dataset

object of class gpb.Dataset

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. c(1L, 10L) to say "the first and tenth columns").

Value

the dataset you passed in

Examples


data(agaricus.train, package = "gpboost")
train <- agaricus.train
dtrain <- gpb.Dataset(train$data, label = train$label)
data_file <- tempfile(fileext = ".data")
gpb.Dataset.save(dtrain, data_file)
dtrain <- gpb.Dataset(data_file)
gpb.Dataset.set.categorical(dtrain, 1L:2L)


gpboost documentation built on Oct. 24, 2023, 9:09 a.m.