Loading...
Searching...
No Matches
gpr::LaplaceINLA Class Reference

Laplace / INLA uncertainty quantifier over GP/TP hyperparameters. More...

#include <gpr/ml/LaplaceINLA.h>

Public Types

enum class  Likelihood { GAUSSIAN_CLOSED_FORM , T_CLOSED_FORM , NON_GAUSSIAN }
using KernelBuilder
using LogPrior = std::function<double(const Eigen::VectorXd& theta)>

Public Member Functions

void setTheta0 (const Eigen::VectorXd &theta_star)
 MAP hyperparameters (log space if using the project's conventions).
void setHessian (const Eigen::MatrixXd &H)
void setHessian (const Eigen::MatrixXd &H, const Eigen::MatrixXd &parameter_directions)
void setLikelihood (Likelihood lik)
Likelihood likelihood () const
void setTPHyperprior (double a, double b)
 TP hyperprior (only used when lik_ == T_CLOSED_FORM).
void setObservationLikelihood (std::shared_ptr< ObservationLikelihood > ol)
void buildGrid (double f0=-1.0, bool include_corners=true)
 Build the CCD grid in theta-space from (theta*, H).
void fit (const Eigen::VectorXd &y, KernelBuilder kernel_builder, LogPrior log_prior)
 Evaluate the per-grid-point correction rho_k = exp(-Delta phi_k) and build the final normalised weights.
INLAPrediction predict (const Eigen::VectorXd &y, KernelBuilder kernel_builder) const
 Predictive moments at the test points embedded in the kernel builder's K_test_X / k_test_test outputs.
INLAPrediction predict (const Eigen::VectorXd &y, KernelBuilder kb, linalg::BackendContext &workspace) const
const std::vector< Eigen::VectorXd > & gridPoints () const noexcept
 Grid accessors (for testing).
const Eigen::VectorXd & gridWeights () const noexcept
const Eigen::VectorXd & finalWeights () const noexcept
int p () const noexcept
int nGridPoints () const noexcept
const Eigen::VectorXd & theta0 () const noexcept
 MAP hyperparameter point set by setTheta0. Used by SVGD initFromCCD.
const Eigen::MatrixXd & lScale () const noexcept
Eigen::MatrixXd hessianInverse () const
Eigen::MatrixXd precisionMatrix () const

Detailed Description

Laplace / INLA uncertainty quantifier over GP/TP hyperparameters.

Usage: LaplaceINLA inla; inla.setTheta0(theta_star); // MAP from SCG inla.setHessian(H); // p x p, from assembleExactHessian inla.buildGrid(); // 1 + 2p + 2^p CCD points inla.fit(y, kernel_builder, log_prior); INLAPrediction p = inla.predict(y, kernel_builder);

The KernelBuilder callback signature takes the RAW hyperparameter vector theta directly (caller owns the log-base convention). This differs from BayesianModelAveraging::KernelBuilder, which takes (lengthscale, noise) in linear space; callers who want to share a kernel closure across LaplaceINLA and BMA should write two adapters rather than rely on implicit coercion inside either class.

LOAD-BEARING CONTRACT: the LAST element of theta is always log-noise (natural log). LaplaceINLA extracts it internally for FactorizedLikelihood::evaluateGP / evaluateTP.

Definition at line 73 of file LaplaceINLA.h.

Member Typedef Documentation

◆ KernelBuilder

Initial value:
std::function<std::tuple<EigenMatrix, EigenMatrix, Eigen::VectorXd>(
const Eigen::VectorXd& theta)>

Builds kernel matrices from the RAW hyperparameter vector theta. CONVENTION: the last element of theta is always log-noise (natural log). Callers own the log-base for the other components. Returns (K_XX, K_test_X, k_test_test_diag).

Definition at line 87 of file LaplaceINLA.h.

◆ LogPrior

using gpr::LaplaceINLA::LogPrior = std::function<double(const Eigen::VectorXd& theta)>

Log prior over hyperparameters. Called at every grid point. Return 0.0 for a flat improper prior; any log density otherwise.

Definition at line 93 of file LaplaceINLA.h.

Member Enumeration Documentation

◆ Likelihood

enum class gpr::LaplaceINLA::Likelihood
strong

Closed-form NLML path used per-grid-point. Inner-Laplace (NON_GAUSSIAN) is opt-in scaffolding covered by a separate bead.

Enumerator
GAUSSIAN_CLOSED_FORM 

FactorizedLikelihood::evaluateGP.

T_CLOSED_FORM 

FactorizedLikelihood::evaluateTP (MVT marginal).

NON_GAUSSIAN 

Inner Laplace via ObservationLikelihood (future).

Definition at line 77 of file LaplaceINLA.h.

77 {
78 GAUSSIAN_CLOSED_FORM,
79 T_CLOSED_FORM,
80 NON_GAUSSIAN
81 };

Member Function Documentation

◆ buildGrid()

void gpr::LaplaceINLA::buildGrid ( double f0 = -1.0,
bool include_corners = true )

Build the CCD grid in theta-space from (theta*, H).

Places 1 center, 2p axial, and 2^p factorial-corner points at z = 0, +/- f0 * e_i, and (+/- f0/sqrt(p), ..., +/- f0/sqrt(p)) in standardised z-space, then maps back to theta-space via theta_k = theta* + U Lambda^{-1/2} z_k.

Grid-rule weights w_k^grid are chosen so the rule integrates z (to zero) and z z^T (to identity) exactly against N(0, I). These match Rue et al. 2009 eq. 6.5 and the moments validated by test_ccd_grid_moments_p2 in python/tests/test_sympy_laplace.py.

Parameters
f0Radius in standardised space. Pass a negative value (default) to use Rue's default sqrt(p + 2).
include_cornersInclude the 2^p factorial corner points (default true). When false, only the 1 + 2p axial subset is built; the corner Cholesky factorisations that dominate per-call BMA / LAPLACE-CCD wall are skipped. Both rules preserve the Gaussian first and second moments; the corner points change higher mixed moments. At p = 4 the axial rule uses K = 9 points instead of K = 25, with weights normalized for those nine points.

Definition at line 165 of file LaplaceINLA.cpp.

166{
167 if (theta_star_.size() == 0) {
168 throw std::runtime_error("LaplaceINLA::buildGrid: setTheta0 first");
169 }
170 if (H_.size() == 0) {
171 throw std::runtime_error("LaplaceINLA::buildGrid: setHessian first");
172 }
173 const int p = static_cast<int>(L_scale_.cols());
174 if (f0 <= 0.0) f0 = ruesDefaultF0(p);
175 f0_ = f0;
176
177 z_k_.clear();
178 theta_k_.clear();
179
180 // 1 center.
181 z_k_.emplace_back(Eigen::VectorXd::Zero(p));
182
183 // 2p axial: +/- f0 e_i.
184 for (int i = 0; i < p; ++i) {
185 Eigen::VectorXd z_plus = Eigen::VectorXd::Zero(p);
186 Eigen::VectorXd z_minus = Eigen::VectorXd::Zero(p);
187 z_plus(i) = f0;
188 z_minus(i) = -f0;
189 z_k_.emplace_back(std::move(z_plus));
190 z_k_.emplace_back(std::move(z_minus));
191 }
192
193 // 2^p factorial corners at radius f0 in L2 (each axis at +/- f0/sqrt(p)).
194 // Skip when p == 1 because corner and axial points coincide (both at
195 // z = +/- f0) -- adding them would inflate the grid with duplicates.
196 // Skipped when include_corners == false to bound the per-call BMA /
197 // LAPLACE-CCD wall to the K = 1 + 2p axial subset.
198 // Both rules preserve the Gaussian mean and covariance; the corner
199 // points change the higher mixed moments of the quadrature.
200 if (include_corners && p >= 2) {
201 const int n_corner = 1 << p;
202 const double corner_axis = f0 / std::sqrt(static_cast<double>(p));
203 for (int bits = 0; bits < n_corner; ++bits) {
204 Eigen::VectorXd z(p);
205 for (int i = 0; i < p; ++i) {
206 const int sign = ((bits >> i) & 1) ? +1 : -1;
207 z(i) = sign * corner_axis;
208 }
209 z_k_.emplace_back(std::move(z));
210 }
211 }
212
213 // Map every z to theta = theta* + U Lambda^{-1/2} z.
214 theta_k_.reserve(z_k_.size());
215 for (const auto& z: z_k_) {
216 theta_k_.emplace_back(theta_star_ + L_scale_ * z);
217 }
218
219 // Grid quadrature weights: Delta on every non-center, w_0 on center.
220 const int n = static_cast<int>(z_k_.size());
221 const int n_corners = n - 1 - 2 * p;
222 const double delta = ruesDelta(p, f0, n_corners);
223 w_grid_ = Eigen::VectorXd::Constant(n, delta);
224 w_grid_(0) = 1.0 - static_cast<double>(n - 1) * delta;
225
226 fitted_ = false;
227}
@ z
Definition Enums.h:28
int p() const noexcept

◆ finalWeights()

const Eigen::VectorXd & gpr::LaplaceINLA::finalWeights ( ) const
inlinenodiscardnoexcept

Definition at line 204 of file LaplaceINLA.h.

205 {
206 return w_final_;
207 }

◆ fit()

void gpr::LaplaceINLA::fit ( const Eigen::VectorXd & y,
KernelBuilder kernel_builder,
LogPrior log_prior )

Evaluate the per-grid-point correction rho_k = exp(-Delta phi_k) and build the final normalised weights.

Needs the kernel builder so it can evaluate the true log p(y|theta_k)

  • log p(theta_k) at each grid point. The Rue correction ratio is

    rho_k = [ p(y|theta_k) * p(theta_k) * pi_G(theta*) ] / [ p(y|theta*) * p(theta*) * pi_G(theta_k) ]

where pi_G is the Laplace Gaussian surrogate N(theta*, H^-1). In the linear-Gaussian limit phi is exactly quadratic and rho_k = 1 everywhere (see test_rho_k_is_one_on_quadratic_phi).

Parameters
yTraining targets.
kernel_builderSame callback as BMA uses.
log_priorLog prior over hyperparameters (pass a zero-returning lambda for a flat improper prior).

Definition at line 277 of file LaplaceINLA.cpp.

279{
280 if (theta_k_.empty()) {
281 throw std::runtime_error("LaplaceINLA::fit: buildGrid first");
282 }
283 const int n = static_cast<int>(theta_k_.size());
284 const double phi_star =
285 evaluateNLMLAtTheta(y, kb, theta_star_) - log_prior(theta_star_);
286
287 // Compute delta_phi_k in parallel: each grid point is an independent
288 // NLML evaluation + log-prior call (same cost model as BMA's fit loop).
289 std::vector<double> delta_phi(n);
290#ifdef USE_OPENMP
291#pragma omp parallel for schedule(dynamic)
292#endif
293 for (int k = 0; k < n; ++k) {
294 const Eigen::VectorXd& theta_k = theta_k_[k];
295 const Eigen::VectorXd d = theta_k - theta_star_;
296 const double quad = 0.5 * d.dot(precisionMatrix() * d);
297 const double phi_k =
298 evaluateNLMLAtTheta(y, kb, theta_k) - log_prior(theta_k);
299 delta_phi[k] = phi_k - phi_star - quad;
300 }
301
302 // rho_k := exp(-delta_phi_k). Subtract the minimum for numerical
303 // stability before the exp (same log-sum-exp trick BMA uses).
304 const double dmin = *std::min_element(delta_phi.begin(), delta_phi.end());
305 Eigen::VectorXd rho(n);
306 for (int k = 0; k < n; ++k) {
307 rho(k) = std::exp(-(delta_phi[k] - dmin));
308 }
309
310 // Final posterior weights: w_k = w_k^grid * rho_k / Z.
311 w_final_.resize(n);
312 double Z = 0.0;
313 for (int k = 0; k < n; ++k) {
314 w_final_(k) = w_grid_(k) * rho(k);
315 Z += w_final_(k);
316 }
317 if (!(Z > 0.0)) {
318 throw std::runtime_error(
319 "LaplaceINLA::fit: all grid weights collapsed to 0");
320 }
321 w_final_ /= Z;
322 fitted_ = true;
323}
@ y
Definition Enums.h:28
Eigen::MatrixXd precisionMatrix() const

◆ gridPoints()

const std::vector< Eigen::VectorXd > & gpr::LaplaceINLA::gridPoints ( ) const
inlinenodiscardnoexcept

Grid accessors (for testing).

Definition at line 195 of file LaplaceINLA.h.

197 {
198 return theta_k_;
199 }

◆ gridWeights()

const Eigen::VectorXd & gpr::LaplaceINLA::gridWeights ( ) const
inlinenodiscardnoexcept

Definition at line 200 of file LaplaceINLA.h.

201 {
202 return w_grid_;
203 }

◆ hessianInverse()

Eigen::MatrixXd gpr::LaplaceINLA::hessianInverse ( ) const
inlinenodiscard

Ambient covariance of the posterior at theta*. Tied directions have zero variance normal to their parameter subspace. Assembled as L_scale * L_scale^T from the cached eigendecomposition; cheaper than calling inverse() and numerically stable because setHessian() stores a strictly positive spectrum. Returns an empty matrix if setHessian was never called.

Definition at line 237 of file LaplaceINLA.h.

238 {
239 if (L_scale_.size() == 0) return Eigen::MatrixXd{};
240 return L_scale_ * L_scale_.transpose();
241 }

◆ likelihood()

Likelihood gpr::LaplaceINLA::likelihood ( ) const
inline

Definition at line 113 of file LaplaceINLA.h.

114 {
115 return lik_;
116 }

◆ lScale()

const Eigen::MatrixXd & gpr::LaplaceINLA::lScale ( ) const
inlinenodiscardnoexcept

Posterior-covariance square root L_scale = U * Lambda^{-1/2} in z-space. The posterior covariance is H^{-1} = L_scale * L_scale^T. Used by the 2nd-order TCOV correction in GaussianProcessRegression::calculatePotentialLaplace.

Definition at line 226 of file LaplaceINLA.h.

227 {
228 return L_scale_;
229 }

◆ nGridPoints()

int gpr::LaplaceINLA::nGridPoints ( ) const
inlinenodiscardnoexcept

Definition at line 212 of file LaplaceINLA.h.

213 {
214 return static_cast<int>(theta_k_.size());
215 }

◆ p()

int gpr::LaplaceINLA::p ( ) const
inlinenodiscardnoexcept

Definition at line 208 of file LaplaceINLA.h.

209 {
210 return static_cast<int>(theta_star_.size());
211 }

◆ precisionMatrix()

Eigen::MatrixXd gpr::LaplaceINLA::precisionMatrix ( ) const
inlinenodiscard

Effective observed-information precision used to map the CCD grid. This includes any precision-form regularization applied by setHessian().

Definition at line 245 of file LaplaceINLA.h.

246 {
247 if (U_.size() == 0 || lambda_.size() == 0) return Eigen::MatrixXd{};
248 return U_ * lambda_.asDiagonal() * U_.transpose();
249 }

◆ predict() [1/2]

INLAPrediction gpr::LaplaceINLA::predict ( const Eigen::VectorXd & y,
KernelBuilder kb,
linalg::BackendContext & workspace ) const

Definition at line 332 of file LaplaceINLA.cpp.

334{
335 if (!fitted_) {
336 throw std::runtime_error("LaplaceINLA::predict: fit first");
337 }
338
339 INLAPrediction out;
340 out.n_grid_points = static_cast<int>(theta_k_.size());
341 bool first = true;
342 Eigen::VectorXd weighted_mean;
343 Eigen::VectorXd weighted_sq; // E[mu^2 + var] under the mixture
344 // Dropping negligible components renormalises the mixture, so the law of
345 // total variance below is applied to weights that no longer sum to one.
346 // Track the retained mass and divide it back out.
347 double retained_weight = 0.0;
348
349 for (size_t k = 0; k < theta_k_.size(); ++k) {
350 if (w_final_(k) < 1e-15) continue;
351 retained_weight += w_final_(k);
352 const Eigen::VectorXd& theta_k = theta_k_[k];
353 auto [K_XX, K_cross, k_diag] = kb(theta_k);
354 // Contract: last element of theta is always log-noise (natural log).
355 const double noise = std::exp(theta_k(theta_k.size() - 1));
356
357 K_XX.diagonal().array() += noise;
358 EigenMatrix L;
359 if (!workspace.cholesky(K_XX, L)) {
360 throw std::runtime_error(
361 "LaplaceINLA::predict: covariance is not positive definite");
362 }
363 Eigen::VectorXd alpha =
364 workspace.back_solve(L, workspace.forward_solve(L, y));
365 Eigen::VectorXd mu = K_cross * alpha;
366 EigenMatrix V = workspace.back_solve_mat(
367 L, workspace.forward_solve_mat(L, K_cross.transpose()));
368 Eigen::VectorXd var =
369 k_diag -
370 (K_cross.array() * V.transpose().array()).rowwise().sum().matrix();
371 var = var.cwiseMax(0.0);
372
373 if (first) {
374 weighted_mean = w_final_(k) * mu;
375 weighted_sq = w_final_(k) * (var + mu.array().square().matrix());
376 first = false;
377 } else {
378 weighted_mean += w_final_(k) * mu;
379 weighted_sq += w_final_(k) * (var + mu.array().square().matrix());
380 }
381 }
382
383 if (first || !(retained_weight > 0.0)) {
384 // Every component fell below the inclusion threshold, so there is no
385 // posterior to report. Returning the default-constructed empty vectors
386 // would look like a valid zero-length prediction.
387 throw std::runtime_error(
388 "LaplaceINLA::predict: every mixture component has negligible "
389 "weight");
390 }
391
392 weighted_mean /= retained_weight;
393 weighted_sq /= retained_weight;
394
395 out.mean = weighted_mean;
396 // Law of total variance: Var = E[var] + Var[mu] = weighted_sq - mean^2.
397 out.variance = weighted_sq - weighted_mean.array().square().matrix();
398 out.variance = out.variance.cwiseMax(0.0);
399 return out;
400}
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out
Eigen::Matrix< double, EigenDynamic, EigenDynamic, EigenMatrixStorage > EigenMatrix
Definition Macros.h:20

◆ predict() [2/2]

INLAPrediction gpr::LaplaceINLA::predict ( const Eigen::VectorXd & y,
KernelBuilder kernel_builder ) const

Predictive moments at the test points embedded in the kernel builder's K_test_X / k_test_test outputs.

Returns
INLAPrediction with law-of-total-variance applied to the CCD mixture over theta_k's posterior predictive.

Definition at line 325 of file LaplaceINLA.cpp.

327{
328 linalg::BackendContext workspace;
329 return predict(y, std::move(kb), workspace);
330}
INLAPrediction predict(const Eigen::VectorXd &y, KernelBuilder kernel_builder) const
Predictive moments at the test points embedded in the kernel builder's K_test_X / k_test_test outputs...

◆ setHessian() [1/2]

void gpr::LaplaceINLA::setHessian ( const Eigen::MatrixXd & H)

p x p observed-information Hessian at theta*. The spectrum must contain at least one positive finite curvature direction; mixed-curvature weak directions are converted to a proper posterior precision by setHessian().

Definition at line 47 of file LaplaceINLA.cpp.

48{
49 setHessian(H, Eigen::MatrixXd{});
50}
void setHessian(const Eigen::MatrixXd &H)

◆ setHessian() [2/2]

void gpr::LaplaceINLA::setHessian ( const Eigen::MatrixXd & H,
const Eigen::MatrixXd & parameter_directions )

Observed information in q free coordinates, with a full-column-rank p x q map from free increments to the ambient theta coordinates.

Definition at line 52 of file LaplaceINLA.cpp.

54{
55 if (H.rows() <= 0 || H.rows() != H.cols()) {
56 throw std::invalid_argument("LaplaceINLA::setHessian: H not square");
57 }
58 const bool constrained = parameter_directions.size() > 0;
59 const Eigen::Index ambient_dimension =
60 constrained ? parameter_directions.rows() : H.rows();
61 if (theta_star_.size() != 0 && ambient_dimension != theta_star_.size()) {
62 throw std::invalid_argument(
63 "LaplaceINLA::setHessian: H dimension does not match theta*");
64 }
65 Eigen::MatrixXd dual_directions;
66 if (constrained) {
67 if (parameter_directions.cols() != H.rows() ||
68 parameter_directions.rows() < parameter_directions.cols() ||
69 !parameter_directions.allFinite()) {
70 throw std::invalid_argument(
71 "LaplaceINLA::setHessian: invalid parameter directions");
72 }
73 const Eigen::MatrixXd gram =
74 parameter_directions.transpose() * parameter_directions;
75 Eigen::LLT<Eigen::MatrixXd> factor(gram);
76 if (factor.info() != Eigen::Success) {
77 throw std::invalid_argument(
78 "LaplaceINLA::setHessian: dependent parameter directions");
79 }
80 dual_directions =
81 factor.solve(parameter_directions.transpose()).transpose();
82 }
83 if (!H.allFinite()) {
84 throw std::runtime_error("LaplaceINLA::setHessian: H is not finite");
85 }
86 H_ = H;
87
88 // Eigendecompose the observed information. The posterior precision used
89 // for CCD must be proper even when weakly informed likelihood directions
90 // have mixed curvature, but a spectrum with no positive direction carries
91 // no local quadratic information to centre the approximation.
92 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> solver(H_);
93 if (solver.info() != Eigen::Success) {
94 throw std::runtime_error("LaplaceINLA::setHessian: eigensolver failed");
95 }
96 lambda_ = solver.eigenvalues();
97 U_ = solver.eigenvectors();
98
99 const double lambda_max = lambda_.maxCoeff();
100 if (!lambda_.allFinite() || !(lambda_max > 0.0)) {
101 throw std::runtime_error(
102 "LaplaceINLA::setHessian: all eigenvalues of H are non-positive");
103 }
104
105 const double spectral_floor =
106 std::max(std::numeric_limits<double>::epsilon() * lambda_max,
107 std::numeric_limits<double>::min());
108 for (Eigen::Index i = 0; i < lambda_.size(); ++i) {
109 if (!(lambda_(i) > spectral_floor)) {
110 lambda_(i) = spectral_floor;
111 }
112 }
113
114 // Precision-form regularization, applied ONLY when needed. Rue,
115 // Martino, Chopin 2009; Martins, Simpson, Lindgren, Rue 2013
116 // "Bayesian computing with INLA: new features" Section 3.4.
117 //
118 // Weakly informed hyperparameters can give flat or mixed observed
119 // curvature. The eigenspace projection keeps positive observed
120 // directions, lifts non-positive directions by a backward-error-scale
121 // floor, and adds a Gaussian theta prior with precision
122 // tau * lambda_max * I:
123 // Q_eff = U max(Lambda, eps * lambda_max I) U^T
124 // + tau * lambda_max I
125 // Lambda_eff(i) = max(Lambda(i), eps * lambda_max)
126 // + tau * lambda_max
127 // so the CCD grid has finite axes and the local precision remains
128 // anchored to the observed spectral scale.
129 //
130 // Conditional application is critical: the bump shifts the
131 // eigenvalues uniformly, which moves moments. On well-conditioned
132 // H (cond < 1/kPrior) the bump is unnecessary and produces a
133 // (1 + tau)-factor on the unit-Gaussian moment recovery test.
134 // Skip when lambda_min/lambda_max >= kPrior so the no-flat-
135 // direction case stays bit-identical to the un-regularized form.
136 //
137 constexpr double kPrior = 1e-2;
138 const double prior_precision = kPrior * lambda_max;
139 const double lambda_min = lambda_.minCoeff();
140 const bool needs_regularization = (lambda_min < prior_precision);
141 if (needs_regularization) {
142 for (Eigen::Index i = 0; i < lambda_.size(); ++i) {
143 lambda_(i) += prior_precision;
144 }
145 }
146
147 // L_scale_ maps z-space to theta-space: theta = theta* + U
148 // Lambda_eff^{-1/2} z. Lambda_eff = Lambda + tau * lambda_max * I is
149 // well-conditioned by construction; cond(Lambda_eff) <= (lambda_max +
150 // prior) / prior = 1 + 1/tau = ~100 here, so the CCD grid is bounded.
151 L_scale_ = U_;
152 for (Eigen::Index i = 0; i < lambda_.size(); ++i) {
153 L_scale_.col(i) *= 1.0 / std::sqrt(lambda_(i));
154 }
155 if (constrained) {
156 L_scale_ = (parameter_directions * L_scale_).eval();
157 // Covariance lifts with J; its ambient precision lifts with the
158 // transpose of J's left inverse, so quadratic forms agree on J beta.
159 U_ = (dual_directions * U_).eval();
160 }
161
162 fitted_ = false;
163}

◆ setLikelihood()

void gpr::LaplaceINLA::setLikelihood ( Likelihood lik)
inline

Definition at line 109 of file LaplaceINLA.h.

110 {
111 lik_ = lik;
112 }

◆ setObservationLikelihood()

void gpr::LaplaceINLA::setObservationLikelihood ( std::shared_ptr< ObservationLikelihood > ol)
inline

Attach a non-Gaussian observation likelihood. Only consulted when lik_ == NON_GAUSSIAN; the branch throws if this was never attached (fail fast rather than silently falling back to Gaussian).

Definition at line 128 of file LaplaceINLA.h.

129 {
130 ol_ = std::move(ol);
131 }

◆ setTheta0()

void gpr::LaplaceINLA::setTheta0 ( const Eigen::VectorXd & theta_star)

MAP hyperparameters (log space if using the project's conventions).

Definition at line 41 of file LaplaceINLA.cpp.

42{
43 theta_star_ = theta_star;
44 fitted_ = false;
45}

◆ setTPHyperprior()

void gpr::LaplaceINLA::setTPHyperprior ( double a,
double b )
inline

TP hyperprior (only used when lik_ == T_CLOSED_FORM).

Definition at line 119 of file LaplaceINLA.h.

120 {
121 tp_a_ = a;
122 tp_b_ = b;
123 }

◆ theta0()

const Eigen::VectorXd & gpr::LaplaceINLA::theta0 ( ) const
inlinenodiscardnoexcept

MAP hyperparameter point set by setTheta0. Used by SVGD initFromCCD.

Definition at line 217 of file LaplaceINLA.h.

218 {
219 return theta_star_;
220 }

The documentation for this class was generated from the following files: