code: def fit(self, index, n_nodes, tau_matrix, previous_tree, edges=None):
          
          self.level = index + 1
          self.n_nodes = n_nodes
          self.tau_matrix = tau_matrix
          self.previous_tree = previous_tree
          self.edges = edges or []
  
          if not self.edges:
              if self.level == 1:
                  self.u_matrix = previous_tree
                  self._build_first_tree()
  
              else:
                  self._build_kth_tree()
  
              self.prepare_next_tree()
  
          self.fitted = True
docs: Fits tree object.
  
          Args:
              :param index: index of the tree
              :param n_nodes: number of nodes in the tree
              :tau_matrix: kendall's tau matrix of the data
              :previous_tree: tree object of previous level
              :type index: int
              :type n_nodes: int
              :type tau_matrix: np.ndarray of size n_nodes*n_nodes