Compile additional methods for accessing the model log-probability function and parameter constraining and unconstraining.
Source:R/fit.R
fit-method-init_model_methods.RdThe $init_model_methods() method compiles and initializes the
log_prob, grad_log_prob, hessian, constrain_variables,
unconstrain_variables and unconstrain_draws functions. These are then
available as methods of the fitted model object. This requires the
additional Rcpp package. The methods compile once per model
object, so later fits of the same model reuse them. To avoid compiling
them again in every new R session, set the rcpp.cache.dir option as
described for $expose_functions().
If a model or fit object was saved with base::saveRDS() and later
reloaded, any previously compiled model-method bindings will be rebuilt in
the current R session when this method is called.
Note: there may be many compiler warnings emitted during compilation but these can be ignored so long as they are warnings and not errors.
Examples
# \dontrun{
fit_mcmc <- cmdstanr_example("logistic", method = "sample", force_recompile = TRUE)
# fit_mcmc$init_model_methods()
# }