brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
92 stars 78 forks source link

PolyChord convergence issue when using emulators #374

Open ThomasTram opened 2 months ago

ThomasTram commented 2 months ago

In the following lines,

https://github.com/brinckmann/montepython_public/blob/d3e2c72e5d87bf32c5bbf3c772a54db7e1f499a8/montepython/PolyChord.py#L251-L256

the PolyChord parameter grade_frac is being set to 0.75 for cosmo parameters and 0.25 for nuisance parameters. These numbers tell PolyChord to spend 75% of the (wallclock) time doing repetitions in the cosmological parameters and 25% of the time doing repetitions in the nuisance parameter space. A test run using OMP_NUM_THREADS=8 resulted in an oversampling of nuisance space of approximately 90 using Planck TTTEEE and Bicep-Keck likelihoods. However, using a neural network emulator from CONNECT, leads to an under-sampling of nuisance parameters of around 0.7. This leads to a large statistical uncertainty on the evidence. Note that grade_frac is not exposed as an input parameter, so it is not possible to change this behaviour as a user.

There are other situations where the current implementation is far from ideal:

Suggestion for fixes:

  1. Avoid oversampling/speed grades completely, i.e. just delete the offending lines.
  2. Use that actual oversampling numbers from the MontePython parameter file. The docstring for pyPolyChord suggests that grade_frac can accept a list of oversampling factors instead.

It would be great with some additional input from @williamjameshandley if he could find some time.

brinckmann commented 2 months ago

Hi Thomas,

Thanks for the detailed report! I definitely support at least having the option to manipulate this parameter rather than having it hardcoded, either directly as a flag, or somehow through the oversampling field (how does that work with multiple likelihoods with nuisance parameters, I guess the factor would need to be the same for all?). I don't have the knowledge of whether it can be omitted entirely, we'd need Will to chime in on that.

Best, Thejs