Skip to content

Commit

Permalink
Merge pull request #59 from deel-ai/joseba-theory-overview
Browse files Browse the repository at this point in the history
Joseba theory overview
  • Loading branch information
jdalch authored Oct 17, 2024
2 parents 70e2307 + 6b383bf commit 2babf1f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ disable=
R0915, # allow too many statements
R0917, # allow too many positional arguments


W0105, # allow no effect string statement
W0102, # allow dangerous default value []
W0212, # allow access to protected member
Expand Down
25 changes: 23 additions & 2 deletions docs/source/theory_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,30 @@ Regularized Adaptive Prediction Sets (RAPS)
*******************************************
.. _theory raps:

Source: [Angelopoulos2021]_
The RAPS algorithm introduced in [Angelopoulos2021]_ is a modification of the APS algorithm
that uses a regularization term in order to produce smaller and more stable prediction sets.
Employing the same notations as for the APS algorithm above,
the RAPS algorithm works in two stages:

**Calibration**
#. For each example :math:`X_i` in the calibration data set, we compute the error :math:`R_i` as the probability mass needed for reaching the true label :math:`Y_i`, i.e.

.. math::
R_i=\widehat{\pi}_{(1)}+\cdots+\widehat{\pi}_{(k)} + \lambda(k-k_{reg}+1),
where :math:`(k)=Y_i`. The regularization term :math:`\lambda(k-k_{reg}+1)` is added to the APS error, where :math:`\lambda` and :math:`k_{reg}` are hyperparameters.

#. Stock all errors in a vector :math:`\mathcal{R}`.

**Inference**
#. Compute the error margin :math:`\delta_{\alpha}` as the :math:`(1-\alpha)(1 + 1/n_{calib})`-th empirical quantile of :math:`\mathcal{R}`.
#. The prediction set for a test point :math:`X_{new}` is defined as :math:`\widehat{C}_{\alpha}(X_{new})=\big\lbrace (1),\dots,(k)\big\rbrace`, where

.. math::
k = \max\big\lbrace i : \widehat{\pi}_{(1)}+\cdots+\widehat{\pi}_{(i)} + \lambda(i-k_{reg}+1) \leq \delta_\alpha\big\rbrace + 1.
TBC
Conformal Anomaly Detection
---------------------------
Expand Down

0 comments on commit 2babf1f

Please sign in to comment.