Skip to content

Commit 2ad1397

Browse files
authored
Merge pull request #1724 from pints-team/1705-transformed-likelihoods
Reintroducing LogLikelihood class
2 parents 708f287 + 288e364 commit 2ad1397

19 files changed

Lines changed: 1036 additions & 1012 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ All notable changes to this project will be documented in this file.
66
## Unreleased
77

88
### Added
9+
- [#1724](https://github.com/pints-team/pints/pull/1724) The `LogLikelihood` class has been reintroduced, to differentiate between probabilities of parameters and probabilities of data, given fixed parameters.
10+
- [#1724](https://github.com/pints-team/pints/pull/1724) Added `PooledLogLikelihood` and `SumOfIndependentLogLikelihoods`.
911
- [#1716](https://github.com/pints-team/pints/pull/1716) PINTS is now tested on Python 3.14.
1012
- [#1715](https://github.com/pints-team/pints/pull/1715) Added methods `ProblemErrorMeasure.problem()`, `ProblemLogLikelihood.problem()`, `SingleOutputProblem.model()` and `MultiOutputProblem.model()`.
1113
- [#1508](https://github.com/pints-team/pints/pull/1508) Added a method `OptimisationController.set_parameter_tolerance` that allows methods to stop after a fixed number of iterations with no significant movement in parameter space.
1214
### Changed
15+
- [#1724](https://github.com/pints-team/pints/pull/1724) Some methods that accepted `LogPDF`s now specifically require `LogLikelihood`s (e.g. `LogPosterior`, `NestedController`).
1316
- [#1713](https://github.com/pints-team/pints/pull/1713) PINTS now requires matplotlib 2.2 or newer.
1417
### Deprecated
1518
- [#1508](https://github.com/pints-team/pints/pull/1508) The methods `OptimisationController.max_unchanged_iterations` and `set_max_unchanged_iterations` are deprecated, in favour of `function_tolerance` and `set_function_tolerance` respectively.
19+
- [#1724](https://github.com/pints-team/pints/pull/1724) The classes `PooledLogPDF` and `SumOfIndependentLogPDFs` are deprecated, in favour of `PooledLogLikelihood` and `SumOfIndependentLogLikelihoods` respectively.
1620
### Removed
1721
### Fixed
1822
- [#1713](https://github.com/pints-team/pints/pull/1713) Fixed Numpy 2.4.1 compatibility issues.

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ Sampling
9595
- :class:`No U-Turn Sampler with dual averaging (NUTS) <NoUTurnMCMC>`
9696
- :class:`RelativisticMCMC`
9797

98-
#. :class:`Nested sampling<NestedSampler>`, require a :class:`LogPDF` and a
99-
:class:`LogPrior` that can be sampled from.
98+
#. :class:`Nested sampling<NestedSampler>`, require a :class:`LogLikelihood`
99+
and a :class:`LogPrior` that can be sampled from.
100100

101101
- :class:`NestedEllipsoidSampler`
102102
- :class:`NestedRejectionSampler`

docs/source/log_likelihoods.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ Log-likelihoods
44

55
.. currentmodule:: pints
66

7-
The classes below all implement the :class:`ProblemLogLikelihood` interface,
8-
and can calculate a log-likelihood based on some time-series :class:`Problem`
9-
and an assumed noise model.
7+
The classes below all implement the :class:`LogLikelihood` interface.
8+
Most are :class:`ProblemLogLikelihood` implementations, which calculate a
9+
log-likelihood based on some time-series :class:`Problem` and an assumed noise
10+
model.
11+
Some are methods combining other likelihoods.
1012

1113
Example::
1214

13-
logpdf = pints.GaussianLogLikelihood(problem)
15+
log_likelihood = pints.GaussianLogLikelihood(problem)
1416
x = [1, 2, 3]
15-
fx = logpdf(x)
17+
fx = log_likelihood(x)
1618

1719

1820
.. autoclass:: AR1LogLikelihood
@@ -39,8 +41,17 @@ Example::
3941

4042
.. autoclass:: MultiplicativeGaussianLogLikelihood
4143

44+
.. autoclass:: PooledLogLikelihood
45+
46+
.. autoclass:: PooledLogPDF
47+
4248
.. autoclass:: ScaledLogLikelihood
4349

4450
.. autoclass:: StudentTLogLikelihood
4551

52+
.. autoclass:: SumOfIndependentLogLikelihoods
53+
54+
.. autoclass:: SumOfIndependentLogPDFs
55+
4656
.. autoclass:: UnknownNoiseLogLikelihood
57+

docs/source/log_pdfs.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ Example::
2020

2121
.. autoclass:: LogPrior
2222

23-
.. autoclass:: LogPosterior
24-
25-
.. autoclass:: PooledLogPDF
23+
.. autoclass:: LogLikelihood
2624

2725
.. autoclass:: ProblemLogLikelihood
2826

29-
.. autoclass:: SumOfIndependentLogPDFs
27+
.. autoclass:: LogPosterior
3028

examples/miscellaneous/model-rt-estimation-renewal-equation.ipynb

Lines changed: 353 additions & 383 deletions
Large diffs are not rendered by default.

examples/toy/distribution-rosenbrock.ipynb

Lines changed: 22 additions & 39 deletions
Large diffs are not rendered by default.

pints/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ def version(formatted=False):
7979
# Logs of probability density functions (not necessarily normalised)
8080
#
8181
from ._log_pdfs import (
82+
LogLikelihood,
8283
LogPDF,
8384
LogPrior,
8485
LogPosterior,
85-
PooledLogPDF,
8686
ProblemLogLikelihood,
87-
SumOfIndependentLogPDFs,
8887
)
8988

9089
#
@@ -124,8 +123,12 @@ def version(formatted=False):
124123
KnownNoiseLogLikelihood,
125124
LogNormalLogLikelihood,
126125
MultiplicativeGaussianLogLikelihood,
126+
PooledLogLikelihood,
127+
PooledLogPDF,
127128
ScaledLogLikelihood,
128129
StudentTLogLikelihood,
130+
SumOfIndependentLogLikelihoods,
131+
SumOfIndependentLogPDFs,
129132
UnknownNoiseLogLikelihood,
130133
)
131134

pints/_boundaries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def upper(self):
189189
class LogPDFBoundaries(Boundaries):
190190
"""
191191
Uses a :class:`pints.LogPDF` (e.g. a :class:`LogPrior`) as boundaries),
192-
accepting log-likelihoods above a given threshold as within bounds.
192+
accepting log-pdfs above a given threshold as within bounds.
193193
194194
For a :class:`pints.LogPrior` based on :class:`pints.Boundaries`, see
195195
:class:`pints.UniformLogPrior`.

0 commit comments

Comments
 (0)