LinearMean<T>

Models & Types · AiDotNet.GaussianProcesses

Implements a linear mean function.

Implements: IMeanFunction<T>

For Beginners

The linear mean function returns a linear combination of input features.

m(x) = w^T × x + b = w_1×x_1 + w_2×x_2 + … + w_d×x_d + b

Where:

  • w is the weight vector (one weight per input dimension)
  • b is the bias (intercept)
  • x is the input point

Why use linear mean?

  • When you expect a linear trend in your data
  • Combines well with kernels that capture nonlinear deviations
  • Can be initialized from linear regression on your data

Example use cases:

  • Time series with a linear trend
  • Data where features have known linear effects
  • When you want to separate trend from residuals

The GP will model deviations from this linear trend using the kernel.

Constructors

Constructor Summary
LinearMean(Vector<T> weights, T bias) Initializes a linear mean function with double arrays.
LinearMean(double[] weights, double bias) Initializes a linear mean function with double arrays.
LinearMean(int numDimensions) Initializes a zero-weight linear mean for the given number of dimensions.

Properties

Property Summary
T Bias { get; } Gets the bias term.
Vector<T> Weights { get; } Gets the weight vector.
int NumDimensions { get; } Gets the number of dimensions.

Methods

Method Summary
LinearMean<T> FromData(Matrix<T> X, Vector<T> y) Creates a linear mean function by fitting linear regression to training data.
T Evaluate(Vector<T> x) Computes the linear mean values at multiple input points.
Vector<T> Evaluate(Matrix<T> X) Computes the linear mean values at multiple input points.