gpridge.surrogate

Layered-chain configuration for the GP surrogate.

Surrogate is an immutable fluent builder describing which arm of the layered chain (MAP / +PSIS-Laplace / +INLA-Delta / +RFF) the underlying GP uses. Compose it with .delta(), .rff(D), .psis() and .with_hyperparameter_mode('inla'). Pass the result to GaussianProcess as surrogate=.

Example:

Surrogate.map()
Surrogate.map().hssvd()
Surrogate.laplace_slice()
Surrogate.laplace_slice().delta()
Surrogate.laplace_slice().delta().rff(512)

Classes

Surrogate

Immutable, hashable layered-chain config.

Module Contents

class gpridge.surrogate.Surrogate

Immutable, hashable layered-chain config.

Build one with map() or laplace_slice() and refine it with the chain modifiers, each of which returns a new object. The fields below are the stored settings.

uncertainty_mode: str = 'map'

Posterior arm, one of "map", "bma", "laplace", "laplace-slice", "eb" or "svgd". The factories set it.

use_psis_laplace: bool = False

Apply Pareto-smoothed importance sampling to the Laplace slice.

use_psis_deterministic: bool = True

Use the deterministic grid for the PSIS draw.

use_delta_method: bool = False

Add the alpha-K Hessian Laplace variance correction.

delta_uh_min_diag: float = 1e-06

Conditioning gate of the delta correction. The correction is switched off when min(diag(U_H)) falls below this value. Zero or negative disables the gate. The default matches the C++ side.

delta_max_ratio: float = 100.0

Cap of the per-query delta variance as a multiple of the signal variance. Zero or negative disables the cap. The default matches the C++ side.

rff_features: int = 0

Number of random Fourier features. 0 keeps the exact kernel and -1 selects the count against held-out data ("auto").

rff_force_tol_fraction: float = 0.0

Share of the force tolerance that the automatic selection may spend. 0 derives the share from the gradient noise. Used only when rff_features is -1.

hyperparameter_mode: str = 'scg'

Hyperparameter optimiser, "scg" (scaled conjugate gradient) or "inla".

use_hssvd_backend: bool = False

Use the HS-SVD stable-basis solver path.

disable_output_normalization: bool = False

Skip the output normalisation of the training energies.

classmethod map() → Surrogate

Maximum a posteriori fit, the default surrogate.

classmethod laplace_slice(*, deterministic: bool = True) → Surrogate

Laplace-slice posterior with PSIS smoothing enabled.

deterministic selects the deterministic PSIS grid.

delta(*, uh_min_diag: float | None = None, max_ratio: float | None = None) → Surrogate

Enable the alpha-K Hessian Laplace variance correction.

uh_min_diag and max_ratio set the conditioning gate and per-query magnitude cap on the correction; defaults match the C++ defaults (1e-6, 100.0). Pass <= 0 to disable each guard. The defaults are usually sufficient; tighten them (e.g. uh_min_diag=1e-4) on small-N NEB chains where the Hessian is very poorly conditioned.

psis(*, deterministic: bool = True) → Surrogate

Enable PSIS on the Laplace slice; needs a laplace_slice base.

Raises ValueError on any other base.

rff(n_features: int | str, force_tol_fraction: float = 0.0) → Surrogate

Fix the feature count, or pass "auto" to select it.

"auto" (stored as -1) doubles the count until the held-out random-feature posterior matches the exact GP. A positive count still requires a Laplace-slice surrogate. force_tol_fraction is the share of the 0.0514221 eV/Å force tolerance the automatic rule may spend; 0 derives that share from the gradient noise.

Raises ValueError for a negative count, a string other than "auto", a positive count on a base other than laplace_slice, or a fraction outside [0, 1).

with_hyperparameter_mode(mode: str) → Surrogate

Select the hyperparameter optimiser, "scg" or "inla".

Raises ValueError for any other name.

hssvd(*, no_output_norm: bool = True) → Surrogate

Enable the HS-SVD stable-basis solver path.

property label: str

Short name of the chain, such as "lapslice+psis+delta".