class gpr::itergp::IterGP

Overview

One IterGP run against a fixed regularized kernel. More…

#include <gpr/ml/gp/IterGP.h>
 
class IterGP {
public:
    // methods
 
    void run(const Eigen::MatrixXd& K_hat, const Eigen::VectorXd& y, int iterations, Policy policy = Policy::ConjugateGradient);
    int iterations() const;
    const Eigen::MatrixXd& actions() const;
    const Eigen::VectorXd& representerWeights() const;
    Eigen::MatrixXd inverseApproximation() const;
    double posteriorMean(const Eigen::VectorXd& kx) const;
    double combinedVariance(double kxx, const Eigen::VectorXd& kx) const;
    double computationalVariance(const Eigen::LDLT<Eigen::MatrixXd>& exact, const Eigen::VectorXd& kx) const;
    double relativeResidual(const Eigen::MatrixXd& K_hat, const Eigen::VectorXd& y) const;
};

Detailed Documentation

One IterGP run against a fixed regularized kernel.

Everything is expressed through the action matrix S, so the cost of a query is set by the number of iterations rather than by the matrix size, and the uncertainty split falls out of the same factor.

Methods

void run(const Eigen::MatrixXd& K_hat, const Eigen::VectorXd& y, int iterations, Policy policy = Policy::ConjugateGradient)

Take iterations actions against K_hat with right-hand side y. K_hat must be symmetric positive definite (add the noise before calling). Iterations are capped at the matrix size.

const Eigen::MatrixXd& actions() const

The actions taken, n x i.

const Eigen::VectorXd& representerWeights() const

v_i = C_i y, the representer weights the run justifies.

Eigen::MatrixXd inverseApproximation() const

C_i = S (S^T K_hat S)^{-1} S^T, the solver’s approximation to K_hat^{-1}. Dense, for validation; the query paths below never form it.

double posteriorMean(const Eigen::VectorXd& kx) const

Posterior mean at a test point with cross-covariance k(x) = K_xn.

double combinedVariance(double kxx, const Eigen::VectorXd& kx) const

Combined (mathematical + computational) posterior variance, k(x,x) - k(x)^T C_i k(x).

double computationalVariance(const Eigen::LDLT<Eigen::MatrixXd>& exact, const Eigen::VectorXd& kx) const

The computational part alone, k(x)^T (K_hat^{-1} - C_i) k(x). Requires the exact inverse action and so is for diagnostics and tests, not for the hot path; it is non-negative and decreases as iterations are added.

double relativeResidual(const Eigen::MatrixXd& K_hat, const Eigen::VectorXd& y) const

Relative residual ||K_hat v_i - y|| / ||y||, the usual convergence view.