loadForestContainerCombinedJsonString: Combine multiple JSON strings representing model objects...

View source: R/serialization.R

loadForestContainerCombinedJsonStringR Documentation

Combine multiple JSON strings representing model objects containing forests (with the same hierarchy / schema) into a single forest_container

Description

Combine multiple JSON strings representing model objects containing forests (with the same hierarchy / schema) into a single forest_container

Usage

loadForestContainerCombinedJsonString(json_string_list, json_forest_label)

Arguments

json_string_list

List of strings that parse into objects of type CppJson

json_forest_label

Label referring to a particular forest (i.e. "forest_0") in the overall json hierarchy (must exist in every json object in the list)

Value

ForestSamples object

Examples

X <- matrix(runif(10*100), ncol = 10)
y <- -5 + 10*(X[,1] > 0.5) + rnorm(100)
bart_model <- bart(X, y, num_gfr=0, num_mcmc=10)
bart_json_string <- list(saveBARTModelToJsonString(bart_model))
mean_forest <- loadForestContainerCombinedJsonString(bart_json_string, "forest_0")

stochtree documentation built on April 4, 2025, 2:11 a.m.