code: def min_difference(supports, idx_correct_label):
      """The minimum difference between the supports obtained for the correct
      class and the vector of class supports. The value of the source competence
      is negative if the sample is misclassified and positive otherwise.
  
      Parameters
      ----------
      supports: array of shape (n_samples, n_classes)
          Containing the supports obtained by the base classifier for each class
  
      idx_correct_label: array of shape (n_samples)
          Containing the index of the correct class
  
      Returns
      -------
      C_src : array of shape (n_samples)
          Representing the classifier competences at each data point
  
      References
      ----------
      B. Antosik, M. Kurzynski, New measures of classifier competence –
      heuristics and application to the design of multiple classifier systems.,
      in: Computer recognition systems 4., 2011, pp. 197–206.
      """
      n_samples = len(idx_correct_label)
      # Boolean mask for the correct class
      mask = np.zeros(supports.shape, dtype=bool)
      mask[np.arange(n_samples), idx_correct_label] = True
      # Get supports for the correct class
      supports_correct = supports[mask]
      # Get supports for the other classes
      supports_others = supports[~mask]
  
      if len(supports_others) == 0:
          # Corner case where there is a single class in y_train
          supports_others = np.zeros_like(supports_correct)
  
      difference = supports_correct.reshape(
          -1, 1
      ) - supports_others.reshape(supports_correct.size, -1)
      C_src = np.sort(difference, axis=1)[:, 0]
      return C_src
  
file_path: DESlib/deslib/util/prob_functions.py
imports: import numpy
  from scipy.special import betainc
  from scipy.stats import entropy
label_desc: Use image node_id 5 for calling a global function with example usage: min_difference(supports, idx_correct_label) and returns: C_src