Run TreePPL and return output.
Usage
tp_run(
compiled_model,
data,
n_runs = NULL,
n_sweeps = NULL,
dir = NULL,
out_file_name = "out",
...
)Arguments
- compiled_model
a base::character with the full path to the compiled model outputted by tp_compile.
- data
a base::character with the full path to the data file in TreePPL JSON format (as outputted by tp_data).
- n_runs
When using MCMC, a base::integer giving the number of runs to be done.
- n_sweeps
When using SMC, a base::integer giving the number of SMC sweeps to be done.
- dir
a base::character with the full path to the directory where you want to save the output. Default is
base::tempdir().- out_file_name
a base::character with the name of the output file in JSON format. Default is "out".
- ...
See tp_run_options for all supported arguments.
Examples
if (FALSE) { # \dontrun{
# When using SMC
# compile model and create SMC inference machinery
exe_path <- tp_compile(model = "coin", method = "smc-bpf", particles = 2000)
# prepare data
data_path <- tp_data(data_input = "coin")
# run TreePPL
result <- tp_run(exe_path, data_path, n_sweeps = 2)
# When using MCMC
# compile model and create MCMC inference machinery
exe_path <- tp_compile(model = "coin", method = "mcmc-naive", iterations = 2000)
# prepare data
data_path <- tp_data(data_input = "coin")
# run TreePPL
result <- tp_run(exe_path, data_path, n_runs = 2)
} # }