class_docstr: Manages issues related to non-iid data distributions.
  
  Parameters
  ----------
  datalab :
      The Datalab instance that this issue manager searches for issues in.
  
  metric :
      The distance metric used to compute the KNN graph of the examples in the dataset.
      If set to `None`, the metric will be automatically selected based on the dimensionality
      of the features used to represent the examples in the dataset.
  
  k :
      The number of nearest neighbors to consider when computing the KNN graph of the examples.
  
  num_permutations :
      The number of trials to run when performing permutation testing to determine whether
      the distribution of index-distances between neighbors in the dataset is IID or not.
  
  Note
  ----
  This class will only flag a single example as an issue if the dataset is considered non-IID. This type of issue
  is more relevant to the entire dataset as a whole, rather than to individual examples.
class_docstr_tok: ["Manages","issues","related","to","non-iid","data","distributions",".","Parameters","--","--","--","--","--","datalab",":","The","Datalab","instance","that","this","issue","manager","searches","for","issues","in",".","metric",":","The","distance","metric","used","to","compute","the","KNN","graph","of","the","examples","in","the","dataset",".","If","set","to","`","None","`",",","the","metric","will","be","automatically","selected","based","on","the","dimensionality","of","the","features","used","to","represent","the","examples","in","the","dataset",".","k",":","The","number","of","nearest","neighbors","to","consider","when","computing","the","KNN","graph","of","the","examples",".","num_permutations",":","The","number","of","trials","to","run","when","performing","permutation","testing","to","determine","whether","the","distribution","of","index-distances","between","neighbors","in","the","dataset","is","IID","or","not",".","Note","--","--","This","class","will","only","flag","a","single","example","as","an","issue","if","the","dataset","is","considered","non-IID",".","This","type","of","issue","is","more","relevant","to","the","entire","dataset","as","a","whole",",","rather","than","to","individual","examples","."]
code: def find_issues(
      self,
      features: Optional[npt.NDArray] = None,
      pred_probs: Optional[np.ndarray] = None,
      **kwargs,
  ) -> None:
      knn_graph = self._process_knn_graph_from_inputs(kwargs)
      old_knn_metric = self.datalab.get_info("statistics").get(
          "knn_metric"
      )
      metric_changes = bool(
          self.metric and self.metric != old_knn_metric
      )
      knn = self._setup_knn(
          features, pred_probs, knn_graph, metric_changes
      )
  
      if knn_graph is None or metric_changes:
          self.neighbor_index_choices = self._get_neighbors(knn=knn)
      else:
          self._skip_storing_knn_graph_for_pred_probs = False
          self.neighbor_index_choices = self._get_neighbors(
              knn_graph=knn_graph
          )
  
      self.num_neighbors = self.k
  
      indices = np.arange(self.N)
      self.neighbor_index_distances = np.abs(
          indices.reshape(-1, 1) - self.neighbor_index_choices
      )
  
      self.statistics = self._get_statistics(
          self.neighbor_index_distances
      )
  
      self.p_value = self._permutation_test(
          num_permutations=self.num_permutations
      )
  
      scores = self._score_dataset()
      issue_mask = np.zeros(self.N, dtype=bool)
      if self.p_value < self.significance_threshold:
          issue_mask[scores.argmin()] = True
      self.issues = pd.DataFrame(
          {
              f"is_{self.issue_name}_issue": issue_mask,
              self.issue_score_key: scores,
          },
      )
  
      self.summary = self.make_summary(score=self.p_value)
  
      if knn_graph is None:
          self.info = self.collect_info(knn=knn)
      self.info = self.collect_info(knn_graph=knn_graph, knn=knn)
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union, cast
  import warnings
  import itertools
  from scipy.stats import gaussian_kde
  import numpy
  import pandas
  from scipy.sparse import csr_matrix
  from sklearn.neighbors import NearestNeighbors
  from sklearn.exceptions import NotFittedError
  from sklearn.utils.validation import check_is_fitted
  from cleanlab.datalab.internal.issue_manager import IssueManager
label_desc: Use image node_id 4 for calling the NonIIDIssueManager obj's underlying member method code with example usage: obj.find_issues(features, pred_probs) without return types