joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
347 stars 76 forks source link

Assessing the results by varying the Dynesty parameters. #404

Closed camarman closed 1 year ago

camarman commented 1 year ago

Dynesty version I have installed SimpleMC, in which Dynesty is implemented into the program. It seems that they are using the Dynesty version from 2 years ago.

Background

I am a MSc student and I am doing this for a project, so I have really basic knowledge in Data Analysis in Cosmology.

I am making some tests to analyze which Dynesty parameter options give the best results. In SimpleMC, the static nested sampling is enabled and the parameters are given like this:

[nested]
;type for dynesty -> {'single','multi', 'balls', 'cubes'}
nestedType  = multi
;it is recommended around nlivepoints=50*ndim, recommended 1024
nlivepoints = 512
;recommended 0.01
accuracy    = 0.01
;u for flat(uniform) or g for gaussian prior
priortype   = u
;when using gaussian prior
sigma       = 2
;if nproc = 0 uses mp.cpu_count()//2 by default,
;you can set with another positive integer
nproc       = 8
;Produce output on the fly
showfiles   = True

I am also using mpirun -np 8 python3 run_simplemc.py command to run the program in parallel.

Question I am testing Standard LCDM model with Planck 2015 + eBOSS + 6dFGS + DR14 Ly-alpha Auto + DR14 Ly-alpha Cross + DR12 Consensus + Pantheon datasets.. When I run the program by varying nestedType and nlivepoints I am getting some results, but I have no idea how to test which parameter option gives the better results. For instance, see these cases

SUMMARY
-------
analyzer: nested
nested_algorithm: multi
dynamic: False
maxlike: 517.6725
nlive: 512
niter: 9174
ncall: 42484
%eff: 22.8015
logz: -530.9639 +/- 0.2145
Om: 0.2988 +/- 0.0064
Obh2: 0.0225 +/- 0.0001
h: 0.6843 +/- 0.0050

Elapsed time: 221.798 minutes = 13307.852 seconds
SUMMARY
-------
analyzer: nested
nested_algorithm: balls
dynamic: False
maxlike: 517.6723
nlive: 512
niter: 9274
ncall: 35329
%eff: 27.7025
logz: -531.1598 +/- 0.2167
Om: 0.2987 +/- 0.0062
Obh2: 0.0225 +/- 0.0001
h: 0.6843 +/- 0.0049

Elapsed time: 215.091 minutes = 12905.479 seconds

1) For me, it seems that a higher %eff produces always better results. Is it always the case? Do I have to look at some additional things to see actually that nestedType=balls works better than nestedType=multi?

2) Does %neff $\approx 25$ is a good number ? Since in general by %eff varies around $25$. What value of %eff can be considered as good/bad ?

segasai commented 1 year ago
camarman commented 1 year ago

I cannot tell you what gives 'bettter results', as that's problem dependent

I see. I thought maybe it's possible to deduce something from the Summary or by some sort of analysis.

You should consider switching to latest version of dynesty

I'll try to contact with the SimpleMC developer. Maybe he can implement the latest version. I am not sure if I can do it myself.

Regarding %eff. I could only say that if it is too low that could be a problem (or be too slow), but otherwise there is not a target value for it.

I thought there might be one, but if it's not the case that also makes sense.

Thanks for the help.