Transform trees of a ranger-object to a matrix
ranger
forestToMatrix(rfObject)
ranger object
a matrix object with Column 1: tree ID Column 2: node ID Column 3: child node ID 1 Column 4: child node ID 2
matrix
# NOT RUN { library(ranger) rf.fit <- ranger(Species ~ ., data = iris, num.trees = 5, write.forest = TRUE) forestMat <- forestToMatrix(rf.fit) # }
Run the code above in your browser using DataLab