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: Compute the region of competence of the query sample
  using the data belonging to DSEL.
  
  Parameters
  ----------
  query : array of shape (n_samples, n_features)
          The test examples.
  
  k : int (Default = self.k)
      The number of neighbors used to in the region of competence.
  
  Returns
  -------
  dists : array of shape (n_samples, k)
          The distances between the query and each sample in the region
          of competence. The vector is ordered in an ascending fashion.
  
  idx : array of shape (n_samples, k)
        Indices of the instances belonging to the region of competence of
        the given query sample.
docstr_tok: ["Compute","the","region","of","competence","of","the","query","sample","using","the","data","belonging","to","DSEL",".","Parameters","--","--","--","--","--","query",":","array","of","shape","(","n_samples",",","n_features",")","The","test","examples",".","k",":","int","(","Default","=","self.k",")","The","number","of","neighbors","used","to","in","the","region","of","competence",".","Returns","--","--","--","-","dists",":","array","of","shape","(","n_samples",",","k",")","The","distances","between","the","query","and","each","sample","in","the","region","of","competence",".","The","vector","is","ordered","in","an","ascending","fashion",".","idx",":","array","of","shape","(","n_samples",",","k",")","Indices","of","the","instances","belonging","to","the","region","of","competence","of","the","given","query","sample","."]
code: def get_competence_region(self, query, k=None):
      """Compute the region of competence of the query sample
      using the data belonging to DSEL.
  
      Parameters
      ----------
      query : array of shape (n_samples, n_features)
              The test examples.
  
      k : int (Default = self.k)
          The number of neighbors used to in the region of competence.
  
      Returns
      -------
      dists : array of shape (n_samples, k)
              The distances between the query and each sample in the region
              of competence. The vector is ordered in an ascending fashion.
  
      idx : array of shape (n_samples, k)
            Indices of the instances belonging to the region of competence of
            the given query sample.
      """
      if k is None:
          k = self.k_
  
      dists, idx = self.roc_algorithm_.kneighbors(
          query, n_neighbors=k, return_distance=True
      )
  
      return np.atleast_2d(dists), np.atleast_2d(idx)
  
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 3 for calling the BaseDS obj's underlying member method code with example usage: obj.get_competence_region(query, k) and returns: np,  np