Single-path Pathfinder (Zhang, Carpenter, Gelman, Vehtari 2022):
run L-BFGS toward the posterior mode, fit a Gaussian at the optimum
using the inverse-Hessian estimate, and report draws plus the ELBO.
Cheap, derivative-only, embarrassingly parallel – meant as an HMC
warm-start, an initialiser for imh_laplace(), or a quick
sanity check on the Laplace approximation.
This implementation is single-path only. The full multi-path Pathfinder (K parallel L-BFGS runs + mixture proposal + Pareto- smoothed importance reweighting) is a follow-on. The single-path version is what most users want as a Laplace-equivalent diagnostic.
Usage
pathfinder(
log_posterior,
init,
grad_log_posterior = NULL,
n_draws = 1000L,
max_iter = 100L,
tol = 1e-06,
verbose = FALSE
)Arguments
- log_posterior
Function
function(theta) -> numericreturning the unnormalized log posterior attheta.- init
Numeric vector: initial point for L-BFGS. Should be in the support of the posterior (finite log_posterior).
- grad_log_posterior
Optional function returning the gradient of
log_posteriorattheta. IfNULL, gradients are computed numerically via stats::optim's built-in finite differences.- n_draws
Number of draws from the fitted Gaussian (default 1000).
- max_iter
L-BFGS iteration cap (default 100).
- tol
Gradient-norm tolerance for L-BFGS convergence (default 1e-6).
- verbose
Print L-BFGS / ELBO summary at end (default FALSE).
Value
A list with class tulpa_fit carrying:
draws:n_draws x dmatrix of Gaussian draws at the mode.means: posterior means (= mode for a Gaussian fit).mode: the L-BFGS mode.cov: the proposal covariance (solve(-hessian)).elbo: Monte-Carlo estimate ofE_q[log p - log q].n_iter: L-BFGS iterations.converged: logical.inference_mode:"structured".inference_tier:2L.backend:"pathfinder".
Tier
Tier 2 (Structured). The output is a Gaussian approximation, not
samples from the exact posterior – same epistemic class as
tulpa_laplace(). Pair with imh_laplace() for an exact-tier
upgrade.
References
Zhang, L., Carpenter, B., Gelman, A., & Vehtari, A. (2022). Pathfinder: parallel quasi-Newton variational inference. Journal of Machine Learning Research, 23(306), 1-49.
See also
imh_laplace() for an exact-tier MH using the Pathfinder
Gaussian as proposal; bridge_sampling() for marginal-likelihood
estimation on the resulting draws.