[AstroPy] [ANN] Nestle: Nested sampling

Anne Archibald archibald at astron.nl
Thu Oct 8 17:05:32 EDT 2015


Hi Kyle,

I am very interested in nestle as an alternative MCMC method for a project
I'm working on (testing general relativity with pulsar timing observations
of a triple system; see http://adsabs.harvard.edu/abs/2014Natur.505..520R for
more). I was considering multinest but the ability to get "under the hood"
is really valuable. I have several concerns with using the code; maybe you
have the experience to point me in the right direction.

The first concern is that my likelihood function is really slow (seconds).
I have access to many cores, but each evaluation can only use one. So I'd
like to enlist some parallelism in the MCMC algorithm. As written, nestle
is purely sequential, but I can see several places parallelism is
available. The first and easiest is when picking a new point to replace the
worst: if this takes many tries, you could speculatively evaluate the
function at many new candidate points and take the first acceptable one.
Multinest is able to do this, and I can see how one might add it to the
code here. The second possibility is suggested by your "update_interval"
parameter. Until the family of ellipsoids is updated, all new points are
being generated from the same distribution, so the evaluation of their
likelihoods can be carried out in parallel. This guarantees at least a
factor update_interval worth of parallelism, which might be worth it even
for expensive likelihood evaluations. Implementation would maintain a list
of N (~ number of cores) Futures representing evaluations drawn from the
current set of ellipsoids; every time the code needs a new point it waits
for the first Future to finish and gets the coordinates and log-likelihood
from that, then creates another Future for later. When the ellipsoids need
to be changed, all unused Futures can be cancelled. The result should be
statistically identical to the current algorithm, though it sometimes uses
extra RNG calls, so the actual call sequence won't be the same (and will
depend on N but nothing else).

The second concern is that I'm worried my problem is going to take forever
with nested sampling. It's a somewhat high-dimensional problem - 20-30
parameters - and the change in parameter volume from prior to posterior is
staggering: while the prior is a bit fuzzy, our knowledge of (say) the
inner orbital period goes from "about 1.6 days" to "1.629401788(5) days";
many other parameters are similarly constrained. Since nested sampling
relies on gradually shrinking ellipses from the entire space down to the
target region, I worry that it will take a very large number of steps (if
the ellipse's volume shrinks by a factor 1.2 each time, that's ~3000
steps). This appears worryingly supported by a numerical experiment I am
running with a fast likelihood function that nevertheless puts very tight
constraints on the result.

The third concern is about covariances. Of course ellipses are intended to
enclose potentially very skinny error regions, but I ran into problems
where my error region was so narrow that representing it with a covariance
matrix ran into matrix numerical headaches. I have analytically
marginalized out the worst offenders, but even the simple problem that my
parameters can be constrained on very different scales - a sin i is known
about a thousand times better than a cos i - can wreck matrix algorithms. I
guess I have to try this and see whether problems arise.

Currently I am working with emcee, which has its drawbacks, but can use
parallelism (to evaluate likelihoods for many walkers at once) and is
fairly robust against covariances (the point coordinates themselves are
used to generate candidates as linear combinations). But since I'm trying
to test a hypothesis - GR is better than not-GR - it sure would be nice to
use a tool that supports hypothesis testing!

Thanks,
Anne

On Tue, Sep 29, 2015 at 8:10 PM Kyle Barbary <kylebarbary at gmail.com> wrote:

> Yes, possibly! Nestle currently implements the basic MultiNest method, but
> doesn't implement later improvements such as importance reweighting or
> polychord. I'm open to contributions and improvements. (But be mindful of
> reading the MultiNest source code due to licensing issues!)
>
> Best,
> -- Kyle
>
> On Tue, Sep 29, 2015 at 1:03 PM, Johann Cohen-Tanugi <
> johann.cohentanugi at gmail.com> wrote:
>
>> likewise!
>> Any prospect toward the polychord extension? See
>> http://arxiv.org/abs/1506.00171v1
>> cheers,
>> Johann
>>
>>
>> On 09/29/2015 10:30 AM, Wolfgang Kerzendorf wrote:
>>
>> HI Kyle,
>>
>> Very nice. I'll definitely have a look at that.
>>
>> Cheers,
>>    Wolfgang
>> --
>> Dr. Wolfgang E Kerzendorf
>> ESO Fellow
>> European Southern Observatory
>> Karl-Schwarzschild Str. 2, 85748
>> Garching bei Muenchen, Germany
>>
>> On Tue, Sep 29, 2015 at 6:09 AM Kyle Barbary < <kylebarbary at gmail.com>
>> kylebarbary at gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I'm pleased to announce the initial release of Nestle, a small Python
>>> package for nested sampling. ("Nestle" rhymes with "wrestle".) Nested
>>> sampling is a statistical technique for parameter estimation and model
>>> comparison, commonly used in cosmology. We've been using it in the sncosmo
>>> package and have found it to be a robust global optimizer in addition to
>>> its more typically cited benefits.
>>>
>>> Nestle implements an algorithm similar to that used in the MultiNest
>>> software, but in an open-source (MIT) licensed and easy-to-install (pure
>>> Python) package. (It was written based only on the literature, not the
>>> MultiNest source code.) In addition to this algorithm, Nestle also
>>> implements the "classic" nested sampling algorithm and the "single
>>> ellipsoid" algorithm.
>>>
>>> Nestle depends on only numpy and (optionally) scipy and supports both
>>> Python 3 and Legacy Python (formerly known as Python 2).
>>>
>>> docs:  <http://kbarbary.github.io/nestle>
>>> http://kbarbary.github.io/nestle
>>> source:  <http://github.com/kbarbary/nestle>
>>> http://github.com/kbarbary/nestle
>>>
>>> I'd appreciate any feedback on this initial release, particularly about
>>> application to real-world problems and comparisons with results from
>>> MultiNest. Thanks!
>>>
>>> - Kyle
>>> _______________________________________________
>>> AstroPy mailing list
>>> AstroPy at scipy.org
>>> https://mail.scipy.org/mailman/listinfo/astropy
>>>
>>
>>
>> _______________________________________________
>> AstroPy mailing listAstroPy at scipy.orghttps://mail.scipy.org/mailman/listinfo/astropy
>>
>>
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> https://mail.scipy.org/mailman/listinfo/astropy
>>
>>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20151008/95f484d2/attachment.html>


More information about the AstroPy mailing list