Forecasting Time Series with Gaussian Process Regression
Creating a Multi-Step Forecasting Machine Learning Model
This article presents a machine learning model known as the Gaussian Process Regression (GPR) algorithm. It explains the intuition and how the model is structured, then it creates a multi-step forecasting model in order to predict using the model’s inputs.
Multi-step forecasting is a technique to project multiple values to the future, thus creating a trajectory. It uses previous forecasts as inputs to forecast new values. Naturally, this comes with a great bias, but it remains interesting to see it in action.
Gaussian Process Regression
(GPR) is a powerful, non-parametric Bayesian approach to modeling and predicting data, especially when uncertainty matters. Instead of learning a fixed set of parameters like in linear regression or neural networks, GPR assumes that the data comes from a distribution over functions. This means that, given some data points, it doesn’t just find one best-fit curve—it estimates a whole range of plausible functions that could explain the observations.
As a result, GPR produces not just predictions, but confidence intervals around those predictions, making it incredibly useful for tasks where knowing the uncertainty is as important as the prediction itself.
At its core, GPR works by defining a prior over functions. This prior is specified using a kernel function (also known as a covariance function), which encodes assumptions about how inputs relate to each other—such as smoothness, periodicity, or linearity.
Popular choices for kernels include the squared exponential, Matérn, and rational quadratic kernels. When new data is observed, the prior is updated into a posterior distribution over functions using Bayes’ theorem. This update process incorporates both the data and the kernel to make predictions at unseen points, while simultaneously estimating how certain or uncertain those predictions are.
One of the biggest strengths of GPR is its flexibility. Because it models distributions over functions, it can fit a wide range of data patterns without requiring a fixed model structure or a specific number of parameters. It’s also data-efficient—GPR often performs well with relatively small datasets, making it suitable for problems where data is expensive or hard to collect.
Moreover, the built-in uncertainty estimates make it ideal for applications in scientific modeling, active learning, Bayesian optimization, and risk-sensitive decision-making.
However, GPR has its downsides. Its computational cost grows quickly with the size of the dataset, typically requiring cubic time and quadratic memory relative to the number of data points. This makes it difficult to scale to large datasets without approximations or special tricks.
Additionally, GPR requires careful selection and tuning of the kernel, which can be non-trivial and problem-specific. While GPR shines in low to moderate dimensions, it can struggle in high-dimensional spaces unless the kernel is well-adapted to the data structure.
Keep reading with a 7-day free trial
Subscribe to All About Trading! to keep reading this post and get 7 days of free access to the full post archives.


