code: def ccprmod(supports, idx_correct_label, B=20):
      """Python implementation of the ccprmod.m (Classifier competence based on
      probabilistic modelling)
      function. Matlab code is available at:
      http://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/28391/versions/6/previews/ccprmod.m/index.html
  
      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.
  
      B : int (Default = 20)
          number of points used in the calculation of the competence, higher
          values result in a more accurate estimation.
  
      Returns
      -------
      C_src : array of shape (n_samples)
              representing the classifier competences at each data point
  
      Examples
      --------
      >>> supports = [[0.3, 0.6, 0.1],[1.0/3, 1.0/3, 1.0/3]]
      >>> idx_correct_label = [1,0]
      >>> ccprmod(supports,idx_correct_label)
      ans = [0.784953394056843, 0.332872292262951]
  
      References
      ----------
      T.Woloszynski, M. Kurzynski, A probabilistic model of classifier competence
      for dynamic ensemble selection,
      Pattern Recognition 44 (2011) 2656–2668.
      """
      if not isinstance(B, int):
          raise TypeError(
              "Parameter B should be an integer. "
              "Currently B is {0}".format(type(B))
          )
  
      if B <= 0 or B is None:
          raise ValueError(
              "The parameter B should be higher than 0. "
              "Currently B is {0}".format(B)
          )
  
      supports = np.asarray(supports)
      idx_correct_label = np.array(idx_correct_label)
      supports[supports > 1] = 1
  
      N, C = supports.shape
  
      x = np.linspace(0, 1, B)
      x = np.tile(x, (N, C))
  
      a = np.zeros(x.shape)
  
      for c in range(C):
          a[:, c * B : (c + 1) * B] = C * supports[:, c : c + 1]
  
      b = C - a
  
      # For extreme cases, with a or b equal to 0, add a small constant:
      eps = 1e-20
      a[a <= eps] = eps
      b[b <= eps] = eps
      betaincj = betainc(a, b, x)
  
      C_src = np.zeros(N)
      for n in range(N):
          t = range(
              (idx_correct_label[n]) * B, (idx_correct_label[n] + 1) * B
          )
          bc = betaincj[n, t].reshape(1, len(t))
          bi = betaincj[n, list(set(range(0, (C * B))) - set(t))]
          bi = np.transpose(np.reshape(bi, (B, C - 1), order="F"))
          C_src[n] = np.sum(
              np.multiply(
                  (bc[0, 1:] - bc[0, 0:-1]),
                  np.prod((bi[:, 0:-1] + bi[:, 1:]) / 2, 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 4 for calling a global function with example usage: ccprmod(supports, idx_correct_label, B) and returns: C_src