tweag / monad-bayes

A library for probabilistic programming in Haskell.
MIT License
407 stars 62 forks source link

Updated docs #127

Closed reubenharry closed 1 year ago

reubenharry commented 2 years ago

The broad goal is to make monad-bayes accessible to anyone with a beginner understanding of Haskell and a beginner understanding of Bayesian inference. That will require clear tutorials with simple working examples.

idontgetoutmuch commented 2 years ago

This is great - I am writing up an example of PMMH independent of monad-bayes - I've put notes in pdf form here:

odeModelExpanded.pdf

The code is here:

  1. https://github.com/idontgetoutmuch/abm-particle-filter/blob/mathematical-exposition/src/Data/PMMH.hs#L42
  2. https://github.com/idontgetoutmuch/abm-particle-filter/blob/mathematical-exposition/src/Data/PMMH.hs#L93

I've also used Stan to infer the parameters albeit for a slightly(?) different model (one that is fully deterministic once you know the parameters). This is included in the pdf above and in the git repo.

MMesch commented 2 years ago

This looks great. Looking forward to the PR. I can iterate through it.

reubenharry commented 2 years ago

Thanks for those notes! One of the more time-intensive parts of the docs that I haven't yet done is to have a worked through example of PMMH, so I may use your notes as reference material for writing that.

idontgetoutmuch commented 2 years ago

@reubenharry I don't know how much mathematical detail you want to put in the docs. I think the Stan documentation is great but even that does not try to explain Hamiltonian Monte Carlo. Ah but it does here: https://mc-stan.org/docs/2_29/reference-manual/hamiltonian-monte-carlo.html although not particularly rigorously or in great detail. Anyway I am nowhere near finished explaining HMC let alone how one can use it to approximate the posterior (log) likelihood for use in MCMC (or even HMC). You can see what you think when I have finished. I am attempting to make it accessible to a widish audience while still remaining mathematically unsullied :-)

reubenharry commented 2 years ago

I'm definitely very in favour of mathematical detail as long as it's presented in a way that doesn't obscure the high level picture. My thinking (somewhat influenced by https://documentation.divio.com/) was that we could divide the various documentation-like things into:

reubenharry commented 1 year ago

@idontgetoutmuch The one last thing I'd like to do here is to have a link on hackage to the website or the github repo, so that it's clear that's the place to go for a readme. I'm not experienced with Haddocks - do you know where I'd put that info so it appears on the front page of the docs on hackage?

idontgetoutmuch commented 1 year ago

How does this look? https://hackage.haskell.org/package/monad-bayes-1.1.0/candidate

reubenharry commented 1 year ago

Perfect! (There's only quotation mark that I think is a typo)