HeteroscedasticGaussianProcess<T>

Models & Types · AiDotNet.GaussianProcesses

Implements a Gaussian Process with input-dependent (heteroscedastic) noise levels.

Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → GaussianProcessBase<T> → HeteroscedasticGaussianProcess<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

Standard Gaussian Processes assume the same level of noise everywhere in your data. But real-world data often has varying uncertainty:

  • Sensor readings may be more accurate in certain conditions
  • Financial data has varying volatility
  • Experimental measurements may be more precise in some ranges

The Heteroscedastic GP models this by learning a separate GP for the noise variance, allowing it to capture input-dependent uncertainty.

This uses the “Most Likely Heteroscedastic GP” (MLHGP) approach:

  1. A primary GP models the mean function f(x)
  2. A secondary GP models the log noise variance g(x) = log(σ²(x))
  3. The two GPs are jointly optimized

The noise at any point x is: σ²(x) = exp(g(x)) This exponential ensures the variance is always positive.

How It Works

When to use:

  • Data with varying noise levels
  • Sensor fusion with different accuracy sensors
  • Financial modeling with time-varying volatility
  • Any regression where uncertainty varies with input

Constructors

Constructor Summary
HeteroscedasticGaussianProcess(IKernelFunction<T> meanKernel, IKernelFunction<T> noiseKernel, double noisePriorMean, double noisePriorVariance, int maxIterations, double tolerance, double jitter) Initializes a new heteroscedastic Gaussian Process.

Properties

Property Summary
IKernelFunction<T> MeanKernel { get; } Gets the kernel function used for the mean GP.
IKernelFunction<T> NoiseKernel { get; } Gets the kernel function used for the noise GP.

Methods

Method Summary
ValueTuple<T, T> Predict(Vector<T> x) Predicts the mean and variance for a single input point.
ValueTuple<Vector<T>, Vector<T>, Vector<T>> PredictWithUncertainty(Matrix<T> XNew) Makes predictions with uncertainty estimates.
Vector<T> GetNoiseVariances() Gets the learned noise variances at training points.
Vector<T> GetTotalUncertainty(Matrix<T> XNew) Gets the total predictive uncertainty (epistemic + aleatoric).
void Fit(Matrix<T> X, Vector<T> y) Trains the heteroscedastic GP on the given data.
void UpdateKernel(IKernelFunction<T> kernel) Updates the kernel function used for the mean GP.