class_docstr: Base class for a Dynamic Classifier Selection (dcs) method.
  All dynamic classifier selection classes should inherit from this class.
  
  Warning: This class should not be used directly, use derived classes
  instead.
docstr: Predicts the posterior probabilities of the corresponding query
  sample.
  
  If self.selection_method == "all", get the probability estimates of the
  selected ensemble. Otherwise, the technique gets the probability
  estimates from the selected base classifier
  
  Parameters
  ----------
  predictions : array of shape (n_samples, n_classifiers)
      Predictions of the base classifiers for all test examples
  
  probabilities : array of shape (n_samples, n_classifiers, n_classes)
      The predictions of each base classifier for all samples (For
      methods that always require probabilities from the base
      classifiers).
  
  neighbors : array of shape (n_samples, n_neighbors)
      Indices of the k nearest neighbors.
  distances : array of shape (n_samples, n_neighbors)
      Distances from the k nearest neighbors to the query
  
  DFP_mask : array of shape (n_samples, n_classifiers)
     Mask containing 1 for the selected base classifier and 0 otherwise.
  
  Returns
  -------
  predicted_proba: array of shape (n_samples, n_classes)
      Posterior probabilities estimates for each test example.
docstr_tok: ["Predicts","the","posterior","probabilities","of","the","corresponding","query","sample",".","If","self.selection_method","==","``","all","''",",","get","the","probability","estimates","of","the","selected","ensemble",".","Otherwise",",","the","technique","gets","the","probability","estimates","from","the","selected","base","classifier","Parameters","--","--","--","--","--","predictions",":","array","of","shape","(","n_samples",",","n_classifiers",")","Predictions","of","the","base","classifiers","for","all","test","examples","probabilities",":","array","of","shape","(","n_samples",",","n_classifiers",",","n_classes",")","The","predictions","of","each","base","classifier","for","all","samples","(","For","methods","that","always","require","probabilities","from","the","base","classifiers",")",".","neighbors",":","array","of","shape","(","n_samples",",","n_neighbors",")","Indices","of","the","k","nearest","neighbors",".","distances",":","array","of","shape","(","n_samples",",","n_neighbors",")","Distances","from","the","k","nearest","neighbors","to","the","query","DFP_mask",":","array","of","shape","(","n_samples",",","n_classifiers",")","Mask","containing","1","for","the","selected","base","classifier","and","0","otherwise",".","Returns","--","--","--","-","predicted_proba",":","array","of","shape","(","n_samples",",","n_classes",")","Posterior","probabilities","estimates","for","each","test","example","."]
code: def predict_proba_with_ds(
      self,
      predictions,
      probabilities,
      neighbors=None,
      distances=None,
      DFP_mask=None,
  ):
      """Predicts the posterior probabilities of the corresponding query
      sample.
  
      If self.selection_method == "all", get the probability estimates of the
      selected ensemble. Otherwise, the technique gets the probability
      estimates from the selected base classifier
  
      Parameters
      ----------
      predictions : array of shape (n_samples, n_classifiers)
          Predictions of the base classifiers for all test examples
  
      probabilities : array of shape (n_samples, n_classifiers, n_classes)
          The predictions of each base classifier for all samples (For
          methods that always require probabilities from the base
          classifiers).
  
      neighbors : array of shape (n_samples, n_neighbors)
          Indices of the k nearest neighbors.
      distances : array of shape (n_samples, n_neighbors)
          Distances from the k nearest neighbors to the query
  
      DFP_mask : array of shape (n_samples, n_classifiers)
         Mask containing 1 for the selected base classifier and 0 otherwise.
  
      Returns
      -------
      predicted_proba: array of shape (n_samples, n_classes)
          Posterior probabilities estimates for each test example.
      """
      competences = self.estimate_competence(
          neighbors, distances=distances, predictions=predictions
      )
  
      if self.DFP:
          competences = competences * DFP_mask
  
      if self.selection_method != "all":
          # only one classifier is selected
          clf_index = self.select(competences)
          predicted_proba = probabilities[
              np.arange(probabilities.shape[0]), clf_index
          ]
      else:
          # Selected ensemble of classifiers is combined using average
          # probability
          selected_classifiers = self.select(competences)
  
          # Broadcast the selected classifiers mask (to cover the last axis
          # (nClasses):
          selected_classifiers = np.expand_dims(
              selected_classifiers, axis=2
          )
          selected_classifiers = np.broadcast_to(
              selected_classifiers, probabilities.shape
          )
          masked_proba = np.ma.MaskedArray(
              probabilities, ~selected_classifiers
          )
  
          predicted_proba = np.mean(masked_proba, axis=1)
  
      return predicted_proba
  
file_path: DESlib/deslib/dcs/base.py
imports: from abc import ABCMeta
  from copy import copy
  import numpy
  from sklearn.utils.validation import check_random_state
  from deslib.base import BaseDS
  from deslib.util.aggregation import majority_voting_rule
label_desc: Use image node_id 5 for calling the BaseDCS obj's underlying member method code with example usage: obj.predict_proba_with_ds(predictions, probabilities, neighbors, distances, DFP_mask) and returns: predicted_proba