CategoricalData creates an data object which can be used as source object to instantiate categorical base learner.

Format

S4 object.

Usage

CategoricalData$new(x, data_identifier)

Arguments

x [character]

Character vector containing the classes.

data_identifier [character(1)]

The name for the data specified in data_mat. Note that it is important to have the same data names for train and evaluation data.

Fields

This class doesn't contain public fields.

Methods

getData()

Get numerical representation of the data.

getIdentifier()

Get data identifier.

getDictionary()

Get internal encoding to map numerical encoding to raw data.

Examples

# Sample data: x = sample(c("one","two", "three"), 20, TRUE) # Create new data object: data_obj = CategoricalData$new(x, "cat") # Get data and identifier: data_obj$getData()
#> [,1] #> [1,] 0 #> [2,] 1 #> [3,] 0 #> [4,] 1 #> [5,] 2 #> [6,] 1 #> [7,] 0 #> [8,] 1 #> [9,] 0 #> [10,] 1 #> [11,] 2 #> [12,] 0 #> [13,] 1 #> [14,] 1 #> [15,] 2 #> [16,] 1 #> [17,] 0 #> [18,] 0 #> [19,] 2 #> [20,] 1
data_obj$getIdentifier()
#> [1] "cat"
data_obj$getDictionary()
#> one three two #> 0 2 1