class_docstr: Manages issues related to near-duplicate examples.
class_docstr_tok: ["Manages","issues","related","to","near-duplicate","examples","."]
docstr: Computes nearest-neighbors thresholding for near-duplicate detection.
docstr_tok: ["Computes","nearest-neighbors","thresholding","for","near-duplicate","detection","."]
code: def _set_threshold(
      self,
      threshold: float,
  ) -> float:
      """Computes nearest-neighbors thresholding for near-duplicate detection."""
      if threshold < 0:
          warnings.warn(
              f"Computed threshold {threshold} is less than 0. "
              "Setting threshold to 0."
              "This may indicate that either the only a few examples are in the dataset, "
              "or the data is heavily skewed."
          )
          threshold = 0
      return threshold
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
  import warnings
  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 7 for calling the NearDuplicateIssueManager obj's underlying member method code with example usage: obj._set_threshold(threshold) and returns: threshold