code: def test_hdbscan_allow_single_cluster_with_epsilon():
      """
      Tests that HDBSCAN single-cluster selection with epsilon works correctly.
      """
      rng = np.random.RandomState(0)
      no_structure = rng.rand(150, 2)
      # without epsilon we should see many noise points as children of root.
      labels = HDBSCAN(
          min_cluster_size=5,
          cluster_selection_epsilon=0.0,
          cluster_selection_method="eom",
          allow_single_cluster=True,
      ).fit_predict(no_structure)
      unique_labels, counts = np.unique(labels, return_counts=True)
      assert len(unique_labels) == 2
  
      # Arbitrary heuristic. Would prefer something more precise.
      assert counts[unique_labels == -1] > 30
  
      # for this random seed an epsilon of 0.18 will produce exactly 2 noise
      # points at that cut in single linkage.
      labels = HDBSCAN(
          min_cluster_size=5,
          cluster_selection_epsilon=0.18,
          cluster_selection_method="eom",
          allow_single_cluster=True,
          algorithm="kd_tree",
      ).fit_predict(no_structure)
      unique_labels, counts = np.unique(labels, return_counts=True)
      assert len(unique_labels) == 2
      assert counts[unique_labels == -1] == 2
  
imports: import numpy
  import pytest
  from scipy import stats
  from scipy.spatial import distance
  from sklearn.cluster import HDBSCAN
  from sklearn.cluster._hdbscan._tree import CONDENSED_dtype, _condense_tree, _do_labelling
  from sklearn.cluster._hdbscan.hdbscan import _OUTLIER_ENCODING
  from sklearn.datasets import make_blobs
  from sklearn.metrics import fowlkes_mallows_score
  from sklearn.metrics.pairwise import _VALID_METRICS, euclidean_distances
  from sklearn.neighbors import BallTree, KDTree
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils import shuffle
  from sklearn.utils._testing import assert_allclose, assert_array_equal
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS
label_desc: Use image node_id 16 for calling a global function with example usage: test_hdbscan_allow_single_cluster_with_epsilon() without return types