InMemoryData creates an data object which can be used as source or target object within the base-learner factories of compboost. The convention to initialize target data is to call the constructor without any arguments.


S4 object.


InMemoryData$new(data_mat, data_identifier)


data_mat [matrix]

Matrix containing the source data. This source data is later transformed to obtain the design matrix a base-learner uses for training.

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.


The data_mat needs to suits the base-learner. For instance, the spline base-learner does just take a one column matrix since there are just one dimensional splines till now. Additionally, using the polynomial base-learner the data_mat is used to control if a intercept should be fitted or not by adding a column containing just ones. It is also possible to add other columns to estimate multiple features simultaneously. Anyway, this is not recommended in terms of unbiased features selection.

The data_mat and data_identifier of a target data object is set automatically by passing the source and target object to the desired factory. getData() can then be used to access the transformed data of the target object.

This class is a wrapper around the pure C++ implementation. To see the functionality of the C++ class visit


This class doesn't contain public fields.



method extract the data_mat from the data object.


method to extract the used name from the data object.


# Sample data: data_mat = cbind(1:10) # Create new data object: data_obj = InMemoryData$new(data_mat, "my_data_name") # Get data and identifier: data_obj$getData()
#> [,1] #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5 #> [6,] 6 #> [7,] 7 #> [8,] 8 #> [9,] 9 #> [10,] 10
#> [1] "my_data_name"