class_docstr: Robustness verification for decision-tree-based models.
  Following the implementation in https://github.com/chenhongge/treeVerification (MIT License, 9 August 2019)
  
  | Paper link: https://arxiv.org/abs/1906.03849
docstr: Find the K partite cliques among the accessible leaf nodes.
  
  :param accessible_leaves: List of lists of accessible leaf nodes.
  :param label: The try label of the current sample.
  :param target_label: The target label.
  :return: The best score and a list of new cliques.
docstr_tok: ["Find","the","K","partite","cliques","among","the","accessible","leaf","nodes",".",":","param","accessible_leaves",":","List","of","lists","of","accessible","leaf","nodes",".",":","param","label",":","The","try","label","of","the","current","sample",".",":","param","target_label",":","The","target","label",".",":","return",":","The","best","score","and","a","list","of","new","cliques","."]
code: def _get_k_partite_clique(
      self,
      accessible_leaves: List[List[LeafNode]],
      label: int,
      target_label: Optional[int],
  ) -> Tuple[float, List]:
      """
      Find the K partite cliques among the accessible leaf nodes.
  
      :param accessible_leaves: List of lists of accessible leaf nodes.
      :param label: The try label of the current sample.
      :param target_label: The target label.
      :return: The best score and a list of new cliques.
      """
      new_nodes_list = []
      best_scores_sum = 0.0
  
      # pylint: disable=R1702
      for start_tree in range(
          0, len(accessible_leaves), self.max_clique
      ):
          cliques_old: List[Dict[str, Union[Box, float]]] = []
          cliques_new: List[Dict[str, Union[Box, float]]] = []
  
          # Start searching for cliques
          for accessible_leaf in accessible_leaves[start_tree]:
              if (
                  self._classifier.nb_classes > 2
                  and target_label is not None
                  and target_label == accessible_leaf.class_label
              ):
                  new_leaf_value = -accessible_leaf.value
              else:
                  new_leaf_value = accessible_leaf.value
              cliques_old.append(
                  {"box": accessible_leaf.box, "value": new_leaf_value}
              )
  
          # Loop over all all trees
          for i_tree in range(
              start_tree + 1,
              min(len(accessible_leaves), start_tree + self.max_clique),
          ):
              cliques_new.clear()
              # Loop over all existing cliques
              for clique in cliques_old:
                  # Loop over leaf nodes in tree
                  for accessible_leaf in accessible_leaves[i_tree]:
                      leaf_box = accessible_leaf.box.get_intersection(clique["box"])  # type: ignore
                      if leaf_box.intervals:
                          if (
                              self._classifier.nb_classes > 2
                              and target_label is not None
                              and target_label
                              == accessible_leaf.class_label
                          ):
                              new_leaf_value = -accessible_leaf.value
                          else:
                              new_leaf_value = accessible_leaf.value
                          cliques_new.append(
                              {
                                  "box": leaf_box,
                                  "value": new_leaf_value + clique["value"],  # type: ignore
                              }
                          )
  
              cliques_old = cliques_new.copy()
  
          new_nodes = []
          best_score = 0.0
          for i, clique in enumerate(cliques_old):
              # Create a new node without tree_id and node_id to represent clique
              new_nodes.append(
                  LeafNode(
                      tree_id=None,
                      class_label=label,
                      node_id=None,
                      box=clique["box"],  # type: ignore
                      value=clique["value"],  # type: ignore
                  )
              )
  
              if i == 0:
                  best_score = clique["value"]  # type: ignore
              else:
                  if label < 0.5 and self._classifier.nb_classes <= 2:
                      best_score = max(best_score, clique["value"])  # type: ignore
                  else:
                      best_score = min(best_score, clique["value"])  # type: ignore
  
          new_nodes_list.append(new_nodes)
          best_scores_sum += best_score
  
      return best_scores_sum, new_nodes_list
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 3 for calling the RobustnessVerificationTreeModelsCliqueMethod obj's underlying member method code with example usage: obj._get_k_partite_clique(accessible_leaves, label, target_label) and returns: best_scores_sum,  new_nodes_list