StanLogDensityProblems

StanLogDensityProblems implements the LogDensityProblems API for Stan models using BridgeStan. For easily benchmarking inference algorithms, StanLogDensityProblems also integrates with PosteriorDB.

StanLogDensityProblems.StanProblemType
StanProblem(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 NaNs will be returned.

source
StanLogDensityProblems.StanProblemMethod
StanProblem(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.

Note

By default, Stan does not compile the model with multithreading support. If this is needed, pass make_args=["STAN_THREADS=true"] to kwargs.

source
StanLogDensityProblems.StanProblemMethod
StanProblem(
    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.

source