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 mean function support for spatiotemporal GPs #21
Conversation
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.
I think you can't really distribute the temporal and spatial means across the prediction the way you do (see detailed comment)
So there is not a real need to have the Separable vs non separable mean abstraction.
yes for test! (not sure what scenario makes sense though, we do not have tests for spatio temporal at all actually, bad. any test welcomed)
notebook: we have one, maybe just add a mean there in the existing demo?
@vincentadam87 I have implemented the mean function approach you suggested (adding the mean function at the end of |
my hunch is that you need to substract the mean function somewhere along the way in the site_update calculation. I would need to do the math properly but it is possibly in the input to the 'gradient_transformation_mean_var_to_expectation' |
That did the trick! Now the tests pass. This approach ends up computing the mean function once more than is necessary, but I don't believe this is the computational bottleneck, and doing it differently would require more code restructuring. |
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.
Looks perfect to me!
This PR addresses two issues:
SpatioTemporalBase
take a mean function as argument, they don't seem to use the function at all.This PR adds support for using separable spatial and temporal mean functions within the current children of
SpatioTemporalBase
.It does this by adding an abstract classSpatioTemporalMeanFunction
and a subclassSeparableMeanFunction
, which is the sum of a spatial mean function (should be a GPflow mean function) and a temporal mean function (should be a markovflow mean function).I'm not certain whether the separability is a requirement or not, but sinceI'm also not convinced I have overloaded all methods ofConditionalPosterior
needs a pure temporal mean function, it seemed much simpler to support these than to support all possible spatiotemporal mean functions.SpatioTemporalBase
necessary for all functionality to correctly use the mean function.@vincentadam87 does this look like a suitable approach? If so I will
add a unit test for the new mean functionadd a notebook demonstrating use of a spatial mean function, which will also be an integration test