Learn R Programming

CORElearn (version 1.57.3)

getCoreModel: Conversion of model to a list

Description

Function converts given model from internal structures in C++ to R's data structures.

Usage

getCoreModel(model)

Value

For random forest a resulting list contains first all the information on the forest level, followed by the list of trees. For each tree the nodes are recursively nested with indication of node type (leaf or internal node) and than required information for that data type.

Arguments

model

The model structure as returned by CoreModel.

Author

Marko Robnik-Sikonja

Details

The function converts the model referenced by model from C++ internal structures to R's lists. Currently it is implemented only for random forests models.

See Also

CoreModel, CORElearn.

Examples

Run this code
# uses iris data set

# build random forests model with certain parameters, 
# do not make too many and too large trees
modelRF <- CoreModel(Species ~ ., iris, model="rf", 
              selectionEstimator="MDL", minNodeWeightRF=50,
              rfNoTrees=5, maxThreads=1)
print(modelRF)

# get the structure of the forest 
forest <- getCoreModel(modelRF) 
# forest

destroyModels(modelRF) # clean up
 

Run the code above in your browser using DataLab