Converts the tree in an SDTree object from
class list
to class Node
Glur2023Data.tree:StructureSDModels.
# S3 method for class 'SDTree'
fromList(object, ...)
an SDTree object with the tree in Node format
set.seed(1)
n <- 10
X <- matrix(rnorm(n * 5), nrow = n)
y <- sign(X[, 1]) * 3 + rnorm(n)
model <- SDTree(x = X, y = y, Q_type = 'no_deconfounding', cp = 0.5)
fromList(toList(model))
#> levelName value s j label decision n_samples
#> 1 1 0.7434569 0.2565755 1 X1 <= 0.26 10
#> 2 ¦--1 -1.4054911 NA NA -1.4 yes 5
#> 3 °--2 2.8924048 NA NA 2.9 no 5