Summarize numerical conditioning of a fitted GP
Source:R/gp-diagnostics.R
gp_numerical_diagnostics.RdReports numerical quantities separately from statistical fit diagnostics. In particular, observation-noise variance and numerical jitter remain distinct.
Usage
gp_numerical_diagnostics(
model,
condition_tolerance = sqrt(.Machine$double.eps)
)Value
A named list of numerical diagnostics, including:
observation_noise_varianceThe statistical noise variance.
numerical_jitterThe diagonal jitter \(\delta\) that the factorization of the training covariance \(C\) needed.
covariance_scaleThe mean of the diagonal of \(C\).
relative_jitternumerical_jitter / covariance_scale.cholesky_attemptsFactorization attempts, 1 if no jitter was needed.
reciprocal_condition_number,condition_numberThe 1-norm condition estimate of \(C + \delta I\) and its reciprocal.
potentially_ill_conditionedWhether the reciprocal condition number is below
condition_tolerance.observation_typesA data frame with one row per observation type (
"value", or"derivative x1", ... for derivative observations): the number of observations, the mean diagonal of their block of \(C\), and the reciprocal condition number of that block with the jitter. Derivative blocks scale with \(1 / \ell^2\), so their conditioning can differ from that of the values.
Stability
Experimental: this interface may change in a minor release, and every change is listed in NEWS. See gaussianprocesses-package for the policy.
Examples
# Duplicated inputs without observation noise need numerical jitter, which is
# reported separately from the (zero) noise variance.
model <- fit_gp(c(0, 0, 1), c(1, 1, 0), kernel = rbf_kernel(), noise_variance = 0)
diagnostics <- gp_numerical_diagnostics(model)
diagnostics[c(
"observation_noise_variance",
"numerical_jitter",
"relative_jitter",
"cholesky_attempts"
)]
#> $observation_noise_variance
#> [1] 0
#>
#> $numerical_jitter
#> [1] 1e-10
#>
#> $relative_jitter
#> [1] 1e-10
#>
#> $cholesky_attempts
#> [1] 2
#>