You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to Cobaya and the development of Likelihood in this framework. I have written my likelihood and the param file. The params of my file look like this,
When I run the param file with evaluate as a sampler, I get the following, seemingly reasonable, output
2021-04-29 10:16:28,153 [output] Output to be read-from/written-into folder '.', with prefix 'My_Test'
2021-04-29 10:16:28,253 [camb] Importing *auto-installed* CAMB (but defaulting to *global*).
2021-04-29 10:16:28,310 [camb] Initialized!
2021-04-29 10:16:40,889 [prior] *WARNING* No sampled parameters requested! This will fail for non-mock samplers.
2021-04-29 10:16:40,892 [camb] Importing *global* CAMB.
2021-04-29 10:16:40,892 [camb] Initialized!
2021-04-29 10:16:42,981 [evaluate] Initialized!
2021-04-29 10:16:42,992 [evaluate] Looking for a reference point with non-zero prior.
2021-04-29 10:16:42,992 [prior] Reference values or pdf's for some parameters were not provided. Sampling from the prior instead for those parameters.
2021-04-29 10:16:42,993 [evaluate] Reference point:
ombh2 = 0.0365783
omch2 = 0.126176
tau = 0.190604
logA = 3.07043
ns = 0.815588
2021-04-29 10:16:42,993 [evaluate] Evaluating prior and likelihoods...
2021-04-29 10:16:47,027 [evaluate] log-posterior = 4.39314
2021-04-29 10:16:47,027 [evaluate] log-prior = 7.87826
2021-04-29 10:16:47,027 [evaluate] logprior_0 = 7.87826
2021-04-29 10:16:47,028 [evaluate] log-likelihood = -3.48512
2021-04-29 10:16:47,028 [evaluate] chi2_Euclid = 6.97023
2021-04-29 10:16:47,028 [evaluate] Derived params:
2021-04-29 10:16:47,028 [evaluate] As = 2.15511e-09
However, when I run with mcmc sampler, the sampler keeps running without accepting any model and the number of treid models keeps increasing. This is how the output looks like,
2021-04-29 10:25:56,312 [output] Output to be read-from/written-into folder '.', with prefix 'My_Test'
2021-04-29 10:25:56,312 [output] Found existing info files with the requested output prefix: 'My_Test'
2021-04-29 10:25:56,313 [output] Will delete previous products ('force' was requested).
2021-04-29 10:25:56,439 [output] From regexp 'My_Test\\.checkpoint$' in folder '.', deleting files ['./My_Test.checkpoint']
2021-04-29 10:25:56,439 [output] From regexp 'My_Test\\.progress$' in folder '.', deleting files ['./My_Test.progress']
2021-04-29 10:25:56,439 [output] From regexp 'My_Test\\.covmat$' in folder '.', deleting files ['./My_Test.covmat']
2021-04-29 10:25:56,455 [camb] Importing *auto-installed* CAMB (but defaulting to *global*).
2021-04-29 10:25:56,515 [camb] Initialized!
2021-04-29 10:26:07,668 [prior] *WARNING* No sampled parameters requested! This will fail for non-mock samplers.
2021-04-29 10:26:07,671 [camb] Importing *global* CAMB.
2021-04-29 10:26:07,672 [camb] Initialized!
2021-04-29 10:26:09,328 [mcmc] Getting initial point... (this may take a few seconds)
2021-04-29 10:26:09,328 [prior] Reference values or pdf's for some parameters were not provided. Sampling from the prior instead for those parameters.
2021-04-29 10:26:13,777 [prior] *WARNING* Reference pdf not defined or improper for some parameters. Using prior's sigma instead for them.
2021-04-29 10:26:13,778 [mcmc] Covariance matrix not present. We will start learning the covariance of the proposal earlier: R-1 = 30 (would be 2 if all params loaded).
2021-04-29 10:26:13,783 [mcmc] Initial point: ombh2:0.03607705, omch2:0.1092784, tau:0.339702, logA:3.005904, ns:1.081473
2021-04-29 10:26:13,801 [mcmc] Sampling!
2021-04-29 10:26:14,282 [mcmc] Progress @ 2021-04-29 10:26:14 : 1 steps taken, and 0 accepted.
2021-04-29 10:26:24,614 [mcmc] Progress @ 2021-04-29 10:26:24 : 45 steps taken, and 0 accepted.
2021-04-29 10:26:34,914 [mcmc] Progress @ 2021-04-29 10:26:34 : 78 steps taken, and 0 accepted.
2021-04-29 10:26:45,062 [mcmc] Progress @ 2021-04-29 10:26:45 : 122 steps taken, and 0 accepted.
2021-04-29 10:26:55,076 [mcmc] Progress @ 2021-04-29 10:26:55 : 157 steps taken, and 0 accepted.
I tried to print the likelihood evaluated in the file mcmc.py in the function, def get_new_sample_metropolis(self): and it shows that the likelihood is being evaluated to -inf. I guess that is why it cant accept any model.
My question is: how can evaluate give me a decent value of the likelihood but mcmc sampler fails to get a value when both of them, I think, call the same function logposterior with a set of cosmological parameters? A clue into how the calls between mcmc and evaluate differ will be helpful in trying to understand the source of the problem.
The text was updated successfully, but these errors were encountered:
It's certainly strange! Could you please run the mcmc case again with the --debug option (or debug: True in the yaml) and post here a chunk of the output? This will have a similar effect to what you did in get_new_sample_metropolis, but a bit more detailed and should help us diagnose it.
It doesn't seem that output you posted above for mcmc was generated with debug: True: it prints way more information, in particular, per iteration, what quantities are passed to each part of the likelihood, and what the individual priors and likelihoods are worth.
I am new to Cobaya and the development of Likelihood in this framework. I have written my likelihood and the param file. The params of my file look like this,
When I run the param file with
evaluate
as a sampler, I get the following, seemingly reasonable, outputHowever, when I run with
mcmc
sampler, the sampler keeps running without accepting any model and the number of treid models keeps increasing. This is how the output looks like,I tried to print the likelihood evaluated in the file mcmc.py in the function,
def get_new_sample_metropolis(self):
and it shows that the likelihood is being evaluated to -inf. I guess that is why it cant accept any model.My question is: how can evaluate give me a decent value of the likelihood but
mcmc
sampler fails to get a value when both of them, I think, call the same functionlogposterior
with a set of cosmological parameters? A clue into how the calls betweenmcmc
andevaluate
differ will be helpful in trying to understand the source of the problem.The text was updated successfully, but these errors were encountered: