Getting started
The home page says what the package is for and shows the shortest fit that runs. The tutorials below go further.
Installation
using Pkg
Pkg.add("DistributionsInference")Fitting needs a sampler and a chain type as well, and you choose both. The tutorials sample with AdvancedMH or Turing and hold the draws in FlexiChains.
Pkg.add(["AdvancedMH", "Turing", "FlexiChains"])Two tutorials ask for more. The custom-distribution page finds a maximum-a-posteriori point through Bijectors and Optim, and the composed-tree page needs ComposedDistributions.
Pkg.add(["Bijectors", "Optim", "ComposedDistributions"])The route through a fit
Every fit here is the same three steps, whatever the distribution and sampler.
| Step | What you write | What it gives |
|---|---|---|
| Declare | parameter_rows and reconstruct on your type | one row per scalar parameter, and a way back from a flat vector |
| Score | distribution_to_logdensity or distribution_to_turing | a LogDensityProblems problem, or a DynamicPPL model |
| Read back | inference_to_distribution or inference_to_distributions | the fitted distribution |
Only the first step is written per type, and a distribution from a package that already implements the protocol skips it. A point estimate replaces the last two: optimise_distribution takes the distribution, the data and an optimiser, and returns the fitted distribution.
Tutorials
Fitting a custom distribution writes the protocol for a hand-rolled type, samples it with AdvancedMH, and finds a maximum-a-posteriori point with an external optimiser.
Sampling with Turing fits the same distribution as a
DynamicPPLmodel and reads the chain back with the same two calls.Fitting a composed distribution runs both routes against a
ComposedDistributionstree, partial pooling included. Its extension writes the protocol methods.
Getting help
For usage questions, ask on the Julia Discourse (the SciML or usage categories) or the epinowcast community forum, our home for epidemiological modelling questions. Please use GitHub issues for bug reports and feature requests only.
The layout, navigation, and infrastructure of this site are generated by EpiAwarePackageTools. Its docs cover customising the generated pages and how template sync keeps this repository current.