{"action":"created","issue":{"url":"https://api.github.com/repos/adscib/monad-bayes/issues/20","repository_url":"https://api.github.com/repos/adscib/monad-bayes","labels_url":"https://api.github.com/repos/adscib/monad-bayes/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/adscib/monad-bayes/issues/20/comments","events_url":"https://api.github.com/repos/adscib/monad-bayes/issues/20/events","html_url":"https://github.com/adscib/monad-bayes/pull/20","id":159591174,"number":20,"title":"Resample-move SMC","user":{"login":"yfcai","id":965773,"avatar_url":"https://avatars.githubusercontent.com/u/965773?v=3","gravatar_id":"","url":"https://api.github.com/users/yfcai","html_url":"https://github.com/yfcai","followers_url":"https://api.github.com/users/yfcai/followers","following_url":"https://api.github.com/users/yfcai/following{/other_user}","gists_url":"https://api.github.com/users/yfcai/gists{/gist_id}","starred_url":"https://api.github.com/users/yfcai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yfcai/subscriptions","organizations_url":"https://api.github.com/users/yfcai/orgs","repos_url":"https://api.github.com/users/yfcai/repos","events_url":"https://api.github.com/users/yfcai/events{/privacy}","received_events_url":"https://api.github.com/users/yfcai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"adscib","id":3524715,"avatar_url":"https://avatars.githubusercontent.com/u/3524715?v=3","gravatar_id":"","url":"https://api.github.com/users/adscib","html_url":"https://github.com/adscib","followers_url":"https://api.github.com/users/adscib/followers","following_url":"https://api.github.com/users/adscib/following{/other_user}","gists_url":"https://api.github.com/users/adscib/gists{/gist_id}","starred_url":"https://api.github.com/users/adscib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adscib/subscriptions","organizations_url":"https://api.github.com/users/adscib/orgs","repos_url":"https://api.github.com/users/adscib/repos","events_url":"https://api.github.com/users/adscib/events{/privacy}","received_events_url":"https://api.github.com/users/adscib/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2016-06-10T09:09:10Z","updated_at":"2016-06-17T09:25:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/adscib/monad-bayes/pulls/20","html_url":"https://github.com/adscib/monad-bayes/pull/20","diff_url":"https://github.com/adscib/monad-bayes/pull/20.diff","patch_url":"https://github.com/adscib/monad-bayes/pull/20.patch"},"body":"Preliminary prototype of resample-move SMC according to Adam Scibior's idea of using a list of continuations as the state of Metropolis transition.\r\n\r\nChanges\r\n\r\n- Replaced module `Trace` to use a list of continuations as the state of the Markov chain, implemented via a coroutine with suspension points at primitive distributions. Alternative states (i. e., types in the class `RandomDB`) are deleted.\r\n\r\n- Added `Inference.smcWithResampler`, the common template between `smc` and `smcFast`, implemented according to the paper draft.\r\n\r\n- Added `Inference.smcrm` according to the paper draft. The only subtle point is that `mhStep` is specialized to `Population m` to discard new weight after transition. Only then is the posterior preserved."},"comment":{"url":"https://api.github.com/repos/adscib/monad-bayes/issues/comments/226723098","html_url":"https://github.com/adscib/monad-bayes/pull/20#issuecomment-226723098","issue_url":"https://api.github.com/repos/adscib/monad-bayes/issues/20","id":226723098,"user":{"login":"yfcai","id":965773,"avatar_url":"https://avatars.githubusercontent.com/u/965773?v=3","gravatar_id":"","url":"https://api.github.com/users/yfcai","html_url":"https://github.com/yfcai","followers_url":"https://api.github.com/users/yfcai/followers","following_url":"https://api.github.com/users/yfcai/following{/other_user}","gists_url":"https://api.github.com/users/yfcai/gists{/gist_id}","starred_url":"https://api.github.com/users/yfcai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yfcai/subscriptions","organizations_url":"https://api.github.com/users/yfcai/orgs","repos_url":"https://api.github.com/users/yfcai/repos","events_url":"https://api.github.com/users/yfcai/events{/privacy}","received_events_url":"https://api.github.com/users/yfcai/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T09:25:14Z","updated_at":"2016-06-17T09:25:14Z","body":"> why `mhStep'` needs to be specialized to `Particle m`?\r\n\r\nThe main reason is that we want to discard the weight produced by MH transition and restore the old weight. Otherwise MH transition does not preserve posterior. Here is a proof sketch.\r\n\r\nLet `P` be the Metropolis kernel. Let `π` be the posterior distribution. `P` preserves `π` in the sense that\r\n```\r\nπ(dy) = P(x,dy) π(dx) .\r\n```\r\nLet `ρ` be the prior and let `f` be the scoring function; then\r\n```\r\nπ(dx) = f(x) ρ(dx) .\r\n```\r\nSubstituting the 2nd equation into the 1st yields\r\n```\r\nπ(dy) = f(x) P(x, dy) ρ(dx) .\r\n```\r\nNote that after the MH transition, we are sampling directly from `P(x, dy) ρ(dx)`. To retain the posterior `π(dy)`, the correct score is the old score `f(x)`, not the new one `f(y)`. Simply calling `mhStep` inside `Trace'` would use the new weight `f(y)` and would not be correct.\r\n\r\nThere could be a way to implement `mhStep'` without mentioning `Population`, probably along the line of\r\n```\r\nmhStep' :: (MonadBayes m) => Trace' m a -> Trace' m a  .\r\n```\r\nWe need `MonadBayes` to be able to adjust the score after MH transition. So far I haven't managed to restore the old weight correctly. I will give it more attempts.\r\n\r\n\r\n\r\n> why is `Trace` not an instance of `MonadTrans`?\r\n\r\nIt easily could be. I will add the `MonadTrans` instance declaration.\r\n"}}
{"actor":{"display_login":"yfcai"}}