Skip to content

Commit

Permalink
Updated the docstrings in anesthetic/tension.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
DilyOng committed Apr 14, 2024
1 parent e568bfd commit 4947c69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions anesthetic/tension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@ def tension_stats(A, B, AB, nsamples=None, beta=None): # noqa: D301
Using nested sampling we can compute:
- ``logZ``: Bayesian evidence
- ``logR``: Logarithmic of R statistic
.. math::
\\log Z = \\log \\int L \\pi d\\theta
\\log R = \\log Z_\\mathrm{AB} - \\log Z_\\mathrm{A}
- \\log Z_\\mathrm{B}
- ``D_KL``: Kullback--Leibler divergence
- ``logI``: Logarithmic of information ratio
.. math::
D_\\mathrm{KL} = \\int P \\log(P / \\pi) d\\theta
\\log I = D_\\mathrm{KL}^A + D_\\mathrm{KL}^B - D_\\mathrm{KL}^{AB}
- ``logL_P``: posterior averaged log-likelihood
- ``logS``: Logarithmic of suspiciousness
.. math::
\\langle\\log L\\rangle_P = \\int P \\log L d\\theta
\\log S = \\log L_\\mathrm{AB} - \\log
L_\\mathrm{A} - \\log L_\\mathrm{B}
- ``d_G``: Gaussian model dimensionality
(or posterior variance of the log-likelihood)
.. math::
d_\\mathrm{G}/2 = \\mathrm{var}(\\log L)_P
d_\\mathrm{G}/2 = \\mathrm{var}(\\log L)_P
- ``p``: p-value for the tension between two samples
.. math::
p = \\int_{d_\\mathrm{G} - 2 \\log S}^{\\infty} \\chi^2 (x)dx
p = \\int_{d_\\mathrm{G} - 2 \\log S}^{\\infty} \\chi^2 (x)dx
Parameters
----------
Expand Down Expand Up @@ -60,7 +62,7 @@ def tension_stats(A, B, AB, nsamples=None, beta=None): # noqa: D301
-------
samples_stats : :class:`anesthetic.samples.Samples`
DataFrame containing the following tension statistics:
logZ, D_KL, logL_P, d_G, p
logR, logI, logS, d_G, p
"""
statsA = A.stats(nsamples=nsamples, beta=beta)
statsB = B.stats(nsamples=nsamples, beta=beta)
Expand All @@ -76,7 +78,7 @@ def tension_stats(A, B, AB, nsamples=None, beta=None): # noqa: D301
samples_stats['logI'] = logI
samples_stats.set_label('logI', r'$\log{I}$')

logS = logR-logI
logS = statsAB.logL_P - statsA.logL_P - statsB.logL_P
samples_stats['logS'] = logS
samples_stats.set_label('logS', r'$\log{S}$')

Expand Down
Empty file removed tests/test.ipynb
Empty file.

0 comments on commit 4947c69

Please sign in to comment.