Skip to content

Commit 5c85059

Browse files
committed
docs: Format tpm.infer_edge() docstring
1 parent 7815929 commit 5c85059

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@
127127
.. |alpha| replace:: :math:`\alpha`
128128
.. |alpha > 0| replace:: :math:`\alpha > 0`
129129
.. |L1| replace:: :math:`L_1`
130+
.. |S| replace:: :math:`S`
130131
.. |A| replace:: :math:`A`
132+
.. |A'| replace:: :math:`A'`
131133
.. |B| replace:: :math:`B`
132134
.. |C| replace:: :math:`C`
133135
.. |D| replace:: :math:`D`
@@ -144,6 +146,7 @@
144146
.. |BCD| replace:: :math:`BCD`
145147
.. |CDE| replace:: :math:`CDE`
146148
.. |DEF| replace:: :math:`DEF`
149+
.. |A -> B| replace:: :math:`A \rightarrow B`
147150
.. |(AB / DE) x (∅ / C)| replace:: :math:`\frac{AB}{DE} \times \frac{\varnothing}{C}`
148151
.. |(A / CD) x (∅ / E)| replace:: :math:`\frac{A}{CD} \times \frac{\varnothing}{E}`
149152
.. |(∅ / C) x (A / D)| replace:: :math:`\frac{\varnothing}{C} \times \frac{A}{D}`
@@ -187,7 +190,9 @@
187190
.. |Y_t = {OR, AND = 10}| replace:: :math:`Y_t = \{OR, AND = 10\}`
188191
.. |Y_t = D| replace:: :math:`Y_t = D`
189192
.. |{OR, AND} -> {OR, AND}| replace:: :math:`\{OR, AND\} \rightarrow \{OR, AND\}`
190-
193+
.. |A' = S - {A}| replace:: :math:`A' = S - \{A\}`
194+
.. |C(A)| replace:: :math:`C(A)`
195+
.. |Pr(B | C(A), A=0) != Pr(B | C(A), A=1)| replace:: :math:`\Pr(B \mid C(A), A = 0) \neq \Pr(B \mid C(A), A = 1)`
191196
""",
192197
# Constants
193198
r"""

pyphi/tpm.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ def marginalize_out(node_indices, tpm):
7272
def infer_edge(tpm, a, b, contexts):
7373
"""Infer the presence or absence of an edge from node A to node B.
7474
75-
Let S be the set of all nodes in a network. Let A' = S - {A}. We call the
76-
state of A' the context C of A. There is an edge from A to B if there
77-
exists any context C(A) such that P(B | C(A), A=0) =/= P(B | C(A), A=1).
75+
Let |S| be the set of all nodes in a network. Let |A' = S - {A}|. We call
76+
the state of |A'| the context |C| of |A|. There is an edge from |A| to |B|
77+
if there exists any context |C(A)| such that |Pr(B | C(A), A=0) != Pr(B |
78+
C(A), A=1)|.
7879
7980
Args:
8081
tpm (np.ndarray): The TPM in state-by-node, multidimensional form.
8182
a (int): The index of the putative source node.
8283
b (int): The index of the putative sink node.
8384
Returns:
84-
bool: True if the edge A->B exists, False otherwise.
85+
bool: ``True`` if the edge |A -> B| exists, ``False`` otherwise.
8586
"""
8687

8788
def a_in_context(context):

0 commit comments

Comments
 (0)