struct gpr::laplace::PsisLaplaceState¶
Overview¶
State and diagnostics from one PSIS-Laplace fit. More…
#include <PsisLaplace.h>
struct PsisLaplaceState {
// fields
Eigen::VectorXd theta_map;
Eigen::MatrixXd proposal_cov_chol;
std::vector<Eigen::VectorXd> theta_samples;
std::vector<Eigen::VectorXd> alpha_samples;
std::vector<double> weights;
std::vector<double> log_weights_raw;
double k_hat = 0.0;
bool reliable = false;
int n_target_evals = 0;
bool valid = false;
};
Detailed Documentation¶
State and diagnostics from one PSIS-Laplace fit. Mirrors SliceSamplerState ‘s shape so the same downstream predict path (runSliceLaplacePredict) can consume both with a uniform interface.
Fields¶
Eigen::VectorXd theta_map
Proposal mean (theta_MAP) and lower-triangular Cholesky of H^{-1} (the proposal covariance). Stored so the predict can recompute log q(theta_k) on demand.
std::vector<Eigen::VectorXd> theta_samples
K importance samples (in the same nat-log hyperparameter coordinates the SCG / slice paths use).
std::vector<Eigen::VectorXd> alpha_samples
Cached alpha_k = K(theta_k)^-1 y for each sample. Populated by the alpha_fn callback the caller supplies.
std::vector<double> weights
PSIS-smoothed self-normalised importance weights, sum == 1. weights[k] is what the predict path multiplies the per-sample (mean, variance) contribution by. Uniform = 1/K when the proposal exactly matches the target.
std::vector<double> log_weights_raw
Raw log-weights log p(theta_k | y) - log q(theta_k) before stabilisation / normalisation. Kept for diagnostics.
double k_hat = 0.0
Fitted Pareto shape parameter on the upper-tail of the weight distribution (Hill-style estimator). > 0.7 -> proposal misses the posterior tail and reliable is false.
bool reliable = false
True iff k_hat <= options.k_hat_threshold AND every sample’s log_target evaluation succeeded.
int n_target_evals = 0
Total number of NLML evaluations made (== K when every log_target call succeeds; less if some failed).
bool valid = false
True iff the cache contains usable n_samples samples.