tweag / monad-bayes

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

Notebooks: sampling.ipynb #206

Closed mknorps closed 1 year ago

mknorps commented 1 year ago

Small adjustments to Sampling notebook:

netlify[bot] commented 1 year ago

Deploy Preview for monad-bayes-site ready!

Name Link
Latest commit 3559d87a3d940d9d7b64020b5b0c11b5bf79178a
Latest deploy log https://app.netlify.com/sites/monad-bayes-site/deploys/634830910bfcc00008e61174
Deploy Preview https://deploy-preview-206--monad-bayes-site.netlify.app/sampling
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] commented 1 year ago

Deploy Preview for monad-bayes canceled.

Name Link
Latest commit 83b5802d611c66cf82d8d95121160a4e68cb8396
Latest deploy log https://app.netlify.com/sites/monad-bayes/deploys/634ea57de3483f00081240e7
mknorps commented 1 year ago

@reubenharry Could you explain the weighted vs unweighted sampling a bit more? I do not understand why we need weighted in caseof a normal distribution: image

reubenharry commented 1 year ago

@reubenharry Could you explain the weighted vs unweighted sampling a bit more? I do not understand why we need weighted in caseof a normal distribution: image

I think you're right, and unweighted would be fine. I believe they're equivalent here (since there were no factor statements), but unweighted is clearer, I agree.

mknorps commented 1 year ago

@reubenharry Could you explain the weighted vs unweighted sampling a bit more? I do not understand why we need weighted in caseof a normal distribution: image

I think you're right, and unweighted would be fine. I believe they're equivalent here (since there were no factor statements), but unweighted is clearer, I agree.

The problem I have with this statement is that it needs weighted or a unweighted . weighted functions at all. It is not clear for me:

reubenharry commented 1 year ago

@reubenharry Could you explain the weighted vs unweighted sampling a bit more? I do not understand why we need weighted in caseof a normal distribution: image

I think you're right, and unweighted would be fine. I believe they're equivalent here (since there were no factor statements), but unweighted is clearer, I agree.

The problem I have with this statement is that it needs weighted or a unweighted . weighted functions at all. It is not clear for me:

  • why we have to treat sampling from continuous distribution with additional weights by default and not having weights as an option?
  • if the above is necessary due to implementation logic, could you explain why it is so?

I don't think we need weighted, or even unweighted. The only thing is that we need some weights to give to the histogram, so we could just supply those (something like fmap (,1) (replicateM n model2) (That ends up being what weighted does anyway, which is why the code is the way it is, but I agree it's confusing).