Comments (7)
Hi Vivian,
this sounds like you just want to manually add a likelihood, so you have to add another likelihood to your cobaya dictionary
sampler['likelihood'] = {
'theta_star_likelihood': {
'external': theta_star_gaussian,
},
# other likelihoods ...
with some Gaussian
def theta_star_gaussian(theta_star):
return scipy.stats.norm.logpdf(...)
I think there is also an even shorter way without defining the external
function but the key is adding the Gaussian to your likelihoods.
Cheers,
Stefan
PS: Name of function and likelihood is not important, just the argument of the likelihood function has to match your parameter.
from cobaya.
Thank you.
Sorry for the delay. I was in the DES meeting in the UK (super busy)
Will this work even if I am not sampling on \theta? I am sampling on H0 instead and I can't change that because my work is in the context of DES. That has been my problem - how to find \theta variable when I am sampling H0.
from cobaya.
Hmm, I see the problem and I can't find a solution in this case.
It should be possible to get theta (probably 100*theta_s
or theta_s_1e2
) out of classy and use it for the likelihood. In the cobaya documentation here it says any param that CLASS understands
but I don't know how to do that, especially because 100*theta_s
is a terrible variable name ...
Edit: If the parameter is added to the params block it should be available to the custom likelihood as well.
Edit2: Oh, I was thinking you are using CLASS. The variable name for CAMB is different as Antony pointed out
from cobaya.
Does it not work by making a new likelihood as Jesus suggested in #18? "thetastar" is a standard CAMB derived parameter so you should be able to get it from _theory (and then rescale?).
If it doesn't work a simple toy example yaml/.py to reproduce the issue might be helpful - we are working on some significant internal changes at the moment that may make more general dependencies possible and useful to have test cases.
from cobaya.
I see, Thank you. @JesusTorrado @cmbant any idea on how I can do this?
from cobaya.
I haven't tried but as above but with something like this (assuming CAMB)?
def theta_star_gaussian(_theory={'thetastar'}):
thetastar = _theory.get_param('thetastar')
. ...
(or maybe "cosmomc_theta")
from cobaya.
Thank you
like_theta: "lambda _theory={'thetastar': None}: stats.norm.logpdf(_theory.get_param('thetastar'),loc=1.04092,scale=0.0031)"
worked. I was misspelling the thetastar variable (I was including an _ in between) before. You are all the best!
from cobaya.
Related Issues (20)
- Backward Compatibility with python 3.9 HOT 4
- "The sum of logpriors in the sample is not consistent." when resuming chains HOT 3
- Something went wrong when looking for a covmat HOT 1
- Script invocation is broken on Python 3.9 HOT 4
- Python invocation not doing anything HOT 4
- FutureWarning
- Interpolation error creating a delta chi2 = 20 on DESI likelihood HOT 7
- Installing DESI data: could not be found error HOT 4
- cobaya-install cannot name '__obsolete__' from 'cobaya' (unknown location) HOT 4
- cobaya-install planck_2018_highl_plik.TTTEEE fails HOT 2
- bao.generic likelihood not working for the distances of type Dv_over_rs HOT 6
- Error with the .yaml file generated from cosmo generator HOT 3
- *ERROR* Requested fast/slow separation, but all parameters have the same speed HOT 3
- NPIPE likelihood HOT 2
- Cobaya 3.5.1 and ACT HOT 2
- Sampling over HMCode params HOT 2
- module 'clik' has no attribute 'lkl' HOT 5
- pytest-forked HOT 2
- numpy 2 in tests HOT 1
- Github actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cobaya.