The basic steps involved to create custom types are described in the Getting Started page.
To handle more complicated cases, read the following:
In the Inference and Runtime page, you can find how custom samplers are automatically matched to target types.
In the Input and Output page, you can find how to load observations for the custom types, and how to output samples.
In the Testing page, you can find information on setting automated tests to check correctness of your implementation.
Also consider transforming the problem of sampling your new type into a problem that can be handled using built-in sampler, which include:
RealSliceSampler
: implementation of the Slice Sampler
(Neal, 2003)
with doubling and shrinking. A fixed starting interval can also be provided
if only the shrinking procedure is required (for example this second
variant is used internally for simplex sampling in SimplexSampler
).
IntSliceSampler
: which provides the same facilities as
above but for integers. The fixed starting variant is used internally in
categorical realization sampling, CategoricalSampler
.
MHSampler
: an abstract class providing a basis for custom
Metropolis-Hastings samplers. See
blang.validation.internals.fixtures.IntNaiveSampler
for an example.