Path: blob/master/notebooks/book2/18/gp_poisson_1d.ipynb
1192 views
Kernel: Python 3.10.4 ('PyroNB')
GP with a Poisson Likelihood
https://tinygp.readthedocs.io/en/latest/tutorials/likelihoods.html
We use the tinygp library to define the model, and the numpyro library to do inference, using either MCMC or SVI.
In [ ]:
Data
In [ ]:
Markov chain Monte Carlo (MCMC)
We set up the model in numpyro
and run MCMC. Note that the log_rate
parameter doesn't have the obs=...
argument set, since it is latent.
In [ ]:
We can summarize the MCMC results by plotting our inferred model (here we're showing the 1- and 2-sigma credible regions), and compare it to the known ground truth:
In [ ]:
Stochastic variational inference (SVI)
For larger datasets, it is faster to use stochastic variational inference (SVI) instead of MCMC.
In [ ]:
As above, we can plot our inferred conditional model and compare it to the ground truth:
In [ ]: