class_docstr: a class to represent a single clause/rule of the form:
  "IF <literal1> AND <literal2> AND ... <literal_k> THEN predict class = 0 or 1"
class_docstr_tok: ["a","class","to","represent","a","single","clause\/rule","of","the","form",":","''","IF","<","literal1",">","AND","<","literal2",">","AND","...","<","literal_k",">","THEN","predict","class","=","0","or","1","''"]
docstr: Args:
      another_leaf: another rule object
  
  Returns:
      returns the intersection region of two rules.
          common predicates => take intersected region
          for others (present in one rule exclusively), add as it is from total_region.
  
      currently class label is not used in calculation.
docstr_tok: ["Args",":","another_leaf",":","another","rule","object","Returns",":","returns","the","intersection","region","of","two","rules",".","common","predicates","=",">","take","intersected","region","for","others","(","present","in","one","rule","exclusively",")",",","add","as","it","is","from","total_region",".","currently","class","label","is","not","used","in","calculation","."]
code: def intersection(self, another_leaf):
      """
      Args:
          another_leaf: another rule object
  
      Returns:
          returns the intersection region of two rules.
              common predicates => take intersected region
              for others (present in one rule exclusively), add as it is from total_region.
  
          currently class label is not used in calculation.
      """
      region1 = self.as_dict()
      region2 = another_leaf.as_dict()
  
      region = Rule.intersect_dicts(region1, region2)
      new_preds = []
  
      new_class_label = int(
          self.class_label != another_leaf.class_label
      )  # todo: 1 if they mismatch (redundant)
  
      for key in region:
          left = region[key][0]
          right = region[key][1]
  
          if not np.isinf(left):
              new_preds.append((key, ">", left))
          if not np.isinf(right):
              new_preds.append((key, "<=", right))
  
      new_id = str(self._id) + str(another_leaf._id)
      return Rule(new_id, new_preds, new_class_label)
  
file_path: AIX360/aix360/algorithms/imd/rule.py
imports: from dataclasses import dataclass
  import numpy
  import pandas
label_desc: Use image node_id 9 for calling the Rule obj's underlying member method code with example usage: obj.intersection(another_leaf) and returns: Rule