.. index:: pair: struct; gpr::laplace::PsisLaplaceState .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state: struct gpr::laplace::PsisLaplaceState ===================================== .. toctree:: :hidden: Overview ~~~~~~~~ State and diagnostics from one PSIS-Laplace fit. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct PsisLaplaceState { // fields Eigen::VectorXd :ref:`theta_map`; Eigen::MatrixXd :target:`proposal_cov_chol`; std::vector :ref:`theta_samples`; std::vector :ref:`alpha_samples`; std::vector :ref:`weights`; std::vector :ref:`log_weights_raw`; double :ref:`k_hat` = 0.0; bool :ref:`reliable` = false; int :ref:`n_target_evals` = 0; bool :ref:`valid` = false; }; .. _details-structgpr_1_1laplace_1_1_psis_laplace_state: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ State and diagnostics from one PSIS-Laplace fit. Mirrors :ref:`SliceSamplerState ` 's shape so the same downstream predict path (runSliceLaplacePredict) can consume both with a uniform interface. Fields ------ .. index:: pair: variable; theta_map .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1a04e21e16e7546f0c3cd75e7c141b33eb: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: variable; theta_samples .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1aba5a1ad9fcedb7af162fabb992800122: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector theta_samples K importance samples (in the same nat-log hyperparameter coordinates the SCG / slice paths use). .. index:: pair: variable; alpha_samples .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1af1a338df2ccd0c47c171033b7611ed94: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector alpha_samples Cached ``alpha_k = K(theta_k)^-1 :ref:`y ``` for each sample. Populated by the alpha_fn callback the caller supplies. .. index:: pair: variable; weights .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1a1f21a13dc20641de0d84314a86e701c6: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector weights PSIS-smoothed self-normalised importance weights, sum == 1. ``:ref:`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. .. index:: pair: variable; log_weights_raw .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1a238f0b89653d395232c3b2c6676cc9b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector log_weights_raw Raw log-weights ``log p(theta_k | :ref:`y `) - log q(theta_k)`` before stabilisation / normalisation. Kept for diagnostics. .. index:: pair: variable; k_hat .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1af0689a3f095644a029d87539aed6d9c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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 ``:ref:`reliable ``` is false. .. index:: pair: variable; reliable .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1af95990a11c1c417fad2421cb0feefadd: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool reliable = false True iff k_hat <= options.k_hat_threshold AND every sample's log_target evaluation succeeded. .. index:: pair: variable; n_target_evals .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1a246c2187e26f0551fa774eaca24650bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block int n_target_evals = 0 Total number of NLML evaluations made (== K when every log_target call succeeds; less if some failed). .. index:: pair: variable; valid .. _doxid-structgpr_1_1laplace_1_1_psis_laplace_state_1ae0bd8cf0bb4b2f097d98995c8df71ff3: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool valid = false True iff the cache contains usable ``n_samples`` samples.