-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add testing and examples for conditional SMC. #67
Conversation
9f7ed3b
to
091ddd6
Compare
Note that the CI failed here. Maybe you forgot to commit an updated RcppExports.{R, cpp} or NAMESPACE file? |
091ddd6
to
8f16897
Compare
Yes I keep screwing things up quite strongly here for quite some time already ... I sorry I do not recall the exact workflow with If you have a minute, could you be so kind to briefly sketch the workflow:
Now, Just pushed again with updated |
8f16897
to
3156032
Compare
In the narrow sense, Where users can tripped up is the R and In any event, if it doesn't pass |
BTW, given that we are all one happy SMC family now you can just branch off RcppSMC/rcppsmc and it becomes easier for us to follow. |
Thanks for the information @eddelbuettel ! Yes keeping on and try to hammer through with my forced pushes, hoping for a miracle hole to appear in the CI wall, (which is rather well protected against brute force and should be passed via thinking) is unwise for sure... I'll give it a try next week, we are not in a hurry (I hope). |
In this case you were missing the second closing (The fact that (Part of those are due to a bad idea. I would not do
and then
as 'nobody knows' what |
Yes!! I'll check it locally, thanks for the hint! |
1. standard BPF 2. conditional BPF with (conditional) multinomial resampling
3156032
to
42a2208
Compare
Note for all: though CI passed, this remains highly WIP and is far from ready for a merge since the other parts from #63 are meant to be implemented within this PR as well. |
Just tried that @eddelbuettel but it seems I do not have write/read permissions (or I am doing sth. completely wrong here...)
I am absolutely fine with working with the fork and do PRs from there (as before), so no need to change this for me, but could probably make things easier for all to follow, as you said above. |
What does edd@rob:~/git/rcppsmc(master)$ git remote -v
origin git@github.com:eddelbuettel/rcppsmc.git (fetch)
origin git@github.com:eddelbuettel/rcppsmc.git (push)
edd@rob:~/git/rcppsmc(master)$ Edit Never mind, my mistake. You are indeed not listed at the repo so my bad. Just fork as previously then. |
- D.E. bugfix during development of conditional SMC testing. - Some changes to the innovation and measurement variances of data simulation.
8457613
to
c6f34cf
Compare
Merged the changes from the other skeleton PR, so nothing to have a look at atm. Will try to fill in my additions over the weekend so we may have a more detailed look at it next week or so! |
0894836
to
f640871
Compare
- some bugfixes - make simulation function simGaussianSSM easier to handle - reduce number of model parameters - but include optional initial state value x_0 - update doc - add cSMC to output - add preliminary plot of the results
8fe3589
to
fec70cc
Compare
I've been working for some time on this PR, specifically I was double checking the conditional resampling code I implemented back then and the working paper. Regarding the stratified resampling, the following is given (p.7 of the WP): The definition is important since, for implementing cond. resampling we first need to sample the where
I do not even see why (where the latter follows by the monotonicity of the normalized weight sum). And that would mean (implictly by my assumption that such a |
Thanks, @ilyaZar, indeed the probabilities need to be positive for it to make sense. I think the presentation in the technical report was a bit lazy (and should be fixed) and this expression applies to those i for which the probability is non-zero and that the issue is resolved by replacing the probabilties specified here with the maximum of 0 and the expression given. |
- revise systematic and stratiefied resampling - improve in function documentation of algorithms - fix error that allowed for negative weights by wrapping with max(previous_expression, 0) the strata weights - revise plot design: use layoutMatrix to fit all into one plot - toDo: fix error in residual resampling from back then GSOC
342cfa6
to
c281608
Compare
Update: To make the PR easier to follow, I moved most of the "technical" discussion of the simulation results to #63
Maybe some of my thoughts:
|
efb2431
to
21e2038
Compare
21e2038
to
b543672
Compare
Updates to this PR I just shortened results of this PR in the above comment, and moved the main simulation results to the corresponding discussion section. I would like to turn this PR from a draft to be merged. What do you think @adamjohansen @LeahPrice @eddelbuettel , are there any specific requests, or things I have missed and could check additionally? I know this is quite a lot for a PR, but at least we have now a good and thorough testing of these conditional facilities and a good reference point/ documentation we can go back to and re-check if something breaks in the future. When this is done I would like to turn to writing up the paper finally, but I still do not have write access to the paper repo (https://github.com/rcppsmc/post-gsoc) so I don't think I can merge @LeahPrice 's PR https://github.com/rcppsmc/post-gsoc/pull/2 , unfortunately. |
21629f3
to
0793cea
Compare
- add improvement of initialization step: move from X_0 to X_1 within the pfInitialize function - possible bug fixed: change order of .SetResampleParams() and .Initialise() member functions of the sampler and conditionalSampler class; SetResampleParams should be performed BEFORE first initializaion (otherwise first period state X_1 is incorrectly sampled) - add printing statemenet of the simulation iteration - change default autoregressive parameter phi from 0.9 to 0.7 (reduce autocorellatio in the simulated model by default) - provide possible fix to conditional residual resampling alg. within conditionalSampler class -> output of outputNCestimates indicates that residual resampling is working fine but further checks may be necessary - allow outputNCestimates to make plot of conditional resampling as an illustration of this feature (changes to cSMCexamples.cpp and cSMCexamples.R) -> update labels for Kalman filter and title of boxplots: use 'log-likelihood' as this is what is actually shown - make boxplots horizontal - major revision of the documentation - add model description to the details part of simGaussianSSM - remove old text parts - change output names to more evocative - fix typos: 'likelihood' must be 'log-likelihood' and other typos - reduce number of "headers" in cSMCexamples.{h,cpp} for clarity - update ChangeLog
0793cea
to
3d7bfd9
Compare
I've taken a look at the output Ilya created here and in #63 and it all looks reasonable to me. I've taken a quick look at the code but haven't checked every line thoroughly. I suggest we merge it now as Ilya suggests so he can move on with other things. What do you think @adamjohansen and @eddelbuettel? |
If all give green light (please feel free to add any suggestions before of course!!) I could go and merge this (would be my first merge, so I am curious to try). Overusing the screenshot functions once more, write access is given here in this repo (otherwise I could not merge), but (and this is strange, or I am missing something obvious) the repo where this PR lives, https://github.com/rcppsmc/post-gsoc/pull/3, seems to not grant write access or I am not able to merge because of some Github quirk I am unaware of. See the two snippets From this repo:From https://github.com/rcppsmc/post-gsoc/ |
Sorry for being so very slow to get back to you with this, given the work involved I did want to take the time to have at least a bit of a look at it (and somehow although I kept expecting to have time to fit it in other things kept happening). It looks great. I'd be happy to merge. I'll have a slightly more careful look at the conditional resampling code when things have settled down but it looked good on a quick reading and the testing results are very suggestive. There's a trade-off between being self-contained and re-inventing the wheel and I'd have been inclined to use, say, |
I've now added you as a contributor with write access to that repo. Hopefully that resolves the issue. |
Seconded. It's 2022, we've been here for a while together now and training wheels should be off for everybody -- we may as well set everybody to owner. Sadly, I think, changing it at the org level does not auto-propagate to repos within so if you "see something, say something" i.e. just ping @adamjohansen or myself and we adjust settings accordingly.. |
- does the type 2 simulation study, see the discussion in rcppsmc - changes from manual KF and smoother implementation to FKF::fkf and FKF::fks
ebe9049
to
065270a
Compare
@adamjohansen added
That might have the appeal that it allows demo/example packages to be with loads of dependencies, nice graphics from
@eddelbuettel @LeahPrice @adamjohansen I'll leave that PR for a couple of days if someone comes up with something, and if not, I'll be happy to merge it by the end of the week! |
Looks good to me @ilyaZar and it doesn't hurt to have a few fewer lines of code to maintain. |
(So I think you can go ahead and merge, if that wasn't apparent in what I wrote...) |
So hopefully this goes into the right direction for testing and adding a simple example to consolidate some of the past work on conditional SMC.
It's not yet ready for review but I decided to make it visible so you can have a look at it from time to time.