Beta–binomial coin toss
Bounded probability, beta prior, binomial likelihood, predictive RNG, and an exact beta(9,5) posterior.
Executable catalog · 0.8.0
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.javaConjugate and introductory
Bounded probability, beta prior, binomial likelihood, predictive RNG, and an exact beta(9,5) posterior.
Known observation variance, analytic factors, gradient checking, and a short NUTS run.
Vectorized data, a positive scale transform, exponential prior, and predictive normal draw.
Positive count rate, shape/rate gamma prior, Poisson likelihood, and count generation.
Two beta-binomial arms, two bounded parameters, gradient validation, and NUTS.
Regression and hierarchy
Intercept and slope with Gaussian priors and likelihood.
Stable log1p-exp likelihood and Bernoulli residual gradient.
Location, log scale, standardized effects, and a complete hierarchical gradient.
A vectorized Cauchy likelihood limits the influence of one large outlier.
Geometry and multimodality
Changing conditional scale tests analytic gradients and NUTS behavior.
A narrow curved ridge validates a nontrivial two-dimensional gradient.
Stable log-sum-exp and random-walk Metropolis demonstrate a multimodal target.
A 0.9 correlation exercises dense mass-matrix adaptation.
Constraints and mixed state
Stick-breaking transform, Jacobian, three-category likelihood, and gradient check.
An exact discrete split update alternates with a Metropolis block for two log rates.
Reusable pattern
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
Use the beginner tutorial for the end-to-end sequence, the diagnostics vignette for failure interpretation, and the script tutorial for text models.