class_docstr: Represents Conditional Independence or Independence assertion.
  
  Each assertion has 3 attributes: event1, event2, event3.
  The attributes for
  
  .. math:: 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'])
  
  
  Public Methods
  --------------
  get_assertion
class_docstr_tok: ["Represents","Conditional","Independence","or","Independence","assertion",".","Each","assertion","has","3","attributes",":","event1",",","event2",",","event3",".","The","attributes","for","..","math",":",":","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","'","]",")","Public","Methods","--","--","--","--","--","--","--","get_assertion"]
docstr: Initialize an IndependenceAssertion object with event1, event2 and event3 attributes.
  
              event2
              ^
  event1     /   event3
     ^      /     ^
     |     /      |
    (U || X, Y | Z) read as Random variable U is independent of X and Y given Z.
      ---
docstr_tok: ["Initialize","an","IndependenceAssertion","object","with","event1",",","event2","and","event3","attributes",".","event2","^","event1","\/","event3","^","\/","^","|","\/","|","(","U","||","X",",","Y","|","Z",")","read","as","Random","variable","U","is","independent","of","X","and","Y","given","Z",".","--","-"]
code: def __init__(self, event1=[], event2=[], event3=[]):
      r"""
      Initialize an IndependenceAssertion object with event1, event2 and event3 attributes.
  
                  event2
                  ^
      event1     /   event3
         ^      /     ^
         |     /      |
        (U || X, Y | Z) read as Random variable U is independent of X and Y given Z.
          ---
      """
      if event1 and not event2:
          raise ValueError("event2 needs to be specified")
      if any([event2, event3]) and not event1:
          raise ValueError("event1 needs to be specified")
      if event3 and not all([event1, event2]):
          raise ValueError(
              "event1"
              if not event1
              else "event2" + " needs to be specified"
          )
  
      self.event1 = frozenset(
          self._return_list_if_not_collection(event1)
      )
      self.event2 = frozenset(
          self._return_list_if_not_collection(event2)
      )
      self.event3 = frozenset(
          self._return_list_if_not_collection(event3)
      )
      self.all_vars = frozenset().union(
          self.event1, self.event2, self.event3
      )
  
imports: import itertools
label_desc: Use image node_id 1 to create a new IndependenceAssertion object from inherited base classes: object with example: obj = IndependenceAssertion(event1, event2, event3)