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 _validate_k(self):
      # validate safe_k
      if self.k is None:
          self.k_ = self.n_samples_
      elif self.k > self.n_samples_:
          msg = (
              "k is bigger than DSEL size. Using All DSEL examples "
              "for competence estimation."
          )
          warnings.warn(msg, category=RuntimeWarning)
          self.k_ = self.n_samples_ - 1
      else:
          self.k_ = self.k
  
      # Validate safe_k
      if self.with_IH and self.safe_k is None:
          self.safe_k = 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 22 for calling the BaseDS obj's underlying member method code with example usage: obj._validate_k() without return types