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

WIP: Gaussian Processes #564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sglvladi
Copy link
Collaborator

This PR stems from work performed on attempting to fit Gaussian Processes into the existing framework.

More specifically, a SimpleGaussianProcess transition model has been added, along with an example use-case.

Some notable points for discussion:

  • Currently, the model expects a Track instead of a State object as an input to the function() method, while the same is also necessary when evaluating the matrix() and covar() methods, even though the model is inherently a LinearGaussianTransitionModel.
    • The main reason for the above is that the last num_lags timestamps are necessary for computing the Kernel matrix.
    • Even though this is currently compatible with most hypothesisers, since the actual Track instance is forwarded to the underlying predictors (see here), predictors like the KalmanPredictor would not forward this to the transition model.
  • The model expects a start_time argument on initialisation, which is used to compute the respective timestamps (in terms of number of seconds since start_time).
    • This is not ideal since different tracks may require different values for start_time.
    • Note that start_time is not (necessarily) the same as the timestamp of the first track state.

NOTE: This PR is Work In Progress
The main purpose of the PR at its current stage is to motivate thoughts and discussions on how this can be taken forward.

@sglvladi sglvladi requested a review from a team as a code owner December 14, 2021 17:26
@sglvladi sglvladi requested review from oharrald-Dstl and jswright-dstl and removed request for a team December 14, 2021 17:26
@sdhiscocks
Copy link
Member

Some notable points for discussion:

  • Currently, the model expects a Track instead of a State object as an input to the function() method, while the same is also necessary when evaluating the matrix() and covar() methods, even though the model is inherently a LinearGaussianTransitionModel.

    • The main reason for the above is that the last num_lags timestamps are necessary for computing the Kernel matrix.
    • Even though this is currently compatible with most hypothesisers, since the actual Track instance is forwarded to the underlying predictors (see here), predictors like the KalmanPredictor would not forward this to the transition model.

This is also compounded by the cache which pulls the state from the track for Kalman based predictors:

if isinstance(prior, StateMutableSequence):
prior = prior.state
return func(self, prior, *args, **kwargs)

The reason for passing a Track to the Predictor, was for the case where a predictor may use history of the track as part of the process, but the Kalman predictors at least don't cover the case that the model may use the history.

  • The model expects a start_time argument on initialisation, which is used to compute the respective timestamps (in terms of number of seconds since start_time).

    • This is not ideal since different tracks may require different values for start_time.
    • Note that start_time is not (necessarily) the same as the timestamp of the first track state.

I'm not sure on the best approach to solve this. One less than ideal way would be to create a predictor that wrapped existing predictors, which could operate on the track, extract out the timestamps and work out the required start_time for the track (not clear on how start_time is defined), then either replace or modify the model linked to the wrapped predictor.

Maybe another solution is to pass the track as a keyword argument? This could be done in predict_lru_cache?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants