select_trees | R Documentation |
select_trees
uses pair-wise dissimilarity of trees in a random
forest trained with ranger
to identify the most representative trees
from the ensemble
select_trees(rf, num.trees = NULL, distance.matrix = NULL)
rf |
Object of class |
num.trees |
Number of trees to be selected from |
distance.matrix |
Add matrix of precalculated distances. |
rep.trees |
|
Dr. Bjoern-Hergen Laabs
require(ranger)
require(timbR)
## Train random forest with ranger
rg.iris <- ranger(Species ~ ., data = iris, write.forest=TRUE, num.trees = 10)
## Calculate pair-wise distances for all trees
distances <- measure_distances(rf = rg.iris, metric = "splitting variables")
## Select 5 most representative trees
rg.iris.rep <- select_trees(rf = rg.iris, num.trees = 5, distance.matrix = distances)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.