IndependenceAssertion#

class pgmpy.independencies.IndependenceAssertion(event1=[], event2=[], event3=[])[source]#

Bases: object

Represents Conditional Independence or Independence assertion.

Each assertion has 3 attributes: event1, event2, event3. The attributes for

\[U \perp X, Y | Z\]

is read as: Random Variable U is independent of X and Y given Z would be:

event1 = {U}

event2 = {X, Y}

event3 = {Z}

Parameters:
event1: String or List of strings

Random Variable which is independent.

event2: String or list of strings.

Random Variables from which event1 is independent

event3: String or list of strings.

Random Variables given which event1 is independent of event2.

Examples

>>> from pgmpy.independencies import IndependenceAssertion
>>> assertion = IndependenceAssertion("U", "X")
>>> assertion = IndependenceAssertion("U", ["X", "Y"])
>>> assertion = IndependenceAssertion("U", ["X", "Y"], "Z")
>>> assertion = IndependenceAssertion(["U", "V"], ["X", "Y"], ["Z", "A"])
get_assertion()[source]#

Returns a tuple of the attributes: variable, independent_of, given.

Examples

>>> from pgmpy.independencies import IndependenceAssertion
>>> asser = IndependenceAssertion("X", "Y", "Z")
>>> asser.get_assertion()
(frozenset({'X'}), frozenset({'Y'}), frozenset({'Z'}))
latex_string()[source]#