Object used to get / set parameters and other model configuration options for a forest model in the "low-level" stochtree interface
Source:R/config.R
ForestModelConfig.Rd
The "low-level" stochtree interface enables a high degreee of sampler customization, in which users employ R wrappers around C++ objects like ForestDataset, Outcome, CppRng, and ForestModel to run the Gibbs sampler of a BART model with custom modifications. ForestModelConfig allows users to specify / query the parameters of a forest model they wish to run.
Value
Vector of integer-coded feature types (integers where 0 = numeric, 1 = ordered categorical, 2 = unordered categorical)
Vector specifying sampling probability for all p covariates in ForestDataset
Number of trees in a forest
Number of features in a forest model training set
Number of observations in a forest model training set
Root node split probability in tree prior
Depth prior penalty in tree prior
Minimum number of samples in a tree leaf
Maximum depth of any tree in the ensemble in the model
Integer coded leaf model type
Scale parameter used in Gaussian leaf models
Shape parameter for IG leaf models
Scale parameter for IG leaf models
Number of unique cutpoints to consider
Public fields
feature_types
Vector of integer-coded feature types (integers where 0 = numeric, 1 = ordered categorical, 2 = unordered categorical)
num_trees
Number of trees in the forest being sampled
num_features
Number of features in training dataset
num_observations
Number of observations in training dataset
leaf_dimension
Dimension of the leaf model
alpha
Root node split probability in tree prior
beta
Depth prior penalty in tree prior
min_samples_leaf
Minimum number of samples in a tree leaf
max_depth
Maximum depth of any tree in the ensemble in the model. Setting to
-1
does not enforce any depth limits on trees.leaf_model_type
Integer specifying the leaf model type (0 = constant leaf, 1 = univariate leaf regression, 2 = multivariate leaf regression)
leaf_model_scale
Scale parameter used in Gaussian leaf models
variable_weights
Vector specifying sampling probability for all p covariates in ForestDataset
variance_forest_shape
Shape parameter for IG leaf models (applicable when
leaf_model_type = 3
)variance_forest_scale
Scale parameter for IG leaf models (applicable when
leaf_model_type = 3
)cutpoint_grid_size
Number of unique cutpoints to consider Create a new ForestModelConfig object.
Methods
Method new()
Usage
ForestModelConfig$new(
feature_types = NULL,
num_trees = NULL,
num_features = NULL,
num_observations = NULL,
variable_weights = NULL,
leaf_dimension = 1,
alpha = 0.95,
beta = 2,
min_samples_leaf = 5,
max_depth = -1,
leaf_model_type = 1,
leaf_model_scale = NULL,
variance_forest_shape = 1,
variance_forest_scale = 1,
cutpoint_grid_size = 100
)
Arguments
feature_types
Vector of integer-coded feature types (where 0 = numeric, 1 = ordered categorical, 2 = unordered categorical)
num_trees
Number of trees in the forest being sampled
num_features
Number of features in training dataset
num_observations
Number of observations in training dataset
variable_weights
Vector specifying sampling probability for all p covariates in ForestDataset
leaf_dimension
Dimension of the leaf model (default:
1
)alpha
Root node split probability in tree prior (default:
0.95
)beta
Depth prior penalty in tree prior (default:
2.0
)min_samples_leaf
Minimum number of samples in a tree leaf (default:
5
)max_depth
Maximum depth of any tree in the ensemble in the model. Setting to
-1
does not enforce any depth limits on trees. Default:-1
.leaf_model_type
Integer specifying the leaf model type (0 = constant leaf, 1 = univariate leaf regression, 2 = multivariate leaf regression). Default:
0
.leaf_model_scale
Scale parameter used in Gaussian leaf models (can either be a scalar or a q x q matrix, where q is the dimensionality of the basis and is only >1 when
leaf_model_int = 2
). Calibrated internally as1/num_trees
, propagated along diagonal if needed for multivariate leaf models.variance_forest_shape
Shape parameter for IG leaf models (applicable when
leaf_model_type = 3
). Default:1
.variance_forest_scale
Scale parameter for IG leaf models (applicable when
leaf_model_type = 3
). Default:1
.cutpoint_grid_size
Number of unique cutpoints to consider (default:
100
)
Method get_alpha()
Query root node split probability in tree prior for this ForestModelConfig object
Method get_min_samples_leaf()
Query root node split probability in tree prior for this ForestModelConfig object
Method get_max_depth()
Query root node split probability in tree prior for this ForestModelConfig object
Method get_leaf_model_scale()
Query scale parameter used in Gaussian leaf models for this ForestModelConfig object
Method get_variance_forest_shape()
Query shape parameter for IG leaf models for this ForestModelConfig object
Method get_variance_forest_scale()
Query scale parameter for IG leaf models for this ForestModelConfig object