CobayaSampler / cobaya

Code for Bayesian Analysis
http://cobaya.readthedocs.io/en/latest/
Other
128 stars 127 forks source link

Getting bestfit likelihood and chi-square #167

Open misharash opened 3 years ago

misharash commented 3 years ago

Currently, if I run minimizer with ignore_prior=True, -log(Like) and chi-sq at the top of {prefix}.bestfit still represent the posterior. If there are different groups of likelihood, their total log-likelihood (without prior) and corresponding chi2 are not presented in the file. Not really an issue, since the total likelihood chi2 is available in {prefix}.bestfit.txt. Though that file is not very human-readable, so writing this info in {prefix}.bestfit too may be a convenient enhancement.

juan-s-cruz commented 2 years ago

I get the totals printed on both files as it is intended, have you tried isolating the issue?

misharash commented 2 years ago

Here is a super simple example config. With the current version of the code, it gives such gaussian.bestfit file. If we ignore prior, both log-likelihood and chi2 would be 0, but the info at the top is different, clearly including prior. We can see chi2 from each likelihood (without prior) separately, but sum of the two is not present. Total chi2=0 is only present in gaussian.bestfit.txt.

misharash commented 2 years ago

This is similar to #247, I'm just trying to argue that with ignore_prior=True it could be reasonable to output the exact thing that was minimized.