code: def approximate_predict(clusterer, points_to_predict):
      """Predict the cluster label of new points. The returned labels
      will be those of the original clustering found by ``clusterer``,
      and therefore are not (necessarily) the cluster labels that would
      be found by clustering the original data combined with
      ``points_to_predict``, hence the 'approximate' label.
  
      If you simply wish to assign new points to an existing clustering
      in the 'best' way possible, this is the function to use. If you
      want to predict how ``points_to_predict`` would cluster with
      the original data under HDBSCAN the most efficient existing approach
      is to simply recluster with the new point(s) added to the original dataset.
  
      Parameters
      ----------
      clusterer : HDBSCAN
          A clustering object that has been fit to the data and
          either had ``prediction_data=True`` set, or called the
          ``generate_prediction_data`` method after the fact.
  
      points_to_predict : array, or array-like (n_samples, n_features)
          The new data points to predict cluster labels for. They should
          have the same dimensionality as the original dataset over which
          clusterer was fit.
  
      Returns
      -------
      labels : array (n_samples,)
          The predicted labels of the ``points_to_predict``
  
      probabilities : array (n_samples,)
          The soft cluster scores for each of the ``points_to_predict``
  
      See Also
      --------
      :py:func:`hdbscan.predict.membership_vector`
      :py:func:`hdbscan.predict.all_points_membership_vectors`
  
      """
      if clusterer.prediction_data_ is None:
          raise ValueError(
              "Clusterer does not have prediction data!"
              " Try fitting with prediction_data=True set,"
              " or run generate_prediction_data on the clusterer"
          )
  
      points_to_predict = np.asarray(points_to_predict)
  
      if (
          points_to_predict.shape[1]
          != clusterer.prediction_data_.raw_data.shape[1]
      ):
          raise ValueError(
              "New points dimension does not match fit data!"
          )
  
      if clusterer.prediction_data_.cluster_tree.shape[0] == 0:
          warn(
              "Clusterer does not have any defined clusters, new data"
              " will be automatically predicted as noise."
          )
          labels = -1 * np.ones(
              points_to_predict.shape[0], dtype=np.int32
          )
          probabilities = np.zeros(
              points_to_predict.shape[0], dtype=np.float32
          )
          return labels, probabilities
  
      labels = np.empty(points_to_predict.shape[0], dtype=np.int32)
      probabilities = np.empty(
          points_to_predict.shape[0], dtype=np.float64
      )
  
      min_samples = clusterer.min_samples or clusterer.min_cluster_size
      (
          neighbor_distances,
          neighbor_indices,
      ) = clusterer.prediction_data_.tree.query(
          points_to_predict, k=2 * min_samples
      )
  
      for i in range(points_to_predict.shape[0]):
          label, prob = _find_cluster_and_probability(
              clusterer.condensed_tree_,
              clusterer.prediction_data_.cluster_tree,
              neighbor_indices[i],
              neighbor_distances[i],
              clusterer.prediction_data_.core_distances,
              clusterer.prediction_data_.cluster_map,
              clusterer.prediction_data_.max_lambdas,
              min_samples,
          )
          labels[i] = label
          probabilities[i] = prob
  
      return labels, probabilities
  
file_path: hdbscan/hdbscan/prediction.py
imports: import numpy
  from sklearn.neighbors import KDTree, BallTree
  from .dist_metrics import DistanceMetric
  from ._hdbscan_tree import recurse_leaf_dfs
  from ._prediction_utils import get_tree_row_with_child, dist_membership_vector, outlier_membership_vector, prob_in_some_cluster, all_points_dist_membership_vector, all_points_outlier_membership_vector, all_points_prob_in_some_cluster
  from warnings import warn
label_desc: Use image node_id 4 for calling a global function with example usage: approximate_predict(clusterer, points_to_predict) and returns: labels,  probabilities, labels,  probabilities