Stone-Soup
Stone-Soup copied to clipboard
Allow predicting backwards in predictor
Currently, the predictor uses the time difference of a state to a new time (assuming the time will always be positive) the predicted covariance uses this time difference. If one were to want to predict backwards, i.e., the new time occurs before the current state, the time difference is negative and therefore the predicted covariance (which uses the negative time difference) creates a covariance with negative elements.
I suggest the covariance calculation uses the absolute time difference rather than the time difference to allow the covariance to remain positive when predicting backwards in time.
We may want to be careful with this one. If the reason you get a negative time-difference is because due to out of sequence measurements, simply processing measurements with an absolute time difference is not the correct approach. I have found myself in situations where I hadn't ordered the measurements correctly and the fact I was getting negative covariances enabled me to debug my issues.
+1 for OP, +1 for note of caution. Whilst inferring backward in time is useful for out-of-sequence and track stitching, it's not strictly 'prediction' (retrodiction perhaps?). The physicist part of me appreciates the arrow of time and that if we were to wind it back slightly covariances can decrease (dependent on the model) - and as Lyudmil says, one can go too far and end up with 'unphysical' estimates, which is a useful sanity check.
How about a separate Retrodictor
class? That would allow a distinct backward-in-time transition model which could be symmetric (i.e. use absolute time), or use a reversible transition model, or something a bit more heuristic. The latter recognising that track stitching is often done very ad-hoc.