original_docstring: 
              return root of sub-tree
          
docstring: return root of sub-tree
docstring_tokens: return root of sub - tree
code: def extend_mondrian_block(self, node, x, label):
          '''
              return root of sub-tree
          '''
          e_min = np.maximum(node.min_list - x, 0)
          e_max = np.maximum(x - node.max_list, 0)
          e_sum = e_min + e_max
          rate = np.sum(e_sum) + 1e-9
          E = np.random.exponential(1.0/rate)
          if node.get_parent_tau() + E < node.tau:
              e_sample = np.random.rand() * np.sum(e_sum)
              delta = (e_sum.cumsum() > e_sample).argmax()
              if x[delta] > node.min_list[delta]:
                  xi = np.random.uniform(node.min_list[delta], x[delta])
              else:
                  xi = np.random.uniform(x[delta], node.max_list[delta])
              parent = Node(
                  min_list=np.minimum(node.min_list, x),
                  max_list=np.maximum(node.max_list, x),
                  is_leaf=False,
                  stat=self.stat_factory.create(),
                  tau=node.get_parent_tau() + E,
                  parent=node.parent,
                  delta=delta,
                  xi=xi,
              )
              sibling = self.create_leaf(x, label, parent=parent)
              if x[parent.delta] <= parent.xi:
                  parent.left = sibling
                  parent.right = node
              else:
                  parent.left = node
                  parent.right = sibling
              node.parent = parent
              parent.update_internal()
              return parent
          else:
              node.min_list = np.minimum(x, node.min_list)
              node.max_list = np.maximum(x, node.max_list)
              if not node.is_leaf:
                  if x[node.delta] <= node.xi:
                      node.left = self.extend_mondrian_block(node.left, x, label)
                  else:
                      node.right = self.extend_mondrian_block(node.right, x, label)
                  node.update_internal()
              else:
                  node.update_leaf(x, label)
              return node
code_tokens: def extend_mondrian_block ( self , node , x , label ) : e_min = np . maximum ( node . min_list - x , 0 ) e_max = np . maximum ( x - node . max_list , 0 ) e_sum = e_min + e_max rate = np . sum ( e_sum ) + 1e-9 E = np . random . exponential ( 1.0 / rate ) if node . get_parent_tau ( ) + E < node . tau : e_sample = np . random . rand ( ) * np . sum ( e_sum ) delta = ( e_sum . cumsum ( ) > e_sample ) . argmax ( ) if x [ delta ] > node . min_list [ delta ] : xi = np . random . uniform ( node . min_list [ delta ] , x [ delta ] ) else : xi = np . random . uniform ( x [ delta ] , node . max_list [ delta ] ) parent = Node ( min_list = np . minimum ( node . min_list , x ) , max_list = np . maximum ( node . max_list , x ) , is_leaf = False , stat = self . stat_factory . create ( ) , tau = node . get_parent_tau ( ) + E , parent = node . parent , delta = delta , xi = xi , ) sibling = self . create_leaf ( x , label , parent = parent ) if x [ parent . delta ] <= parent . xi : parent . left = sibling parent . right = node else : parent . left = node parent . right = sibling node . parent = parent parent . update_internal ( ) return parent else : node . min_list = np . minimum ( x , node . min_list ) node . max_list = np . maximum ( x , node . max_list ) if not node . is_leaf : if x [ node . delta ] <= node . xi : node . left = self . extend_mondrian_block ( node . left , x , label ) else : node . right = self . extend_mondrian_block ( node . right , x , label ) node . update_internal ( ) else : node . update_leaf ( x , label ) return node
short_docstring: return root of sub-tree
short_docstring_tokens: return root of sub - tree
comment: '''
              return root of sub-tree
          '''