-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Implement Laplace approximation: Gaussian approximation to posterior centered at MAP with covariance from Hessian inverse.
Mathematical Background
Algorithm:
- Find MAP:
θ_MAP = argmax p(θ|data) - Compute Hessian:
H = -∇²log p(θ|data)|_{θ=θ_MAP} - Approximate:
p(θ|data) ≈ N(θ_MAP, H^{-1})
Assumptions:
- Posterior is unimodal
- Approximately Gaussian near mode
- Symmetric (no heavy skew)
Assumptions:
Fails when multimodal, but might be useful for placing more probes around a given reference point where threshold ellipses currently are misaligned.
Implementation Tasks
Task 1: Core Laplace Implementation
File: src/psyphy/inference/laplace.py
Requirements:
- Create
LaplaceApproximationclass implementingInferenceEngine - Reuse
MAPInferenceto find mode - Compute Hessian via
jax.hessian() - Invert Hessian with regularization for numerical stability
- Return
LaplacePosteriorobject
API:
from psyphy.inference import LaplaceApproximation
laplace = LaplaceApproximation(
map_kwargs={'num_steps': 1000, 'learning_rate': 0.01},
regularization=1e-4 # Added to diagonal before inversion
)
posterior = laplace.fit(model, data)Metadata
Metadata
Assignees
Labels
No labels