stabletree {stablelearner} | R Documentation |
Stability assessment of variable and cutpoint selection in tree learners (i.e., recursive partitioning). By refitting trees to resampled versions of the learning data, the stability of the trees structure is assessed and can be summarized and visualized.
stabletree(x, data = NULL, sampler = bootstrap, weights = NULL, applyfun = NULL, cores = NULL, savetrees = FALSE, ...)
x |
fitted model object. Any tree-based model object that can be coerced
by |
data |
an optional |
sampler |
a resampling (generating) function. Either this should be a function
of |
weights |
an optional matrix of dimension n * B that can be used to
weight the observations from the original learning data when the trees
are refitted. If |
applyfun |
a |
cores |
integer. The number of cores to use in multicore computations
using |
savetrees |
logical. If |
... |
further arguments passed to |
The function stabletree
assesses the stability of tree learners (i.e.,
recursive partitioning methods) by refitting the tree to resampled versions
of the learning data. By default, if data = NULL
, the fitting call is
extracted by getCall
to infer the learning data.
Subsequently, the sampler
generates B
resampled versions
of the learning data, the tree is regrown with update
,
and (if necessary) coerced by as.party
. For each
of the resampled trees it is queried and stored which variables are selected
for splitting and what the selected cutpoints are.
The resulting object of class "stabletree"
comes with a set of
standard methods to generic functions including print
, summary
for numerical summaries and plot
, barplot
, and image
for graphical representations. See plot.stabletree
for more
details.
stabletree
returns an object of class "stabletree"
which is a list with
the following components:
call |
the call from the model object |
B |
the number of resampled datasets, |
sampler |
the |
vs0 |
FIXME better name?, |
br0 |
FIXME better name?, |
vs |
FIXME better name?, |
br |
FIXME better name?, |
classes |
character vector indicating the classes of all partitioning variables, |
trees |
a list of tree objects of class |
Hothorn T, Zeileis A (2015). partykit: A Modular Toolkit for Recursive Partytioning in R. Journal of Machine Learning Research, 16, 3905–3909.
Philipp M, Zeileis A, Strobl C (2016). “A Toolkit for Stability Assessment of Tree-Based Learners”. In A. Colubi, A. Blanco, and C. Gatu (Eds.), Proceedings of COMPSTAT 2016 – 22nd International Conference on Computational Statistics (pp. 315–325). The International Statistical Institute/International Association for Statistical Computing. Preprint available at http://EconPapers.RePEc.org/RePEc:inn:wpaper:2016-11
## build a simple tree library("partykit") m <- ctree(Species ~ ., data = iris) plot(m) ## investigate stability set.seed(0) s <- stabletree(m, B = 500) print(s) ## variable selection statistics summary(s) ## show variable selection proportions barplot(s) ## illustrate variable selections of replications image(s) ## graphical cutpoint analysis plot(s)