Skip to content

Commit

Permalink
Merge pull request #507 from xpsi-group/468-verify-and-implement-the-…
Browse files Browse the repository at this point in the history
…replacement-of-less_than_llzero-with-random_near_llzero-in-likelihoodpy

implemented random_near_llzero
  • Loading branch information
Basdorsman authored Jan 17, 2025
2 parents 368f5f8 + 60b589c commit cadab79
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,48 @@ and this project adheres to
.. ^^^^^^^^^^^
[3.0.1] - 2025-01-16
~~~~~~~~~~~~~~~~~~~~

Summary
^^^^^^^

* If the prior.call() returns -np.inf because a parameter value outside the allowed prior (multidimensional) interval, the likelihood will now return random_near_llzero rather than less_than_llzero.

Fixed
^^^^^

* This fixes a problem that we believe used to be rare but was recently occuring quite frequently, where MultiNest gets stuck in an infinite loop. That means runs were still appearing to be running but were actually stuck in an infinite loop state.

Added
^^^^^

Changed
^^^^^^^

* We no longer follow the procedure of point rejection as described in Appendix B.5.3 in Tom Riley's thesis.
* Instead of outright rejection (in the MultiNest code), points will now be 'weakly' rejected when their loglikelihoods are compared and turn out to be lower than the likelihoods of the current 'good' livepoints.
* The bulk of the work is in the evaluation of the loglikelihoods, which is still being skipped, so rejection after loglikelihood comparison amounts to negligible extra work.
* We have done a few tests of sampling and found no noticeable effects on the posteriors that come out on the other end.
* Just a note, we discussed but will not implement prior limits in the prior.inverse_sample(), since that will be complicated while we do not expect that it speeds us up. One may argue that alternative is a bit cleaner and a more direct way to inform MultiNest not to consider forbidden parameter values.

Deprecated
^^^^^^^^^^
* likelihood.less_than_llzero()

Removed
^^^^^^^

* likelihood.less_than_llzero()

Attribution
^^^^^^^^^^^

Bas Dorsman,
Mariska Hoogkamer,
Tuomo Salmi


[v3.0.0] - 2024-12-19
~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# The short X.Y version.
version = '3.0-b'
# The full version, including alpha/beta/rc tags.
release = '3.0.0'
release = '3.0.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def EXTENSION(modname):

setup(
name = 'xpsi',
version = '3.0.0',
version = '3.0.1',
author = 'The X-PSI Core Team',
author_email = '[email protected]',
url = 'https://github.com/xpsi-group/xpsi',
Expand Down
7 changes: 1 addition & 6 deletions xpsi/Likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,6 @@ def random_near_llzero(self):
order of magnitude. """
return self._llzero * (0.1 + 0.9*_np.random.rand(1))

@property
def less_than_llzero(self):
""" Get a number less than the minimum log-likelihood threshold. """
return 1.1 * self._llzero

@property
def externally_updated(self):
""" Safely assume parameters are already updated upon call to self? """
Expand Down Expand Up @@ -488,7 +483,7 @@ def __call__(self, p = None, reinitialise = False, force = False):
if not _np.isfinite(logprior):
# we need to restore due to premature return
super(Likelihood, self).__call__(self.cached)
return self.less_than_llzero
return self.random_near_llzero

if self._do_fast:
# perform a low-resolution precomputation to direct cell
Expand Down
2 changes: 1 addition & 1 deletion xpsi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__version__ = "3.0.0"
__version__ = "3.0.1"
__author__ = "The X-PSI Core Team"

try:
Expand Down

0 comments on commit cadab79

Please sign in to comment.