Setup hyperparameters for GLMTree: model-based recursive partitioning, a tree carrying a generalized linear model in each leaf.
setup_GLMTree(
alpha = 0.05,
minsize = NULL,
maxdepth = NULL,
mtry = NULL,
trim = 0.1,
prune = NULL,
numsplit = "left",
catsplit = "binary",
ordinal = "chisq",
ifw = FALSE,
regressors = NULL,
partitioning_variables = NULL,
bonferroni = TRUE,
breakties = FALSE,
restart = TRUE,
dfsplit = TRUE,
vcov = "opg",
nrep = 10000L
)GLMTreeHyperparameters object.
(Tunable) Numeric (0, 1]: Significance level a parameter-instability test must reach before a node is split.
(Tunable) Optional Integer [1, Inf): Fewest cases a node may hold. NULL uses ten times the number of parameters in a leaf's model.
(Tunable) Optional Integer [1, Inf): Deepest the tree may grow. NULL is unlimited.
(Tunable) Optional Integer [1, Inf): Partitioning variables sampled at each node. NULL tests every one.
(Tunable) Numeric [0, Inf): Trimming for the split-point search; a fraction of cases below 1, a count at or above it.
(Tunable) Optional Character {"AIC", "BIC"}: Post-prune the grown tree by an information criterion. NULL keeps every split.
(Tunable) Character {"left", "center"}: Where a numeric split is placed.
(Tunable) Character {"binary", "multiway"}: How a categorical variable is split.
(Tunable) Character {"chisq", "max", "L2"}: Test statistic for an ordered partitioning variable.
(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.
Optional Character vector: Features entering the linear model in each leaf. NULL uses every feature.
Optional Character vector: Features the tree may split on. NULL uses every feature.
Logical: If TRUE, Bonferroni-adjust the test p-values for the number of partitioning variables.
Logical: If TRUE, break ties in numeric partitioning variables by adding noise.
Logical: If TRUE, restart each leaf's model from scratch rather than from its parent's fit.
Logical: If TRUE, count each split against the degrees of freedom when pruning.
Character {"opg", "info", "sandwich"}: Covariance estimator the instability test is built on.
Integer [1, Inf): Simulation replicates for the p-value of an ordinal split statistic.
A node is split when a parameter-instability test, a structural change
test at significance level alpha, rejects constancy of its model's
coefficients across a candidate partitioning variable. Consequences:
Splits carry p-values, and
alpha is a significance level with a direct interpretation.
A tree that splits on the response mean does not.
With few cases, many partitioning
variables, or both, the tests do not reach alpha and the tree does not
split at all -- returning a single global model.
The default minsize is ten times the number of parameters in a leaf's
model, and that scales with the number of regressors. A split has to leave
minsize cases on each side, so with p regressors no split is possible
below n = 20 * (p + 1): 420 cases at 20 regressors, for any alpha. On a
wide design, a single-leaf tree results from this bound rather than from
alpha. Set minsize directly, or narrow regressors.
regressors and partitioning_variables are set independently: the model
in each leaf may use features other than those the tree splits on. Both
default to every feature.
Every leaf carries a full model over regressors, with no selection or
shrinkage: one coefficient per regressor. Restrict regressors to reduce
the number of coefficients.
partykit provides variable importance for cforest and for constant-fit
trees, not for a model-based tree. get_varimp() returns NULL;
get_varimp(explain(mod, newdata)) returns a per-feature measure.
EDG
Where a decision tree predicts a constant in each leaf, a GLMTree fits a
regression there, so the model reads as "in this subgroup, these are the
coefficients". partykit::lmtree() fits a regression, partykit::glmtree()
a binary logistic one; rtemis selects between them from the outcome.
Zeileis A, Hothorn T, Hornik K (2008). Model-Based Recursive Partitioning. Journal of Computational and Graphical Statistics, 17(2), 492-514. tools:::Rd_expr_doi("10.1198/106186008X319331")
glmtree_hyperparams <- setup_GLMTree(alpha = 0.01)
glmtree_hyperparams
Run the code above in your browser using DataLab