I have a simple dataset with multiple trials of position over time, and I'm trying to fit a Gaussian Process over it. Here's a plot of all the raw data (6180 data points):

All raw data

My goal is to fit a Gaussian Process over this dataset to be able to generate positions given some timestamp. This seems like a simple regression and data generation problem.

I've tried to fit on all my training data and it turns out I have don't have enough memory on my computer to finish training. Therefore, I'm only training on some trials. Here's my actual training data:

Training data

I'm using an RBF kernel with a length scale of 10 and length scale bounds of (1e-3, 1e3).

 RBF(length_scale=10, length_scale_bounds=(1e-3, 1e3))

I think I have a general understanding of what length scale does (determines how quickly correlations fall away; larger length scale means a slower varying function). However, I don't understand if setting it to 10 is proper given this dataset (and if the order of magnitude is even correct), and I'm not very sure how to determine the correct value to set it to.

Fitting a GP and making predictions yields the following mean function and 95% confidence interval.

Plotting mean function

In my opinion, this isn't representative of the true mean function or covariance function as the variations in the data between timestamps 1000 to 3000 isn't represented.

Main questions: How can I fix my kernel to better capture the variability in my data? In addition, does it make sense to downsample the data to reduce training time and allow for outliers to have a larger effect on the mean and covariance functions? Lastly, is it possible to fit a GP on some of the data, set the newly trained GP as a prior, refit a GP on another set of data, and iterate until I've gone through all my training data? If so, I couldn't find how to do this in scikit-learn and would happily take advice.

As a sanity check, I made predictions beyond the data set (before 0 timestamp and after 5000 timestamp) just to see if the confidence interval at those intervals widens. It does as expected.

By the way, if my technical vocabulary is incorrect, please correct me! Thank you!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.