Skip to content

Commit 7380440

Browse files
authored
Merge pull request #1413 from pints-team/i-96-abc-routine
ABC Routine
2 parents ba6d5ce + 95c910e commit 7380440

File tree

12 files changed

+1040
-3
lines changed

12 files changed

+1040
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88
- [#1432](https://github.com/pints-team/pints/pull/1432) Added 2 new stochastic models: production and degradation model, Schlogl's system of chemical reactions. Moved the stochastic logistic model into `pints.stochastic` to take advantage of the `MarkovJumpModel`.
99
- [#1420](https://github.com/pints-team/pints/pull/1420) The `Optimiser` class now distinguishes between a best-visited point (`x_best`, with score `f_best`) and a best-guessed point (`x_guessed`, with approximate score `f_guessed`). For most optimisers, the two values are equivalent. The `OptimisationController` still tracks `x_best` and `f_best` by default, but this can be modified using the methods `set_f_guessed_tracking` and `f_guessed_tracking`.
1010
- [#1417](https://github.com/pints-team/pints/pull/1417) Added a module `toy.stochastic` for stochastic models. In particular, `toy.stochastic.MarkovJumpModel` implements Gillespie's algorithm for easier future implementation of stochastic models.
11+
- [#1413](https://github.com/pints-team/pints/pull/1413) Added classes `pints.ABCController` and `pints.ABCSampler` for Approximate Bayesian computation (ABC) samplers. Added `pints.RejectionABC` which implements a simple rejection ABC sampling algorithm.
1112

1213
### Changed
1314
- [#1439](https://github.com/pints-team/pints/pull/1439), [#1433](https://github.com/pints-team/pints/pull/1433) PINTS is no longer tested on Python 3.5. Testing for Python 3.10 has been added.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**********************
2+
ABC sampler base class
3+
**********************
4+
5+
.. currentmodule:: pints
6+
7+
.. autoclass:: ABCSampler
8+
.. autoclass:: ABCController

docs/source/abc_samplers/index.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
************
2+
ABC samplers
3+
************
4+
5+
.. currentmodule:: pints
6+
7+
Pints provides a number of samplers for Approximate Bayesian
8+
Computation (ABC), all implementing the :class:`ABCSampler`
9+
interface, that can be used to sample from a stochastic model
10+
given a :class:`LogPrior` and a :class:`ErrorMeasure`.
11+
12+
13+
.. toctree::
14+
15+
base_classes
16+
rejection_abc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*********************
2+
Rejection ABC sampler
3+
*********************
4+
5+
.. currentmodule:: pints
6+
7+
.. autoclass:: RejectionABC

docs/source/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Contents
2323

2424
.. toctree::
2525

26+
abc_samplers/index
2627
boundaries
2728
core_classes_and_methods
2829
diagnostics
@@ -78,10 +79,10 @@ Sampling
7879

7980
- SMC
8081

81-
#. Likelihood free sampling (Need distance between data and states, e.g. least squares?)
82+
#. :class:`ABC sampling<ABCSampler>`
8283

83-
- ABC-MCMC
84-
- ABC-SMC
84+
- :class:`RejectionABC`, requires a :class:`LogPrior` that can be sampled
85+
from and an error measure.
8586

8687
#. 1st order sensitivity MCMC samplers (Need derivatives of :class:`LogPDF`)
8788

examples/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ relevant code.
7777
- [Ellipsoidal nested sampling](./sampling/nested-ellipsoidal-sampling.ipynb)
7878
- [Rejection nested sampling](./sampling/nested-rejection-sampling.ipynb)
7979

80+
### ABC
81+
- [Rejection ABC sampling](./sampling/rejection-abc.ipynb)
82+
8083
### Analysing sampling results
8184
- [Autocorrelation](./plotting/mcmc-autocorrelation.ipynb)
8285
- [Customise analysis plots](./plotting/customise-pints-plots.ipynb)

examples/sampling/rejection-abc.ipynb

Lines changed: 243 additions & 0 deletions
Large diffs are not rendered by default.

pints/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,20 @@ def version(formatted=False):
236236
from ._nested._ellipsoid import NestedEllipsoidSampler
237237

238238

239+
#
240+
# ABC
241+
#
242+
from ._abc import ABCSampler
243+
from ._abc import ABCController
244+
from ._abc._abc_rejection import RejectionABC
245+
246+
239247
#
240248
# Sampling initialising
241249
#
242250
from ._sample_initial_points import sample_initial_points
243251

252+
244253
#
245254
# Transformations
246255
#

0 commit comments

Comments
 (0)