Specifying manual blocking in cobaya
-
- Posts: 11
- Joined: November 07 2019
- Affiliation: UC Berkeley
Specifying manual blocking in cobaya
I have some slow cosmology parameters and some fast bias parameters, and would like to take advantage of blocking to speed up my chains in cobaya. However, I'm having some trouble manually specifying the blocking scheme via the python interface. In the python code I specify the blocking as follows:
info['sampler']['mcmc']['blocks'] = [['logA','Omegam'],['logSN','b1','b2','alpha_cross','alpha_auto','alpha_matter']]
info['sampler']['mcmc']['oversampling_factors'] = [1,100]
which is reflected in the .updated.yaml file:
blocking: null
blocks:
- - logA
- Omegam
- - logSN
- b1
- b2
- alpha_cross
- alpha_auto
- alpha_matter
oversample: true
oversampling_factors:
- 1
- 100
but cobaya insists that it is blocking in a different way:
[mcmc] Oversampling with factors:
5 : ['logA', 'logSN', 'Omegam', 'b1', 'alpha_cross']
138 : ['b2', 'alpha_auto', 'alpha_matter']
backed up by the .checkpoint file:
sampler:
mcmc:
converged: false
Rminus1_last: .inf
proposal_scale: 2.4
blocks:
- - 0
- 1
- 2
- 3
- 5
- - 4
- 6
- 7
oversampling_factors:
- 5
- 138
What mistake am I making here?
info['sampler']['mcmc']['blocks'] = [['logA','Omegam'],['logSN','b1','b2','alpha_cross','alpha_auto','alpha_matter']]
info['sampler']['mcmc']['oversampling_factors'] = [1,100]
which is reflected in the .updated.yaml file:
blocking: null
blocks:
- - logA
- Omegam
- - logSN
- b1
- b2
- alpha_cross
- alpha_auto
- alpha_matter
oversample: true
oversampling_factors:
- 1
- 100
but cobaya insists that it is blocking in a different way:
[mcmc] Oversampling with factors:
5 : ['logA', 'logSN', 'Omegam', 'b1', 'alpha_cross']
138 : ['b2', 'alpha_auto', 'alpha_matter']
backed up by the .checkpoint file:
sampler:
mcmc:
converged: false
Rminus1_last: .inf
proposal_scale: 2.4
blocks:
- - 0
- 1
- 2
- 3
- 5
- - 4
- 6
- 7
oversampling_factors:
- 5
- 138
What mistake am I making here?
-
- Posts: 37
- Joined: April 15 2013
- Affiliation: RWTH Aachen
- Contact:
Re: Specifying manual blocking in cobaya
Hi Alex,
The correct setting for the blocking is `blocking`, not `blocks/oversampling_factors`, which are only used internally. Check out the docs at https://cobaya.readthedocs.io/en/latest/sampler_mcmc.html#options-and-defaults
Notice that (unless you are using devel), what is indicated in front of each block is not the oversampling factor but the speed, so you may have to tune it to get the desired oversampling factor.
The correct setting for the blocking is `blocking`, not `blocks/oversampling_factors`, which are only used internally. Check out the docs at https://cobaya.readthedocs.io/en/latest/sampler_mcmc.html#options-and-defaults
Notice that (unless you are using devel), what is indicated in front of each block is not the oversampling factor but the speed, so you may have to tune it to get the desired oversampling factor.
-
- Posts: 11
- Joined: November 07 2019
- Affiliation: UC Berkeley
Re: Specifying manual blocking in cobaya
Hi Jesus,
Thanks! The docs you link specify the format for blocking in yaml:
blocking:
# - [speed_1, [params_1]]
How would I translate this into python ordered dicts?
Thanks! The docs you link specify the format for blocking in yaml:
blocking:
# - [speed_1, [params_1]]
How would I translate this into python ordered dicts?
I am using devel (from March 20)--what should I indicate in front of each block?Notice that (unless you are using devel), what is indicated in front of each block is not the oversampling factor but the speed, so you may have to tune it to get the desired oversampling factor.
-
- Posts: 37
- Joined: April 15 2013
- Affiliation: RWTH Aachen
- Contact:
Re: Specifying manual blocking in cobaya
(Sorry for the delayed answer!)
The desired oversampling factor.I am using devel (from March 20)--what should I indicate in front of each block?
The value of blocking It should be a list of tuples (oversampling_factor, list_of_params), not a dict.How would I translate this into python ordered dicts?
-
- Posts: 11
- Joined: November 07 2019
- Affiliation: UC Berkeley
Re: Specifying manual blocking in cobaya
Hi Jesus,
Thanks for the help--this fixed my problem!
Best,
Alex
Thanks for the help--this fixed my problem!
Best,
Alex