Skip to content

Commit

Permalink
Update dcp module documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Falkiewicz committed Feb 9, 2024
1 parent 34acc32 commit c1f77a7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lampe/inference/dcp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
r"""Differentiable Coverage Probability components.
This module implements Differentiable Coverage Probability (DCP) regularizer for
training Neural Ratio Estimator (NRE) and Neural Posterior Estimator (NPE), please refer to
the documentation of the respective modules to learn about the methods.
DCP regularizer relies on the Expected Coverage Probability (ECP) of Highest Posterior Density Region (HPDR)
.. math:: \text{ECP}(1 - \alpha) = \mathbb{E}_{p(\theta, x)} \left[ \mathds{1}[\theta \in \Theta_{\hat{p}(\theta|x)}(1-\alpha)] \right]
where :math:`\Theta_{\hat{p}(\theta|x)}(1-\alpha)` is the HPDR of the approximate posterior model :math:`\hat{p}(\theta|x)`
at level :math:`1-\alpha`, and :math:`\mathds{1}[\cdot]` is an indicator function.
It can be shown that
.. math:: \text{ECP}(1 - \alpha) = \mathbb{E}_{p(\theta, x)} \left[\mathds{1}[\alpha(\hat{p},\theta,x) \geqslant \alpha]\right]
where :math:`\alpha(\hat{p},\theta_j,x_j) := \int \hat{p}(\theta|x_j) \mathds{1}[\hat{p}(\theta|x_j) < \hat{p}(\theta_j|x_j)]\textrm{d}\theta`.
A conservative (calibrated) posterior model is one that has `\text{ECP}(1 - \alpha)` above (at) level :math:`1-\alpha` for all :math:`\alpha \in (0,1)`.
DCP regularizer turns this condition into a differentiable optimization objective minimized in
parallel to the main optimization objective of NRE or NPE.
References:
| Calibrating Neural Simulation-Based Inference with Differentiable Coverage Probability (Falkiewicz et al., 2023)
| https://arxiv.org/abs/2310.13402
Expand Down

0 comments on commit c1f77a7

Please sign in to comment.