Depth of each terminal node of all trees in a ranger model is returned as a three column tibble with column names: 'id_tree', 'id_node', 'depth'. Note that root node has the node_id = 0.

terminalNodesDepth(model)

Arguments

model

A ranger model

Value

A tibble with three columns: 'id_tree', 'id_node', 'depth'.

Details

This function may be parallelized using a future backend.

Examples

rf = ranger::ranger(Species ~ ., data = iris, num.trees = 100) terminalNodesDepth(rf)
#> id_tree id_node depth #> 1: 1 1 1 #> 2: 1 6 3 #> 3: 1 7 3 #> 4: 1 9 4 #> 5: 1 10 4 #> --- #> 881: 100 11 5 #> 882: 100 13 5 #> 883: 100 14 5 #> 884: 100 15 6 #> 885: 100 16 6