docstr: Filter out instances with high label disagreement amongst its k nearest neighbors.
  
  Parameters
  ----------
  X
      Data.
  Y
      Predicted class labels.
  
  Returns
  -------
  Filtered data and labels.
code: def filter_by_probability_knn(
      self, X: np.ndarray, Y: np.ndarray
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Filter out instances with high label disagreement amongst its k nearest neighbors.
  
      Parameters
      ----------
      X
          Data.
      Y
          Predicted class labels.
  
      Returns
      -------
      Filtered data and labels.
      """
      if self.k_filter == 1:
          logger.warning(
              "Number of nearest neighbors used for probability density filtering should "
              "be >1, otherwise the prediction probabilities are either 0 or 1 making "
              "probability filtering useless."
          )
      # fit kNN classifier and make predictions on X
      clf = KNeighborsClassifier(
          n_neighbors=self.k_filter,
          leaf_size=self.leaf_size,
          metric=self.metric,
      )
      clf.fit(X, Y)
      preds_proba = clf.predict_proba(X)
      # define cutoff and instances to keep
      preds_max = np.max(preds_proba, axis=1)
      cutoff_proba = np.percentile(
          preds_max, self.alpha * 100
      )  # cutoff probability
      keep_id = np.where(preds_max >= cutoff_proba)[
          0
      ]  # define id's of instances to keep
      X_keep, Y_keep = X[keep_id, :], Y[keep_id]
      return X_keep, Y_keep
  
file_path: alibi/alibi/confidence/trustscore.py
imports: import logging
  from typing import Any, Optional, Tuple
  import numpy
  from sklearn.neighbors import KDTree, KNeighborsClassifier
label_desc: Use image node_id 3 for calling the TrustScore obj's underlying member method code with example usage: obj.filter_by_probability_knn(X, Y) and returns: X_keep,  Y_keep