nodes: Extract Tree Node Information

View source: R/accessors.R

nodesR Documentation

Extract Tree Node Information

Description

Extracts the data frame describing the nodes of an E2Tree model, including split rules, predictions, and node statistics.

Usage

nodes(x, ...)

## S3 method for class 'e2tree'
nodes(x, terminal = FALSE, ...)

Arguments

x

An e2tree object.

...

Additional arguments (ignored).

terminal

Logical. If TRUE, return only terminal (leaf) nodes. Default is FALSE.

Value

A data frame with one row per node.

Examples


data(iris)
smp_size <- floor(0.75 * nrow(iris))
train_ind <- sample(seq_len(nrow(iris)), size = smp_size)
training <- iris[train_ind, ]

ensemble <- randomForest::randomForest(Species ~ ., data = training,
  importance = TRUE, proximity = TRUE)
D <- createDisMatrix(ensemble, data = training, label = "Species",
  parallel = list(active = FALSE, no_cores = 1))
setting <- list(impTotal = 0.1, maxDec = 0.01, n = 2, level = 5)
tree <- e2tree(Species ~ ., training, D, ensemble, setting)

nodes(tree)
nodes(tree, terminal = TRUE)



e2tree documentation built on May 15, 2026, 5:06 p.m.