class_docstr: Manages issues related to out-of-distribution examples.
class_docstr_tok: ["Manages","issues","related","to","out-of-distribution","examples","."]
code: def _process_knn_graph_from_features(
      self, kwargs: Dict
  ) -> csr_matrix:
      # Check if the weighted knn graph exists in info
      knn_graph = self.datalab.get_info("statistics").get(
          "weighted_knn_graph", None
      )
  
      k: int = 0  # Used to check if the knn graph needs to be recomputed, already set in the knn object
      if knn_graph is not None:
          k = knn_graph.nnz // knn_graph.shape[0]
  
      knn: NearestNeighbors = self.ood.params["knn"]  # type: ignore
      if kwargs.get("knn", None) is not None or knn.n_neighbors > k:  # type: ignore[union-attr]
          # If the pre-existing knn graph has fewer neighbors than the knn object,
          # then we need to recompute the knn graph
          assert knn == self.ood.params["knn"]  # type: ignore[union-attr]
          knn_graph = knn.kneighbors_graph(mode="distance")  # type: ignore[union-attr]
          self._metric = knn.metric  # type: ignore[union-attr]
  
      return knn_graph
  
file_path: cleanlab/cleanlab/datalab/internal/issue_manager/outlier.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Tuple, Union, cast
  from scipy.sparse import csr_matrix
  from scipy.stats import iqr
  import numpy
  import pandas
  from cleanlab.datalab.internal.issue_manager import IssueManager
  from cleanlab.outlier import OutOfDistribution, transform_distances_to_scores
label_desc: Use image node_id 5 for calling the OutlierIssueManager obj's underlying member method code with example usage: obj._process_knn_graph_from_features(kwargs) and returns: knn_graph