| ForestDataset | R Documentation |
Wrapper around a C++ dataset class used to sample a forest. A dataset consists of three matrices / vectors: covariates, bases, and variance weights. Both the basis vector and variance weights are optional.
This class is intended for advanced use cases in which users require detailed control of sampling algorithms and data structures. Minimal input validation and error checks are performed – users are responsible for providing the correct inputs. For tutorials on the "proper" usage of the stochtree's advanced workflow, we provide several vignettes at https://stochtree.ai/
data_ptrExternal pointer to a C++ ForestDataset class
new()Create a new ForestDataset object.
ForestDataset$new(covariates, basis = NULL, variance_weights = NULL)
covariatesMatrix of covariates
basis(Optional) Matrix of bases used to define a leaf regression
variance_weights(Optional) Vector of observation-specific variance weights
A new ForestDataset object.
update_basis()Update basis matrix in a dataset
ForestDataset$update_basis(basis)
basisUpdated matrix of bases used to define a leaf regression
update_variance_weights()Update variance_weights in a dataset
ForestDataset$update_variance_weights(variance_weights, exponentiate = F)
variance_weightsUpdated vector of variance weights used to define individual variance / case weights
exponentiateWhether or not input vector should be exponentiated before being written to the Dataset's variance weights. Default: F.
num_observations()Return number of observations in a ForestDataset object
ForestDataset$num_observations()
Observation count
num_covariates()Return number of covariates in a ForestDataset object
ForestDataset$num_covariates()
Covariate count
num_basis()Return number of bases in a ForestDataset object
ForestDataset$num_basis()
Basis count
get_covariates()Return covariates as an R matrix
ForestDataset$get_covariates()
Covariate data
get_basis()Return bases as an R matrix
ForestDataset$get_basis()
Basis data
get_variance_weights()Return variance weights as an R vector
ForestDataset$get_variance_weights()
Variance weight data
has_basis()Whether or not a dataset has a basis matrix
ForestDataset$has_basis()
True if basis matrix is loaded, false otherwise
has_variance_weights()Whether or not a dataset has variance weights
ForestDataset$has_variance_weights()
True if variance weights are loaded, false otherwise
has_auxiliary_dimension()Whether or not a dataset has auxiliary data stored at the dimension indicated
ForestDataset$has_auxiliary_dimension(dim_idx)
dim_idxDimension of auxiliary data
True if auxiliary data has been allocated for dim_idx False otherwise
add_auxiliary_dimension()Initialize a new dimension / lane of auxiliary data and allocate data in its place
ForestDataset$add_auxiliary_dimension(dim_size)
dim_sizeSize of the new vector of data to allocate
None
get_auxiliary_data_value()Retrieve auxiliary data value
ForestDataset$get_auxiliary_data_value(dim_idx, element_idx)
dim_idxDimension from which data value to be retrieved
element_idxElement to retrieve from dimension dim_idx
Floating point value stored in the requested auxiliary data space
set_auxiliary_data_value()Set auxiliary data value
ForestDataset$set_auxiliary_data_value(dim_idx, element_idx, value)
dim_idxDimension in which data value to be set
element_idxElement to set within dimension dim_idx
valueData value to set at auxiliary data dimension dim_idx and element element_idx
None
get_auxiliary_data_vector()Retrieve entire auxiliary data vector
ForestDataset$get_auxiliary_data_vector(dim_idx)
dim_idxDimension to retrieve
Vector of all of the auxiliary data stored at dimension dim_idx
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.