class_docstr: Base class for a dynamic classifier selection (dcs) and
     dynamic ensemble selection (des) methods.
  
  All DCS and DES techniques should inherit from this class.
  
  Warning: This class should not be used directly.
  Use derived classes instead.
docstr: estimate the competence of each base classifier :math:`c_{i}`
  the classification of the query sample :math:`\mathbf{x}`.
  Returns an array containing the level of competence estimated
  for each base classifier. The size of the vector is equals to
  the size of the generated_pool of classifiers.
  
  Parameters
  ----------
  competence_region : array of shape (n_samples, n_neighbors)
              Indices of the k nearest neighbors according for each
              test sample.
  
  distances : array of shape (n_samples, n_neighbors)
              Distances of the k nearest neighbors according for each
              test sample.
  
  predictions : array of shape (n_samples, n_classifiers)
                Predictions of the base classifiers for all test examples
  Returns
  -------
  competences : array (n_classifiers) containing the competence level
                estimated for each base classifier
docstr_tok: ["estimate","the","competence","of","each","base","classifier",":","math",":","`","c_","{","i","}","`","the","classification","of","the","query","sample",":","math",":","`","\\mathbf","{","x","}","`",".","Returns","an","array","containing","the","level","of","competence","estimated","for","each","base","classifier",".","The","size","of","the","vector","is","equals","to","the","size","of","the","generated_pool","of","classifiers",".","Parameters","--","--","--","--","--","competence_region",":","array","of","shape","(","n_samples",",","n_neighbors",")","Indices","of","the","k","nearest","neighbors","according","for","each","test","sample",".","distances",":","array","of","shape","(","n_samples",",","n_neighbors",")","Distances","of","the","k","nearest","neighbors","according","for","each","test","sample",".","predictions",":","array","of","shape","(","n_samples",",","n_classifiers",")","Predictions","of","the","base","classifiers","for","all","test","examples","Returns","--","--","--","-","competences",":","array","(","n_classifiers",")","containing","the","competence","level","estimated","for","each","base","classifier"]
code: def estimate_competence(
      self, competence_region, distances=None, predictions=None
  ):
      """estimate the competence of each base classifier :math:`c_{i}`
      the classification of the query sample :math:`\\mathbf{x}`.
      Returns an array containing the level of competence estimated
      for each base classifier. The size of the vector is equals to
      the size of the generated_pool of classifiers.
  
      Parameters
      ----------
      competence_region : array of shape (n_samples, n_neighbors)
                  Indices of the k nearest neighbors according for each
                  test sample.
  
      distances : array of shape (n_samples, n_neighbors)
                  Distances of the k nearest neighbors according for each
                  test sample.
  
      predictions : array of shape (n_samples, n_classifiers)
                    Predictions of the base classifiers for all test examples
      Returns
      -------
      competences : array (n_classifiers) containing the competence level
                    estimated for each base classifier
      """
      pass
  
imports: import functools
  import math
  import warnings
  from abc import abstractmethod, ABCMeta
  import numpy
  from scipy.stats import mode
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.ensemble import BaseEnsemble, BaggingClassifier
  from sklearn.model_selection import train_test_split
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.preprocessing import LabelEncoder, normalize
  from sklearn.utils.validation import check_X_y, check_is_fitted, check_array, check_random_state
  from deslib.util import KNNE
  from deslib.util import faiss_knn_wrapper
  from deslib.util.dfp import frienemy_pruning_preprocessed
  from deslib.util.instance_hardness import hardness_region_competence
label_desc: Use image node_id 4 for calling the BaseDS obj's underlying member method code with example usage: obj.estimate_competence(competence_region, distances, predictions) without return types