.. index:: pair: class; gpr::laplace::PsisLaplace .. _doxid-classgpr_1_1laplace_1_1_psis_laplace: class gpr::laplace::PsisLaplace =============================== .. toctree:: :hidden: Overview ~~~~~~~~ PSIS-Laplace sampler: draws K samples from N(theta_MAP, H^{-1}), evaluates raw log-weights ``log p_target(theta_k) - log q(theta_k)``, and PSIS-smooths the upper tail. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class PsisLaplace { public: // typedefs typedef std::function :ref:`LogTarget`; typedef std::function :ref:`AlphaCacheFn`; // construction :target:`PsisLaplace`(:ref:`PsisLaplaceOptions` opts = {}); // methods bool :ref:`fit`(const Eigen::VectorXd& theta_map, const Eigen::MatrixXd& hessian, const :ref:`LogTarget`& log_target, const :ref:`AlphaCacheFn`& alpha_fn, :ref:`PsisLaplaceState`& out); }; .. _details-classgpr_1_1laplace_1_1_psis_laplace: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ PSIS-Laplace sampler: draws K samples from N(theta_MAP, H^{-1}), evaluates raw log-weights ``log p_target(theta_k) - log q(theta_k)``, and PSIS-smooths the upper tail. Typedefs -------- .. index:: pair: typedef; LogTarget .. _doxid-classgpr_1_1laplace_1_1_psis_laplace_1a339cb711281158b3b8767e040015835b: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function LogTarget Caller-supplied target: returns ``log p(theta | :ref:`y `)`` (matches the :ref:`SliceSampler::LogTarget ` signature exactly so the same closures fit both paths). .. index:: pair: typedef; AlphaCacheFn .. _doxid-classgpr_1_1laplace_1_1_psis_laplace_1ab9575b219afbb007efaae805ff2d2cd9: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function AlphaCacheFn Caller-supplied alpha cache builder. Same contract as :ref:`SliceSampler::AlphaCacheFn `. Methods ------- .. index:: pair: function; fit .. _doxid-classgpr_1_1laplace_1_1_psis_laplace_1acf82a765e2ee06207496e71196c00001: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool fit(const Eigen::VectorXd& theta_map, const Eigen::MatrixXd& hessian, const :ref:`LogTarget`& log_target, const :ref:`AlphaCacheFn`& alpha_fn, :ref:`PsisLaplaceState`& out) Draw K samples from N(theta_map, hessian^{-1}), populate out.theta_samples / alpha_samples / weights / k_hat / reliable. Returns true on success (every log_target evaluation finite, proposal Cholesky succeeded). Returns false if the proposal covariance cannot be Cholesky-factored even after jittering the Hessian by ``options.hessian_jitter_max``.