Executable catalog · 0.8.0

Fifteen models that double as tests

Every example below is a named JUnit test. Together they exercise scripts, transforms, analytic gradients, NUTS, dense metrics, Metropolis, Gibbs, generated quantities, and difficult geometry. For a narrated first run, start with the fully worked CSV/JDM tutorial.

See BayesianShowcaseTest.java

Conjugate and introductory

Start with models that have reference answers

01 · Script

Beta–binomial coin toss

Bounded probability, beta prior, binomial likelihood, predictive RNG, and an exact beta(9,5) posterior.

02 · Builder

Normal mean

Known observation variance, analytic factors, gradient checking, and a short NUTS run.

03 · Script

Normal location and scale

Vectorized data, a positive scale transform, exponential prior, and predictive normal draw.

04 · Script

Gamma–Poisson rate

Positive count rate, shape/rate gamma prior, Poisson likelihood, and count generation.

15 · Script

Bayesian A/B test

Two beta-binomial arms, two bounded parameters, gradient validation, and NUTS.

Regression and hierarchy

Write direct targets when the supported script subset is too small

05 · Analytic gradient

Linear regression

Intercept and slope with Gaussian priors and likelihood.

06 · Analytic gradient

Logistic regression

Stable log1p-exp likelihood and Bernoulli residual gradient.

07 · Non-centered

Eight schools

Location, log scale, standardized effects, and a complete hierarchical gradient.

11 · Robust

Cauchy location

A vectorized Cauchy likelihood limits the influence of one large outlier.

Geometry and multimodality

Exercise the warnings, not only the happy path

08 · Funnel

Neal’s funnel

Changing conditional scale tests analytic gradients and NUTS behavior.

09 · Curvature

Rosenbrock banana

A narrow curved ridge validates a nontrivial two-dimensional gradient.

10 · Modes

Gaussian mixture

Stable log-sum-exp and random-walk Metropolis demonstrate a multimodal target.

14 · Metric

Correlated Gaussian

A 0.9 correlation exercises dense mass-matrix adaptation.

Constraints and mixed state

Use the sampler that matches the state space

12 · Simplex

Dirichlet–multinomial

Stick-breaking transform, Jacobian, three-category likelihood, and gradient check.

13 · Gibbs

Poisson change point

An exact discrete split update alternates with a Metropolis block for two log rates.

Reusable pattern

Each test follows the same compact discipline

DifferentiableLogDensity target = (state, gradient) -> {
  // Return log density and replace every gradient coordinate.
};

assertTrue(Gradients.check(target, initial, 1e-5, 1e-5).passed());
ChainResult chain = new NoUTurnSampler().sample(
    target, initial, options, new MersenneTwister(seed));
assertEquals(ChainResult.Status.SUCCESS, chain.status());

Read the complete implementations in BayesianShowcaseTest.java. The shorter InferenceExamples.java is compiled against the packaged JAR by every check build.

Choose a next step

Turn examples into a reviewed analysis

Use the beginner tutorial for the end-to-end sequence, the diagnostics vignette for failure interpretation, and the script tutorial for text models.