Skip to content
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

Alignment of obs/dyn time steps and refactored forward simulation #55

Merged
merged 8 commits into from
Sep 5, 2024

Conversation

THargreaves
Copy link
Collaborator

@THargreaves THargreaves commented Aug 30, 2024

Changes:

  • Modified the definitions of the interface to align the obs/dyn time steps as per Off-By-One Errors #54
  • Introduced type parameters to the dyn/obs representing the state/observation types
  • Used these type parameters and new alignment to refactor the forward simulation code
  • Added a unit test for forward simulation

I have a fear that these new type parameters, although useful, might be a bit over-engineered and lead to sticky edge-cases. Very happy to revert those changes if others think that is best.

TODO:

  • If we're happy with these type parameters, it may be worth updating the method signatures to include them, e.g. distribution(dyn::LatentDynamics, step::Integer, prev_state, extra) -> distribution(dyn::LatentDynamics{T}, step::Integer, prev_state:T, extra). This could potentially lead to method ambiguity errors if the user misses out these types in their own definition (their dynamics will be more specific, but the documentation's state will be more specific).
  • I'm currently not returning the initial state x0 or allowing an extra to be passed to initialisation. This is because doing so would required xs/extras to have a zero index. This could be handled by offset arrays but that feels like a big dependency. Kalman.jl handles this by using a vector of pairs t => x but that feels clunky. I question how much the initial state/extra for initial are actually needed.

Copy link
Collaborator

@charlesknipp charlesknipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides some minor comments, I like what I see.

src/SSMProblems.jl Show resolved Hide resolved
src/SSMProblems.jl Outdated Show resolved Hide resolved
src/SSMProblems.jl Show resolved Hide resolved
src/SSMProblems.jl Show resolved Hide resolved
src/SSMProblems.jl Outdated Show resolved Hide resolved
@THargreaves THargreaves mentioned this pull request Sep 2, 2024
@THargreaves
Copy link
Collaborator Author

All suggested changes made. Since this is a breaking change to the interface, I've bumped the minor version. Will merge now.

@THargreaves THargreaves merged commit 1ee4f2e into main Sep 5, 2024
3 checks passed
@THargreaves THargreaves deleted the th/off-by-one branch September 5, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants