class_docstr: Jointly trains 2 surrogate decision trees.
  Refines diff (or sim) regions by sample generation.
docstr: Args:
      t1: surrogate tree 1
      t2: surrogate tree 2
  
  Returns:
      combine common nodes and split diverging trees under or nodes
  
      returns a single tree dictionary capturing both the common trunk
      and diverging branches. The diverging trees are stored in `tree1` and `tree2`
      keys of t, for each diverging juncture.
docstr_tok: ["Args",":","t1",":","surrogate","tree","1","t2",":","surrogate","tree","2","Returns",":","combine","common","nodes","and","split","diverging","trees","under","or","nodes","returns","a","single","tree","dictionary","capturing","both","the","common","trunk","and","diverging","branches",".","The","diverging","trees","are","stored","in","`","tree1","`","and","`","tree2","`","keys","of","t",",","for","each","diverging","juncture","."]
code: def common_trunk(self, t1, t2):
      """
      Args:
          t1: surrogate tree 1
          t2: surrogate tree 2
  
      Returns:
          combine common nodes and split diverging trees under or nodes
  
          returns a single tree dictionary capturing both the common trunk
          and diverging branches. The diverging trees are stored in `tree1` and `tree2`
          keys of t, for each diverging juncture.
      """
  
      """ gets the common prefix from two trees t1 and t2 and
          returns a single tree dictionary capturing both the common trunk
          and diverging branches. The diverging trees are stored in `tree1` and `tree2`
          keys of t, for each diverging juncture.
          """
      t = {}
  
      keys1 = t1.keys()
      keys2 = t2.keys()
  
      same_keys = keys1 == keys2
      is_split_node = "cutoff" in t1
  
      if same_keys and is_split_node:
          same_split_cond = (t1["col"] == t2["col"]) and (
              t1["cutoff"] == t2["cutoff"]
          )
      else:
          same_split_cond = False
  
      if same_keys and is_split_node and same_split_cond:
          # same split node
          for key in t1:
              if key not in ["left", "right"]:
                  t[key] = t1[key]
  
          t["left"] = self.common_trunk(t1["left"], t2["left"])
          t["right"] = self.common_trunk(t1["right"], t2["right"])
  
      else:
          # diverging point: leaf nodes or different split nodes or one leaf and another split
          t["tree1"] = t1
          t["tree2"] = t2
  
      return t
  
imports: import numpy
  import pandas
  from aix360.algorithms.imd.rule import Rule
label_desc: Use image node_id 14 for calling the JointSurrogateTree obj's underlying member method code with example usage: obj.common_trunk(t1, t2) and returns: t