StanLogDensityProblems
StanLogDensityProblems implements the LogDensityProblems API for Stan models using BridgeStan. For easily benchmarking inference algorithms, StanLogDensityProblems also integrates with PosteriorDB.
StanLogDensityProblems.StanProblem
— TypeStanProblem(model::BridgeStan.StanModel; nan_on_error::Bool=false)
A wrapper for an unconstrained Stan model with data, implementing the LogDensityProblems interface.
If nan_on_error=true
, then any errors from Stan will be suppressed, and NaN
s will be returned.
StanLogDensityProblems.StanProblem
— MethodStanProblem(lib::String[, data::String[ seed::Int]]; nan_on_error::Bool=false, kwargs...)
Construct a BridgeStan.StanModel
and wrap it as a StanProblem
.
lib
is a path either to a compiled Stan model or to a .stan
file. For details on the arguments, see the docstring for BridgeStan.StanModel
.
By default, Stan does not compile the model with multithreading support. If this is needed, pass make_args=["STAN_THREADS=true"]
to kwargs
.
StanLogDensityProblems.StanProblem
— MethodStanProblem(
posterior::PosteriorDB.Posterior,
path::AbstractString,
args...;
nan_on_error::Bool=false,
force::Bool=false,
kwargs...,
)
Construct a StanProblem
from the Stan model implementation and dataset corresponding to posterior
.
The model file will be copied to path
before compilation. If the file already exists in path
and is not identical to the original file, it will be overwritten if force=true
; otherwise, an error will be thrown.
Remaining args
and kwargs
are forwarded to the main StanProblem
constructor.