gp_posterior_mean

std.nn.gp_posterior_mean · Level L3

The posterior mean of a Gaussian process with a squared-exponential kernel of length scale ℓ and noise variance σ², at new points Xs. The training system is solved by Cholesky (calls cholesky_solve).

K(Xs, X)·(K(X, X) + σ²I)⁻¹·y, K(a, b) = exp(−‖a − b‖²/(2ℓ²))

Signature

gp_posterior_mean(X: f64[n, d], y: f64[n], Xs: f64[m, d], ell: f64[], noise: f64[]) → f64[m]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

yf64[n]noisef64[]Xf64[n, d]ellf64[]Xsf64[m, d]MultiplyD2_ppMultiplyD2_qqTransposeD2_qtMultiplyD2s_ppMultiplyD2s_qqMultiplyll2.0TransposeD2s_qtReduceSumD2_pnReduceSumD2_qsMatMulD2_pq2.0ReduceSumD2s_pnReduceSumD2s_qsMultiplydenMatMulD2s_pq2.0ReshapeD2_qnMultiplyD2_2pqReshapeD2s_qnMultiplyD2s_2pqAddD2_sAddD2s_sSubtractD2SubtractD2sDivideaDivideas_NegatenaNegatenasExpKfExpKsIotaeye_rIotaeye_cTransposeKstEqualeyeMultiplyjitterAddKcholesky_solvealphaReshapeacMatMulmcReshapemeanmeanf64[m]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference K(Xs,X) @ np.linalg.solve(K(X,X) + noise*I, y) to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 163 float64 results inside the running error bound; the closest uses 18% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
25%
bit-equal to the NumPy formula in float64
37%
largest error, in units in the last place
1.9e+3

Large ulp counts appear where a result is zero or tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound.

Identity

Calls
Called by
—
sha256:b5da9aa06108d722be7802c5667c71c8ad9440d88486511912f9a1e221dfba63

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.