Representing independencies using pgmpy
To represent independencies, pgmpy
has two classes, namely IndependenceAssertion
and Independencies
. The IndependenceAssertion
class is used to represent individual assertions of the form of or . Let's see some code to represent assertions:
# Firstly we need to import IndependenceAssertion In [1]: from pgmpy.independencies import IndependenceAssertion # Each assertion is in the form of [X, Y, Z] meaning X is # independent of Y given Z. In [2]: assertion1 = IndependenceAssertion('X', 'Y') In [3]: assertion1 Out[3]: ...
Get Mastering Probabilistic Graphical Models Using Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.