class_docstr: Manages issues related to out-of-distribution examples.
class_docstr_tok: ["Manages","issues","related","to","out-of-distribution","examples","."]
code: def _compute_threshold_and_issue_column_from_distances(
      self, distances: np.ndarray, threshold: Optional[float] = None
  ) -> Tuple[float, np.ndarray]:
      avg_distances = distances.mean(axis=1)
      if threshold:
          if not (
              isinstance(threshold, (int, float))
              and 0 <= threshold <= 1
          ):
              raise ValueError(
                  f"threshold must be a number between 0 and 1, got {threshold} of type {type(threshold)}."
              )
      if threshold is None:
          threshold = OutlierIssueManager.DEFAULT_THRESHOLDS["features"]
      q3_distance = np.percentile(avg_distances, 75)
      iqr_scale = 1 / threshold - 1 if threshold != 0 else np.inf
      return threshold, avg_distances > q3_distance + iqr_scale * iqr(
          avg_distances
      )
  
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 4 for calling the OutlierIssueManager obj's underlying member method code with example usage: obj._compute_threshold_and_issue_column_from_distances(distances, threshold) and returns: threshold,  unknown