gpflow.models.cglb#

Classes#

gpflow.models.cglb.NystromPreconditioner#

class gpflow.models.cglb.NystromPreconditioner(A, LB, sigma_sq)[source]#

Bases: object

Preconditioner of the form \(Q=(Q_ff + σ²I)⁻¹\), where L is lower triangular with :math: LLᵀ = Kᵤᵤ \(A = σ⁻²L⁻¹Kᵤₓ\) and \(B = AAᵀ + I = LᵦLᵦᵀ\)

Parameters:
  • A (Tensor) –

  • LB (Tensor) –

  • sigma_sq (float) –

Functions#

gpflow.models.cglb.cglb_conjugate_gradient#

gpflow.models.cglb.cglb_conjugate_gradient(K, b, initial, preconditioner, cg_tolerance, max_steps, restart_cg_step)[source]#

Conjugate gradient algorithm used in CGLB model. The method of conjugate gradient (Hestenes and Stiefel, 1952) produces a sequence of vectors \(v_0, v_1, v_2, ..., v_N\) such that \(v_0\) = initial, and (in exact arithmetic) \(Kv_n = b\). In practice, the v_i often converge quickly to approximate \(K^{-1}b\), and the algorithm can be stopped without running N iterations.

We assume the preconditioner, \(Q\), satisfies \(Q ≺ K\), and stop the algorithm when \(r_i = b - Kv_i\) satisfies \(||rᵢᵀ||_{Q⁻¹r}^2 = rᵢᵀQ⁻¹rᵢ <= ϵ\).

Parameters:
  • K (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) –

    • K has shape [N, N].

    Matrix we want to backsolve from. Must be PSD.

  • b (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) –

    • b has shape [B, N].

    Vector we want to backsolve.

  • initial (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) –

    • initial has shape [P, N].

    Initial vector solution.

  • preconditioner (NystromPreconditioner) – Preconditioner function.

  • cg_tolerance (float) – Expected maximum error. This value is used as a decision boundary against stopping criteria.

  • max_steps (int) – Maximum number of CG iterations.

  • restart_cg_step (int) – Restart step at which the CG resets the internal state to the initial position using the currect solution vector \(v\). Can help avoid build up of numerical errors.

Return type:

Tensor

Returns:

  • return has shape [P, N].

v where v approximately satisfies \(Kv = b\).