Skip to content

Conversation

@vandalt
Copy link

@vandalt vandalt commented Mar 6, 2024

Hi!

This PR is a first attempt to update all case studies to the PyMC v5 version of exoplanet.

Most changes went smoothly, but here are a few things worth noting:

  • The estimate_invers_gamma_parameters() function had been removed from pymc-ext. I added it back (see Add back estimate_inverse_gamma_parameters() in utils pymc-ext#46)
  • In PyMC v5, the observed argument must be static data and cannot depend on parts of the models.
    • This affected the eccentricity priors when eccentricity is a derived parameter. I modified the two priors to work when eccentricity is derived from other parameters using a pm.Potential(). This change is in Support PyMC v5 exoplanet#309
    • It also affected GPs if the mean function was removed directly from the data to fit the residuals, instead of passing a mean argument to the GP. I modified all GPs to be specified in the latter way. I updated the related sigma-clipping and plotting code as well.
  • At least two notebooks were significantly slower than the PyMC3 version (on my laptop, at least): the eclipsing binary one and the multi-instrument transit one.
    • For the eclipsing binary one, I noticed that even in PyMC3, the optimization gave "NaN" logps. In PyMC 5, this raised errors, so I had to modify the optimization a bit. The final sampling results are the same, but MCMC was slower to run on my machine by a factor ~4.
    • For the multi-instrument transit, I'm not sure what the issue is. The KeplerianOrbit issues a warning that ror should be specified (which I think would require the two instruments to have their own orbit, but with shared parameters except ror). The MAP result is also not exactly the same as in PyMC3. The sampling took a couple of hours. Results are again the same as with PyMC3, just much slower.
    • A few things common to the two notebooks that could help further investigation: they both include light curves with fairly large datasets, they both use a GP on those light curves, and they both use sigma clipping with masked data.

I rarely have to fit light curves, and I'm mostly using Jax recently (though I do like to have PyMC models available as an option), so I don't think I'll have time/interest to dive further into the speed issues, but I think this PR is a good first step to getting all case studies working with PyMC 5.

Thanks!

@havijw
Copy link

havijw commented Jun 25, 2025

Is there anything blocking this from being merged? The tutorials on the main docs site don't work correctly right now, as noted in an exoplanet issue, and I think the modifications needed are not trivial and definitely not obvious to a newcomer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants