Loading...
Searching...
No Matches
DerivativeVecchia.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3//
4// Derivative-aware Vecchia approximation for a gradient-enhanced GP.
5// TERA: Scalable Derivative Gaussian Processes via Exact Gradient Reduction,
6// DOI 10.48550/arxiv.2606.02909.
7//
8// The global kernel of a gradient-enhanced GP is n(d+1) square and, on a flat
9// spectrum, badly conditioned. Vecchia factors the joint density into ordered
10// conditionals and keeps only a few predecessors in each,
11//
12// p(y) ~ prod_i p(y_i | y_{N(i)}), |N(i)| <= m,
13//
14// so one global solve becomes n local solves of size (|N(i)| + 1)(d + 1).
15// Each local block inherits only the conditioning of its own neighbourhood,
16// which is what makes the approximation attractive where the global matrix is
17// the problem rather than its size.
18//
19// Every point here carries a value AND its d gradient components, and they are
20// kept together: splitting a point's derivative rows across different
21// conditioning sets would condition a gradient on its own value through a
22// different path than the value takes, which is not a valid factorization of
23// the joint density.
24//
25// Exactness at full conditioning is the property to hold onto: with
26// N(i) = {0..i-1} the factorization is the joint density itself, so the
27// approximate log-determinant and quadratic form must equal the exact ones.
28// That is what the tests pin, and it is what tells an approximation error from
29// a bug.
30
31#ifndef GPR_ML_GP_DERIVATIVE_VECCHIA_H_
32#define GPR_ML_GP_DERIVATIVE_VECCHIA_H_
33
34#include <Eigen/Core>
35#include <cstddef>
36#include <vector>
37
38namespace gpr {
39namespace vecchia {
40
43 double log_determinant = 0.0;
44 double quadratic_form = 0.0;
45 std::size_t largest_local_solve = 0;
46 std::size_t total_local_rows = 0;
47 bool valid = false;
48};
49
52[[nodiscard]] std::vector<std::vector<int>> nearestPredecessors(
53 const Eigen::MatrixXd& points, int max_neighbours);
54
63[[nodiscard]] VecchiaResult evaluate(const Eigen::MatrixXd& points,
64 const Eigen::VectorXd& y,
65 double lengthscale, double noise,
66 int max_neighbours);
67
70[[nodiscard]] VecchiaResult evaluateExact(const Eigen::MatrixXd& points,
71 const Eigen::VectorXd& y,
72 double lengthscale, double noise);
73
75[[nodiscard]] Eigen::MatrixXd jointBlock(const Eigen::VectorXd& a,
76 const Eigen::VectorXd& b,
77 double lengthscale);
78
79} // namespace vecchia
80} // namespace gpr
81
82#endif // GPR_ML_GP_DERIVATIVE_VECCHIA_H_
@ y
Definition Enums.h:28
Eigen::MatrixXd jointBlock(const Eigen::VectorXd &a, const Eigen::VectorXd &b, double lengthscale)
The joint value/gradient kernel block between two points, (1+d) x (1+d).
VecchiaResult evaluate(const Eigen::MatrixXd &points, const Eigen::VectorXd &y, double lengthscale, double noise, int max_neighbours)
std::vector< std::vector< int > > nearestPredecessors(const Eigen::MatrixXd &points, int max_neighbours)
VecchiaResult evaluateExact(const Eigen::MatrixXd &points, const Eigen::VectorXd &y, double lengthscale, double noise)
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
What the approximation produced, and what it cost.
double log_determinant
sum of local conditional log-dets
std::size_t total_local_rows
summed local work
bool valid
false when a local block was not factorizable
std::size_t largest_local_solve
rows in the biggest local system
double quadratic_form
y^T K^{-1} y, summed over conditionals