-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues sampling with PyMCv5 (gp.marginal fails when combined modelling GP+transit) #124
Comments
Ok, it looks like using
So that seems to fix it! Though I am apprehensive about this as having a bit of a blackbox likelihood function - sometimes that doesn't play ball with some arviz functions like |
I'm also coming across this issue, thanks @hposborn for the current fix! I imagine the only workaround to this is if marginal calls something like pm.Potential(pm.logp(pm.MvNorm(<gp.marginal's vars>), observed=y-transit_model))... It seems like pymc5+> are keeping observed as observed onwards. |
My "fix" doesn't really work - I end up with compilation errors when running large models that way. So I'd love to know the official way of sampling with |
Hi @hposborn , I believe the solution to this is to indeed model the classical way of lc+GP = observed, but this is accessed through setting the GP mean as your light curve. Using your code:
(Obviously making sure flux and lightcurve+mean_flux are centered around the same value) Let me know if this works! I believe this should be the solution moving from pymc>=5 |
I am having issues using celerite2 with PYMC. In the past (with PyMC3) I always used
gp.marginal(observed=y-extra_model)
in order to sample models which included both GP and other variables (i.e. a transit model) and this had no issue. For whatever reason that is no longer the case with PyMCv5 and I getTypeError: Variables that depend on other nodes cannot be used for observed data.
.I thought an easy alternative would be to initialise with
gp.compute()
, generate a predicted GP curve withgp.predict()
, and then model everything the "classical" way in PyMC usingpm.Normal(mu=gp_pred+extra_model, sigma=y_err, observed=y)
. But this gives completely different, and horrendously overfitted, results from usinggp.marginal()
for the same model. (see below)So I would love some advice on how to model combined celerite + additional functions:
a) Is there any way to sample using
gp.marginal()
where the observed data can depend on other PyMC parameters? For example, maybe themean
function could be more than a single value but to haveN_t
values and we can put the transit model in that way?b) How should sampling within PyMC be done if using
gp.marginal()
withy-extra_model
is not possible? Should we be usinggp.predict()
for this purpose at all, or is there just a step I'm missing which is causing the drastic overfitting?Some code as a MWE:
The anticipated behaviour, using
gp.marginal()
(no transit):The arviz summary:
So a GP-only model works fine.
The behaviour when including an additional non-celerite mean function (with
exoplanet
transit):Output:
I have verified that the same error occurs across different computers (both my M2 Mac and linux server).
The behaviour when sampling with the output of
gp.predict()
:The arviz summary:
This is clearly extremely over-fitted for some reason...
The text was updated successfully, but these errors were encountered: