Setup hyperparameters for Ranger Random Forest training.
setup_Ranger(
num_trees = 500L,
mtry = NULL,
importance = "impurity",
write_forest = TRUE,
probability = FALSE,
min_node_size = NULL,
min_bucket = NULL,
max_depth = NULL,
replace = TRUE,
sample_fraction = ifelse(replace, 1, 0.632),
class_weights = NULL,
splitrule = NULL,
num_random_splits = 1L,
alpha = 0.5,
minprop = 0.1,
poisson_tau = 1,
split_select_weights = NULL,
always_split_variables = NULL,
respect_unordered_factors = NULL,
scale_permutation_importance = FALSE,
local_importance = FALSE,
regularization_factor = 1,
regularization_usedepth = FALSE,
keep_inbag = FALSE,
inbag = NULL,
holdout = FALSE,
quantreg = FALSE,
time_interest = NULL,
oob_error = TRUE,
save_memory = FALSE,
verbose = TRUE,
node_stats = FALSE,
seed = NULL,
na_action = "na.learn",
ifw = FALSE
)RangerHyperparameters object.
(Tunable) Integer [1, Inf): Number of trees.
(Tunable) Optional Integer [1, Inf): Number of features to consider at each split.
Character {"none", "impurity", "impurity_corrected", "permutation"}: Variable importance mode. "impurity" is the Gini index for classification, the response variance for regression.
Logical: If TRUE, save the forest object (required for prediction). Set to FALSE to reduce memory if no prediction is intended.
Logical: If TRUE, grow a probability forest. Classification only.
(Tunable) Optional Integer [1, Inf): Minimal node size. If NULL, ranger uses 1 for classification, 5 for regression, 3 for survival, and 10 for probability.
Optional Integer [1, Inf): Fewest cases a terminal node may hold; no split creates a smaller node. Unset uses ranger's default of 1.
(Tunable) Optional Integer [0, Inf): Maximal tree depth. NULL or 0 means unlimited depth, 1 means tree stumps.
(Tunable) Logical: If TRUE, sample with replacement.
(Tunable) Numeric (0, 1]: Fraction of observations to sample. Default is 1 with replacement and 0.632 without.
Optional Numeric [0, Inf) vector: Per-class weights for classification. Length equal to the number of classes, named by class label. NULL weights every class equally.
(Tunable) Optional Character: Splitting rule. Classification: "gini", "extratrees", "hellinger"; regression: "variance", "extratrees", "maxstat", "beta"; survival: "logrank", "extratrees", "C", "maxstat".
(Tunable) Integer [1, Inf): Number of random splits per candidate variable, for the "extratrees" splitrule.
(Tunable) Numeric [0, 1]: Significance threshold to allow splitting, for the "maxstat" splitrule.
(Tunable) Numeric [0, 1]: Lower quantile of the covariate distribution considered for splitting, for the "maxstat" splitrule.
Numeric (0, Inf): Tau parameter, for the "poisson" regression splitrule.
Optional List: Per-feature probabilities of being selected for splitting, in [0, 1]. One vector applied to every tree, or a list of length num_trees with one vector per tree. NULL gives every feature the same probability.
Optional Character vector: Names of variables to always include as split candidates, in addition to the mtry variables. NULL adds none.
Optional Character {"partition", "ignore", "order"}: Handling of unordered factors. "partition" considers all 2-partitions, "ignore" orders levels by first occurrence, "order" orders levels by mean response.
Logical: If TRUE, scale permutation importance by its standard error. Permutation importance only.
Logical: If TRUE, compute local (per-observation) permutation importance.
(Tunable) Numeric [0, Inf): Regularization factor penalizing variables with many split points. Requires splitrule = "variance".
Logical: If TRUE, apply the regularization factor with node depth. Requires regularization_factor.
Logical: If TRUE, record how often each observation is in-bag per tree.
Optional List: Manually set in-bag counts; a list of length num_trees, each a per-case count vector. Can be used for stratified sampling. NULL draws each tree's sample by replace and sample_fraction, with the training case weights as sampling weights where train supplies them.
Logical: If TRUE, use hold-out mode: hold out samples with case weight 0 and use them for variable importance and prediction error.
Logical: If TRUE, prepare quantile prediction (quantile regression forests). Regression only; set keep_inbag = TRUE for out-of-bag quantile prediction.
Optional Numeric vector: Time points of interest for survival prediction. Survival only. NULL uses the observed event times.
Logical: If TRUE, compute the OOB prediction error. Set to FALSE to save time if only the forest is needed.
Logical: If TRUE, use the memory-saving (slower) splitting mode.
Logical: If TRUE, show computation status and estimated runtime.
Logical: If TRUE, save additional node statistics (terminal nodes only).
Optional Integer: Random seed. If NULL, the seed is generated from R. Set to 0 to ignore the R seed.
Character {"na.learn", "na.omit", "na.fail"}: How to handle missing values. "na.learn" uses observations with missing values in splitting, treating missing as a separate category.
(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.
EDG
Get more information from ranger::ranger.
ranger_hyperparams <- setup_Ranger(num_trees = 1000L, ifw = FALSE)
ranger_hyperparams
Run the code above in your browser using DataLab