Replies: 6 comments 13 replies
-
|
This is great!! I think you can go ahead and make the PR so we can clearly see the few lines changed! I'm not sure whether this should be supported at the cuthbert PF level or the cuthbertlib resampling. Regarding 1. I think if it doesn't change the computed values and adds minimal overhead I'd be ok to have it as default behaviour without the option (is there any downside to it??) I think @AdrienCorenflos might have some thoughts on 2. |
Beta Was this translation helpful? Give feedback.
-
|
I think we want to have the option to turn this off (i.e., no `stop_gradient). When using the resampling scheme from Adrien's paper (which we should implement at some point), we do want the gradient to flow through the resampling step. Maybe it makes more sense to have this as a property of the resampling schemes in |
Beta Was this translation helpful? Give feedback.
-
|
Within the current library framework my OT based resampling is a bit inconvenient because it modifies the locations of the particles, whereas other resamplings don't. This can of course be changed but it's currently incompatible. |
Beta Was this translation helpful? Give feedback.
-
|
Now that I think about it, it's probably something we'll want to change anyway because there are a number of resamplings that directly need to have access to the locations anyway! |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the lively discussion! I've made a version that uses the resampling refactor -- I haven't made a PR yet since that branch may ostensibly change a bit, but will rebase + PR after #207 lands. You can see it on my fork at https://github.com/DanWaxman/cuthbert/tree/dw-sg-dpf. |
Beta Was this translation helpful? Give feedback.
-
|
Closing this discussion since #202 landed! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the PF defined in the SMC classes is not differentiable, in the sense that estimators of the score (i.e., grad(marginal log likelihood)) will be biased. In fact, automatic differentiation at all is broken now on CPU, but bias persists even after fixing that. This is unfortunate, because it limits what one can do for system identification -- for example, SGMCMC -- which rely on these score estimates being unbiased.
There are several ways to ameliorate this (c.f. the PyDPF paper), but one of the simplest is the stop-gradient trick, which recovers some classical gradient estimators by a simple + term - term trick.
I implemented this version of the DPF, and compared the resulting MLL and score estimates of a bootstrap PF to the analytically-known ones in a linear-Gaussian SSM. These show the expected results, i.e., that both the PF as-is and DPF have good MLL estimates, but the PF is highly biased:

This bias persists under many Monte Carlo draws, even at the true parameters:

The implementation adds minimal overhead (which is also in line with the paper):
This leaves two main design questions:
filter_combineis nowlax.stop_gradientwill be called every time anyways).You can check out the implementation (which is only a few lines of code changed) on this branch of my forked copy.
Beta Was this translation helpful? Give feedback.
All reactions