Gaussian Process

Shipping
gaussian_process

Non-parametric Bayesian fit that produces a calibrated posterior mean and ±σ confidence band

Signature

Inputs

  • signalSignalrequiredTraining data: timestamps are x, values are y (≥ 2 samples). Per-sample σ² is honoured as heteroscedastic observation noise.
  • querySignalOPTIONAL prediction grid x* (its timestamps are used; values/unit ignored). Unfed ⟹ a dense uniform grid over the training range.

Outputs

  • meanSignalPosterior mean over x*, CARRYING the predictive variance as its per-sample σ² — this is the confidence band the plot renders as ±kσ.
  • stdSignalPosterior standard deviation $\sqrt{\sigma^2(x^*)}$ (y-unit).
  • log_likelihoodScalarLog marginal likelihood (model-fit quality; higher is better). Dimensionless.
  • hyperparamsDataFrameOne-row table of the hyperparameters actually used (length_scale, signal/noise variance, α, period), the log marginal likelihood, and the training-point count.

Parameters

KeyTypeDefaultNotes
kernelenumrbfone of: rbf, matern32, matern52, rational_quadratic, periodic
optimizeenummleone of: mle, manual
length_scalefloat1.0x-unitsℓ — how far in x the function stays correlated. Small = wiggly, large = smooth. Active only when optimize = manual.
signal_variancefloat1.0σf² — the prior amplitude² (vertical scale of the function). Active only when optimize = manual.
noise_variancefloat0.000001σn² — observation-noise variance added to the kernel diagonal. Larger = smoother, trusts data less. Per-sample input σ² is added on top. Active when optimize = manual.
alphafloat1.0Rational-Quadratic shape α: small α mixes many length-scales (heavy-tailed), large α → RBF. Shown for the rational_quadratic kernel; never auto-optimized.
periodfloat1.0x-unitsPeriodic-kernel period p (repeat interval). Shown for the periodic kernel; always user-set (its likelihood is multimodal).
n_predictint300Number of points in the generated prediction grid when no query input is wired.
extrapolationfloat0.0Extend the prediction grid beyond the training range by this fraction of the span on each side (0 = stay within the data).
include_observation_noiseboolfalseOFF = band is the uncertainty of the smooth fitted curve (latent function). ON = the wider predictive interval for a NEW noisy observation (adds σn²).
max_train_pointsint600Cap on training points the GP factorizes (cost is O(n³)); larger inputs are subsampled by uniform stride.
max_iterationsint60Hyperparameter-optimizer iteration budget per restart (active when optimize = mle).

Description

Gaussian Process performs non-parametric Gaussian Process Regression — a Bayesian fit that, unlike a parametric curve fit, returns not just a smooth mean but a calibrated predictive uncertainty band that widens where data is sparse or extrapolated. The training signal's timestamps are , its values , and its per-sample variances (if any) are honoured as heteroscedastic observation noise.

Five kernels shape the prior over functions: RBF (infinitely smooth), Matérn 3/2 and 5/2 (rougher, often more realistic for physical signals), Rational-Quadratic (a mixture of length-scales, tuned by ), and Periodic (repeats with period ). With optimize = mle the node learns the length-scale, signal variance, and noise variance by maximizing the log marginal likelihood; manual uses the values you set.

Prediction happens on an optional query grid, or — when unfed — a dense uniform grid over the training range, optionally extrapolated by a fraction of the span on each side (watch the band widen as the GP leaves the data). Crucially, the mean output carries the posterior variance as its own $\sigma^2$: this is the one node that legitimately produces a fresh uncertainty array, flowing straight into the plot's ±kσ band renderer. Toggle include_observation_noise to switch the band between the smooth latent function ( only) and the predictive interval for a new observation ().

The hyperparams table reports the values actually used (learned, when optimizing) plus the log marginal likelihood and training-point count. A GP costs in the number of training points, so max_train_points caps it by uniform-stride subsampling; the query grid is cheap. The node is stateless.

Mathematics

Examples

Smoothing a noisy sine with a band

Feed a noisy with kernel = rbf, optimize = mle, n_predict = 40. The mean output is the smooth posterior over 40 grid points, carrying a per-point ; std is its square root. Wire mean into a plot to see the fit with a ±σ uncertainty band, and read the learned , , from hyperparams.

Extrapolation widens the band

With extrapolation = 0.5 on training range , the prediction grid spans . The band stays tight inside the data and flares out beyond it — a visual honesty about how little the model knows where it hasn't seen data.

Custom query grid

Wire a query Signal at ; the node predicts at exactly those points (sorted ascending), overriding the generated grid.

Applications

  • Uncertainty-aware smoothing/interpolation of noisy sensor data with an honest confidence band.
  • Bayesian optimization surrogates and active learning where the predictive σ drives acquisition.
  • Modelling periodic or multi-scale signals via the periodic and rational-quadratic kernels.
  • Heteroscedastic fitting where per-sample measurement noise varies across the record.

Neat

The mean output is the rare node that PRODUCES a fresh uncertainty array — its per-sample σ² is the GP posterior variance, entering the DAG as its own independent uncertainty source (the 'produces' σ-class).

Auto-optimization maximizes the log marginal likelihood — a principled, built-in model-selection objective — to learn ℓ, σf², σn² without manual tuning.

include_observation_noise cleanly separates the two questions a GP answers: the uncertainty of the smooth latent function vs the predictive interval of a brand-new noisy observation.

Lineage is intentionally left empty so the executor re-keys the GP's predictive σ as a fresh provenance source downstream — a non-diagonal transform can't propagate input-σ element-wise, and this is the correct handling.

Known issues

Cost is O(n³) in training points; inputs above max_train_points are subsampled by uniform stride, which can miss fine structure.

The α (rational-quadratic) and period (periodic) hyperparameters are never auto-optimized — set them manually.

Extreme extrapolation reverts the mean toward the prior (zero) with a very wide band; the model states its ignorance rather than guessing.

See also

gaussian-processgprbayesianregressionuncertaintykernelnon-parametricstateless