#include <gpr/ml/laplace/SliceSampler.h>
Public Types | |
| using | LogTarget = std::function<double(const Eigen::VectorXd&)> |
| using | AlphaCacheFn = std::function<Eigen::VectorXd(const Eigen::VectorXd&)> |
Public Member Functions | |
| SliceSampler (SliceSamplerOptions opts={}) | |
| bool | sample (const Eigen::VectorXd &theta_init, const LogTarget &log_target, const AlphaCacheFn &alpha_fn, SliceSamplerState &out) |
Doubling slice sampler over a p-dim continuous parameter, with random-direction Gibbs proposals.
Definition at line 100 of file SliceSampler.h.
| using gpr::laplace::SliceSampler::AlphaCacheFn = std::function<Eigen::VectorXd(const Eigen::VectorXd&)> |
Caller-supplied alpha cache builder: given theta, returns alpha = K(theta)^-1 y. Called once per accepted sample. If null, alpha_cache is left empty.
Definition at line 112 of file SliceSampler.h.
| using gpr::laplace::SliceSampler::LogTarget = std::function<double(const Eigen::VectorXd&)> |
Caller-supplied target: returns log p(theta | y) (or any quantity proportional to it on the natural log scale – the slice algorithm is invariant under additive constants). Returning a non-finite value (NaN, -inf) is interpreted as "outside support" and treated as below any slice level.
Definition at line 107 of file SliceSampler.h.
|
explicit |
Definition at line 13 of file SliceSampler.cpp.
| bool gpr::laplace::SliceSampler::sample | ( | const Eigen::VectorXd & | theta_init, |
| const LogTarget & | log_target, | ||
| const AlphaCacheFn & | alpha_fn, | ||
| SliceSamplerState & | out ) |
Draw opts.n_samples + opts.n_burnin samples starting from theta_init. Returns true and fills out.theta_samples / out.alpha_cache on success; returns false and leaves out.valid == false if the initial point has non-finite log-target (no valid starting state).
Definition at line 120 of file SliceSampler.cpp.