BlearnerFactoryList creates an object in which base-learner factories can be registered. This object can then be passed to compboost as set of base-learner which is used by the optimizer to get the new best base-learner.

Format

S4 object.

Usage

BlearnerFactoryList$new()

Details

This class is a wrapper around the pure C++ implementation. To see the functionality of the C++ class visit https://schalkdaniel.github.io/compboost/cpp_man/html/classblearnerlist_1_1_baselearner_factory_list.html.

Fields

This class doesn't contain public fields.

Methods

registerFactory(BaselearnerFactory)

Takes a object of the class BaseLearnerFactory and adds this factory to the set of base-learner.

printRegisteredFactories()

Get all registered factories.

clearRegisteredFactories()

Remove all registered factories. Note that the factories are not deleted, just removed from the map.

getModelFrame()

Get each target data matrix parsed to one big matrix.

getNumberOfRegisteredFactories()

Get the number of registered factories.

Examples

# Sample data: data_mat = cbind(1:10) # Create new data object: data_source = InMemoryData$new(data_mat, "my_data_name") data_target1 = InMemoryData$new() data_target2 = InMemoryData$new() lin_factory = BaselearnerPolynomial$new(data_source, data_target1, list(degree = 1, intercept = TRUE)) poly_factory = BaselearnerPolynomial$new(data_source, data_target2, list(degree = 2, intercept = TRUE)) # Create new base-learner list: my_bl_list = BlearnerFactoryList$new() # Register factories: my_bl_list$registerFactory(lin_factory) my_bl_list$registerFactory(poly_factory) # Get registered factories: my_bl_list$printRegisteredFactories()
#> Registered base-learner: #> - my_data_name_polynomial_degree_1 #> - my_data_name_polynomial_degree_2
# Get all target data matrices in one big matrix: my_bl_list$getModelFrame()
#> $colnames #> [1] "my_data_name_polynomial_degree_1x11" "my_data_name_polynomial_degree_1x12" #> [3] "my_data_name_polynomial_degree_2x11" "my_data_name_polynomial_degree_2x12" #> #> $model_frame #> [,1] [,2] [,3] [,4] #> [1,] 1 1 1 1 #> [2,] 1 2 1 1 #> [3,] 1 3 1 1 #> [4,] 1 4 1 1 #> [5,] 1 5 1 1 #> [6,] 1 6 1 1 #> [7,] 1 7 1 1 #> [8,] 1 8 1 1 #> [9,] 1 9 1 1 #> [10,] 1 10 1 1 #>
# Clear list: my_bl_list$clearRegisteredFactories() # Get number of registered factories: my_bl_list$getNumberOfRegisteredFactories()
#> [1] 0