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.
code: def _set_region_of_competence_algorithm(self, X):
      algorithm = "auto"
      metric_params = None
  
      if self.knn_metric == "minkowski":
          metric = "minkowski"
      elif self.knn_metric == "mahalanobis":
          metric = "mahalanobis"
          metric_params = {"VI": np.cov(X)}
          algorithm = "auto"
      else:
          raise ValueError(
              '"knn_metric" should be one of the following '
              '["minkowski", "mahalanobis"]'
          )
  
      if self.knn_classifier is None or self.knn_classifier in [
          "knn",
          "sklearn",
      ]:
          knn_class = functools.partial(
              KNeighborsClassifier,
              n_jobs=self.n_jobs,
              algorithm=algorithm,
              metric=metric,
              metric_params=metric_params,
          )
      elif self.knn_classifier == "faiss":
          knn_class = functools.partial(
              faiss_knn_wrapper.FaissKNNClassifier,
              n_jobs=self.n_jobs,
              algorithm="brute",
          )
      elif callable(self.knn_classifier):
          knn_class = self.knn_classifier
      else:
          raise ValueError(
              '"knn_classifier" should be one of the following '
              '["knn", "faiss", None] or an estimator class.'
          )
  
      if self.knne:
          self.knn_class_ = functools.partial(
              KNNE,
              knn_classifier=knn_class,
              n_jobs=self.n_jobs,
              algorithm="auto",
          )
      else:
          self.knn_class_ = knn_class
  
      self.roc_algorithm_ = self.knn_class_(n_neighbors=self.k)
  
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 26 for calling the BaseDS obj's underlying member method code with example usage: obj._set_region_of_competence_algorithm(X) without return types