rgpycrumbs.surfaces._base¶
Classes¶
Abstract base class for standard (non-gradient) surface models. |
|
Abstract base class for gradient-enhanced surface models. |
Functions¶
|
Solve with covariance-scaled roundoff jitter. |
|
Inverse and weights of a gradient-enhanced covariance matrix. |
|
Calculates the negative Marginal Log-Likelihood (MLL). |
Module Contents¶
- rgpycrumbs.surfaces._base.safe_cholesky_solve(K, y, noise_scalar)[source]¶
Solve with covariance-scaled roundoff jitter.
Added in version 1.0.0.
Changed in version 1.14.0: The jitter is the Cholesky roundoff bound of
K, and thejitter_stepsretries are gone. A factorization with non-finite entries returns zeros and a NaN log-determinant.- Parameters:
K – Covariance matrix.
y – Observation vector.
noise_scalar – Initial noise level.
- Returns:
- (alpha, log_det) where alpha is the solution vector and
log_det is the log determinant of the jittered matrix.
- Return type:
- rgpycrumbs.surfaces._base.equilibrated_inverse_solve(K, y, noise_scalar)[source]¶
Inverse and weights of a gradient-enhanced covariance matrix.
Added in version 1.11.1.
The value and gradient rows of
Kdiffer in scale by1 / l**2, so a short length scale and repeated inputs leaveKtoo ill-conditioned for a float32 inverse. The matrix is solved asK + noise * I + jitter * diag(K)after a symmetric diagonal scaling to unit diagonal, which keeps the jitter relative to each row.jitteriscovariance_roundoff_factorfor the order ofK.Changed in version 1.14.0: The relative jitter is the Cholesky roundoff factor for the order of
K, and thejitterargument is gone.- Parameters:
K – Covariance matrix without noise.
y – Observation vector.
noise_scalar – Noise level added to the diagonal.
- Returns:
(alpha, K_inv) for the regularized matrix.
- Return type:
- rgpycrumbs.surfaces._base.generic_negative_mll(K, y, noise_scalar)[source]¶
Calculates the negative Marginal Log-Likelihood (MLL).
Added in version 1.0.0.
- Parameters:
K – Covariance matrix.
y – Observation vector.
noise_scalar – Noise level for regularization.
- Returns:
The negative MLL value, or a high penalty if Cholesky fails.
- Return type:
- class rgpycrumbs.surfaces._base.BaseSurface(x_obs, y_obs, smoothing=None, length_scale=None, optimize=True, **_kwargs)[source]¶
Abstract base class for standard (non-gradient) surface models.
Added in version 1.0.0.
Changed in version 1.14.0: The default
smoothingis None, which treats the data as exact.Derived classes must implement _fit, _solve, _predict_chunk, and _var_chunk.
- abstractmethod _fit(smoothing, length_scale, optimize)[source]¶
Internal method to perform parameter optimization.
- __call__(x_query, chunk_size=500)[source]¶
Predict values at query points.
- Parameters:
x_query – Query inputs (M, D).
chunk_size – Number of points to process per batch to avoid OOM.
- Returns:
Predicted values (M,).
- Return type:
jnp.ndarray
- class rgpycrumbs.surfaces._base.BaseGradientSurface(x, y, gradients=None, smoothing=None, length_scale=None, optimize=True, noise_per_obs=None, **_kwargs)[source]¶
Abstract base class for gradient-enhanced surface models.
Added in version 1.1.0.
Changed in version 1.14.0: The default
smoothingis None, which treats the data as exact.Derived classes must implement _fit, _solve, _predict_chunk, and _var_chunk. These models incorporate both values and their gradients into the fit.
- abstractmethod _fit(smoothing, length_scale, optimize)[source]¶
Internal method to perform parameter optimization.
- __call__(x_query, chunk_size=500)[source]¶
Predict values at query points.
- Parameters:
x_query – Query inputs (M, D).
chunk_size – Number of points to process per batch.
- Returns:
Predicted values (M,).
- Return type:
jnp.ndarray