How this calculation works
Condition a zero-mean Gaussian process on observed numeric inputs and responses using a squared-exponential kernel. The page returns posterior means, latent variances and noisy prediction variances, with explicit signal, length and noise settings. It is designed to show the uncertainty calculation itself rather than conceal a hyperparameter optimization workflow.
m*=k*ᵀ(K+sigma²I)⁻¹y; v*=k**−k*ᵀ(K+sigma²I)⁻¹k*.A worked example
At training inputs zero and one with responses zero and one, unit signal, length and noise SD, let c=exp(−1/2). At query zero the posterior mean is c/(4−c²), approximately 0.166991. Positive observation noise means the posterior does not interpolate the response exactly.
Good to know
Zero prior mean, squared-exponential kernel, positive fixed signal/noise SD and length. ≤100 observed/query rows and ≤4 dimensions. Distinguishes latent from noisy prediction; no tuning or non-Gaussian likelihood.
Describe a distribution over functions
A Gaussian process assigns a joint Gaussian distribution to function values at any finite set of inputs. The kernel supplies covariances between those values. Here the prior mean is zero and the squared-exponential kernel is signal variance times exp of minus squared input distance divided by twice the length scale squared.
Nearby inputs are therefore more strongly correlated under the chosen length scale. Inputs with several columns use Euclidean distance in those coordinates, so units and scaling matter. A column measured in thousands can dominate one measured in fractions unless you rescale deliberately before entering the design.
The Bayesian linear regression posterior calculator updates a finite coefficient vector with a Gaussian prior. A Gaussian process places its covariance directly on function values, and the kernel length scale changes how nearby inputs share information.
Keep three scale inputs distinct
The signal input is a standard deviation controlling prior function magnitude. The noise input is a standard deviation for independent Gaussian observation errors. Both are squared inside the covariance calculation. Length scale instead has input-coordinate units and determines how quickly covariance declines with distance.
A larger noise standard deviation makes individual observations less constraining. A larger signal standard deviation does not simply multiply the posterior by a fixed factor because it also changes the balance against noise. The calculator requires positive noise and checks covariance conditioning rather than adding an undocumented jitter amount to force a problematic solve.
Derive the conditional mean and variance
Let K be the training kernel matrix and let Ky=K+noise variance times identity. For a query, kstar contains covariances to the training inputs. The posterior mean is kstar transpose Ky inverse y, and latent variance is prior query variance minus kstar transpose Ky inverse kstar.
The subtraction measures uncertainty reduced by observations. A materially negative result is a numerical failure, not a valid negative variance. Tiny negative rounding is clipped only within the stated tolerance. The output also adds observation-noise variance to obtain the variance for a new noisy measurement, a different target from the latent function value.
Check the two-observation example
Training inputs zero and one have responses zero and one. With unit signal, length and noise standard deviations, let c=exp of minus one half. The training-plus-noise covariance is the two-by-two matrix with diagonal two and off-diagonal c. Query zero has covariance vector (1,c).
Direct inversion gives posterior mean c divided by four minus c squared, approximately 0.166991. It does not equal the observed response zero because the model allows measurement noise. Reducing noise can strengthen interpolation, but taking it extremely small with duplicate or nearly duplicate inputs can make the numerical covariance ill-conditioned.
Read uncertainty bands for the correct object
A Gaussian interval for the latent function would use the square root of latent variance. An interval for another noisy observation would use the larger predictive variance. Choosing one while labeling it as the other can materially understate uncertainty. The table gives both variances so that the distinction remains visible.
These intervals condition on fixed hyperparameters and the zero-mean Gaussian model. They do not integrate over uncertainty in length scale, noise or kernel family. A narrow posterior far from useful evidence can still be driven by a strong prior assumption, so inspect location relative to observed inputs rather than treating every small variance as empirical certainty.
Understand the marginal likelihood without automatic tuning
The log marginal likelihood combines a data-fit quadratic, a covariance log determinant and a Gaussian normalization term. It can compare hyperparameter settings for the same observations and model convention. Changing response units or the observation set changes its interpretation and prevents a naive comparison of raw values.
This page computes the value at your settings and does not maximize it. Trying many settings until the plot is attractive is not a principled calibration procedure. If tuning is needed, use a documented training workflow and evaluate later or held-out data, taking account of dependence and grouped observations when relevant.
Know the limits of the smooth-kernel assumption
The squared-exponential kernel favors very smooth functions. Abrupt discontinuities, heavy-tailed errors, changing noise levels and qualitative inputs may require another model. No categorical encoding, heteroscedastic likelihood or periodic kernel is automatically selected from the data. All query rows must have the same numeric dimension as the observed inputs.
The small matrix limit keeps the computation transparent but does not turn a GP into a causal explanation. Extrapolation returns toward the specified zero prior mean as kernel correlations disappear. If zero is an implausible baseline, center the response deliberately and record the shift rather than interpreting that prior-driven behavior as a discovered trend.
A few questions, answered
Why does a training query not reproduce its observation?
Positive observation noise permits the latent function to differ from noisy measured responses. Interpolation is not generally expected.
Are signal and noise entries variances?
No. They are standard deviations and are squared in the covariance calculation.
Which variance should describe a future measurement?
The noisy predictive variance. Latent variance describes the underlying function value before adding a new observation error.
Does the page optimize the length scale?
No. It evaluates the posterior and marginal likelihood at the explicitly entered hyperparameters.