StanLogDensityProblems.jl

LogDensityProblems implementation for Stan models
Author sethaxen
Popularity
16 Stars
Updated Last
3 Months Ago
Started In
February 2023

StanLogDensityProblems

Stable Dev Build Status Coverage Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

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

For example, here we sample a Stan model from PosteriorDB using DynamicHMC:

julia> using DynamicHMC, PosteriorDB, Random, StanLogDensityProblems

julia> pdb = PosteriorDB.database()
PosteriorDatabase(...)

julia> post = PosteriorDB.posterior(pdb, "dogs-dogs")
Posterior: dogs-dogs

julia> prob = StanProblem(post, ".")
StanProblem: dogs_model

julia> rng = Random.default_rng();

julia> result = mcmc_with_warmup(rng, prob, 1_000; reporter=NoProgressReport());

julia> result.posterior_matrix
3×1000 Matrix{Float64}:
  1.27568    1.29648    1.32405      1.65451    1.3875     1.76917
 -0.327308  -0.305644  -0.303549     -0.273245  -0.387199  -0.333485
 -0.128237  -0.166094  -0.15898      -0.223369  -0.15062   -0.236186

Used By Packages

No packages found.