code: def compute_pairwise_diversity(
      targets, prediction_matrix, diversity_func
  ):
      """Computes the pairwise diversity matrix.
  
      Parameters
      ----------
      targets : array of shape (n_samples):
         Class labels of each sample in X.
  
      prediction_matrix : array of shape (n_samples, n_classifiers):
         Predicted class labels for each classifier in the pool
  
      diversity_func : Function
         Function used to estimate the pairwise diversity
  
      Returns
      -------
      diversity : array of shape = [n_classifiers]
         The average pairwise diversity matrix calculated for the pool of
         classifiers
  
      """
      n_classifiers = prediction_matrix.shape[1]
      diversity = np.zeros(n_classifiers)
  
      for clf_index in range(n_classifiers):
          for clf_index2 in range(clf_index + 1, n_classifiers):
              this_diversity = diversity_func(
                  targets,
                  prediction_matrix[:, clf_index],
                  prediction_matrix[:, clf_index2],
              )
  
              diversity[clf_index] += this_diversity
              diversity[clf_index2] += this_diversity
  
      return diversity
  
file_path: DESlib/deslib/util/diversity.py
imports: import sys
  import numpy
label_desc: Use image node_id 9 for calling a global function with example usage: compute_pairwise_diversity(targets, prediction_matrix, diversity_func) and returns: diversity