-
Notifications
You must be signed in to change notification settings - Fork 12
Update to most recent SSMProblems interface #116
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
Conversation
I should note that this requires |
JuliaRegistries/General#129392 is blocking us from making a new |
@FredericWantiez I tried my best at getting the GP to work, but it's cooked. The original implementation didn't have the Markov properties SSMProblems was designed to handle. It should be possible to get working, but I don't know AbstractGPs well enough to make it happen. @THargreaves I managed to fix the Levy Process SSM, minus jump storage. I can probably get this working, but your expertise is extremely valuable. |
dynamics(ssm::TracedSSM, step::Int) = ssm.model.dyn | ||
observation(ssm::TracedSSM, step::Int) = ssm.model.obs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, for most SSMProblems compatible models this is exactly how we determine dynamics/observation processes.
Although, overloading this allows us to do some pretty neat stuff with non-Markovian models (see the Gaussian Process example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at what I've done for the GP script, not sure it's correct given the non-markovian setup and the PGAS update implemented here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I'm not 100% sure this is the proper way to handle things for the GP demo. I only checked the plots and run-times, but from what I saw heuristically it looked good. Apart from some naive checks, this is outside of my expertise.
end | ||
end | ||
|
||
(model::SSMProblems.StateSpaceModel)(Y::AbstractVector) = TracedSSM(model, Y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of type piracy, can't we just use TracedSSM
as the public API ?
model = TracedSSM(LinearGaussianStateSpaceModel(θ), Y)
sample(rng, traced_model, pgas, 500; progress=false)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally fine with me. I just figured that if we interface SSMProblems
with AbstractMCMC
, then we would have to define the observables and state space model tangentially. The syntactical sugar just gets around having to export something that doesn't necessarily need to be public.
This is now fixed! |
This comment was marked as resolved.
This comment was marked as resolved.
Review CommentsThe Gaussian process model is something I struggled to replicate under the new system. Personally, I believe that non-Markovian models should not be handled by the SSMProblems API. With that being said, I think the GP example could be written in such a way that preserves Markov-ness. Any ideas are welcome. I should note that the existence of MiscI added some regards to the description. Contextualizing state space models in the Turing ecosystem really forced me to consider the way we handle sampling via |
Sparse GP priors would resolve this, since the GP prior over latent dynamics depend on a set of pseudo datapoints (known as inducing points) instead of the latent states (see Sec 4 of https://arxiv.org/abs/1306.2861). Then these pseudo datapoints are optimised conditioned on realisations of latent states (e.g. sampled trajectories from PMCMC). |
Thanks @charlesknipp! |
This fork contains all of the required changes to support the newest SSMProblems interface. I also took the liberty to add some syntactical sugar (see
TracedSSM
) which I haven't thoroughly tested, so it's sure to break down.A Philosophical Note
It seems like
AbstractPS
exists to define a general form SMC sampler, where the probablistic model need not be limited to state spaces. A look at the first chapter of Elements of Sequential Monte Carlo illustrates this fact. WhileSMC
as it's defined here is conceptually identical toGeneralisedFilters
, the optimizations built for SSMs and online nature of filtering diverge significantly fromAbstractMCMC
. This makes me wonder whether we should even depend onSSMProblems
here, and instead leave this to an extension inSSMProblems
.