grmforest.control: Control Parameters for GRM Forests

View source: R/grmforest-control.R

grmforest.controlR Documentation

Control Parameters for GRM Forests

Description

Creates a control object governing how a forest of graded response model trees is grown: how observations are resampled for each tree, how many partitioning variables are offered at each split, how failures are handled, and how the work is distributed across processor cores.

Usage

grmforest.control(
  n_tree = 100,
  sampling = c("subsample", "bootstrap"),
  sample_fraction = NULL,
  mtry = NULL,
  remove_dead_trees = TRUE,
  control = grmtree.control(),
  n_cores = 1,
  seed = NULL,
  verbose = FALSE
)

Arguments

n_tree

Number of trees in the forest (default: 100).

sampling

Resampling scheme for each tree: "bootstrap" (drawn with replacement) or "subsample" (drawn without replacement). Default "subsample".

sample_fraction

Fraction of the original sample drawn for each tree. If NULL (the default) this is set to 1 for bootstrap sampling and 0.632 for subsampling, following Strobl et al. (2007).

mtry

Number of partitioning variables randomly offered as split candidates at each node. NULL (default) offers all variables, which grows a bagged ensemble rather than a random forest. A common choice is ceiling(sqrt(p)) for p partitioning variables.

remove_dead_trees

Logical. If TRUE (default), trees that fail to fit are dropped with a warning; if FALSE, a failure aborts the forest.

control

Control parameters for the individual trees, created by grmtree.control().

n_cores

Number of processor cores used to fit trees in parallel (default: 1). Results do not depend on this value: all resampling indices are drawn in the master process before any fitting begins, so a forest grown on 20 cores is identical to the same forest grown on one.

seed

Random seed for reproducibility (default: NULL).

verbose

Logical. Report progress while growing the forest (default: FALSE).

Value

A list of class grmforest_control.

Reproducibility and parallelism

Naive parallelisation of a tree ensemble can silently change results, because each worker inherits or advances the random number stream differently; in the worst case several workers draw identical resamples and the ensemble carries far less variance than it appears to. This implementation avoids the problem structurally: the full list of n_tree resampling index vectors is generated serially under seed before any tree is fitted, and tree fitting is a deterministic function of those indices. n_cores therefore affects only elapsed time.

References

Strobl, C., Boulesteix, A.-L., Zeileis, A., & Hothorn, T. (2007). Bias in random forest variable importance measures. BMC Bioinformatics, 8, 25.

See Also

grmtree.control creates a control object for grmtree, plot.grmtree creates plot for the grmtree object, grmforest for GRM Forests,

Examples

# Bagged ensemble of 50 trees
ctrl <- grmforest.control(n_tree = 50)

# Random-forest style, 4 candidate variables per split, 4 cores
ctrl <- grmforest.control(n_tree = 100, mtry = 4, n_cores = 4, seed = 123)


grmtree documentation built on Sept. 2, 2026, 1:07 a.m.