class_docstr: Extra data that allows for faster prediction if cached.
  
  Parameters
  ----------
  
  data : array (n_samples, n_features)
      The original data set that was clustered
  
  condensed_tree : CondensedTree
      The condensed tree object created by a clustering
  
  min_samples : int
      The min_samples value used in clustering
  
  tree_type : string, optional
      Which type of space tree to use for core distance computation.
      One of:
          * ``kdtree``
          * ``balltree``
  
  metric : string, optional
      The metric used to determine distance for the clustering.
      This is the metric that will be used for the space tree to determine
      core distances etc.
  
  **kwargs :
      Any further arguments to the metric.
  
  Attributes
  ----------
  
  raw_data : array (n_samples, n_features)
      The original data set that was clustered
  
  tree : KDTree or BallTree
      A space partitioning tree that can be queried for nearest neighbors.
  
  core_distances : array (n_samples,)
      The core distances for every point in the original data set.
  
  cluster_map : dict
      A dictionary mapping cluster numbers in the condensed tree to labels
      in the final selected clustering.
  
  cluster_tree : structured array
      A version of the condensed tree that only contains clusters, not
      individual points.
  
  max_lambdas : dict
      A dictionary mapping cluster numbers in the condensed tree to the
      maximum lambda value seen in that cluster.
class_docstr_tok: ["Extra","data","that","allows","for","faster","prediction","if","cached",".","Parameters","--","--","--","--","--","data",":","array","(","n_samples",",","n_features",")","The","original","data","set","that","was","clustered","condensed_tree",":","CondensedTree","The","condensed","tree","object","created","by","a","clustering","min_samples",":","int","The","min_samples","value","used","in","clustering","tree_type",":","string",",","optional","Which","type","of","space","tree","to","use","for","core","distance","computation",".","One","of",":","*","``","kdtree","``","*","``","balltree","``","metric",":","string",",","optional","The","metric","used","to","determine","distance","for","the","clustering",".","This","is","the","metric","that","will","be","used","for","the","space","tree","to","determine","core","distances","etc",".","*","*","kwargs",":","Any","further","arguments","to","the","metric",".","Attributes","--","--","--","--","--","raw_data",":","array","(","n_samples",",","n_features",")","The","original","data","set","that","was","clustered","tree",":","KDTree","or","BallTree","A","space","partitioning","tree","that","can","be","queried","for","nearest","neighbors",".","core_distances",":","array","(","n_samples",",",")","The","core","distances","for","every","point","in","the","original","data","set",".","cluster_map",":","dict","A","dictionary","mapping","cluster","numbers","in","the","condensed","tree","to","labels","in","the","final","selected","clustering",".","cluster_tree",":","structured","array","A","version","of","the","condensed","tree","that","only","contains","clusters",",","not","individual","points",".","max_lambdas",":","dict","A","dictionary","mapping","cluster","numbers","in","the","condensed","tree","to","the","maximum","lambda","value","seen","in","that","cluster","."]
code: def __init__(
      self,
      data,
      condensed_tree,
      min_samples,
      tree_type="kdtree",
      metric="euclidean",
      **kwargs,
  ):
      self.raw_data = data.astype(np.float64)
      self.tree = self._tree_type_map[tree_type](
          self.raw_data, metric=metric, **kwargs
      )
      self.core_distances = self.tree.query(data, k=min_samples)[0][
          :, -1
      ]
      self.dist_metric = DistanceMetric.get_metric(metric, **kwargs)
  
      selected_clusters = sorted(condensed_tree._select_clusters())
      # raw_condensed_tree = condensed_tree.to_numpy()
      raw_condensed_tree = condensed_tree._raw_tree
  
      self.cluster_map = {
          c: n for n, c in enumerate(sorted(list(selected_clusters)))
      }
      self.reverse_cluster_map = {
          n: c for c, n in self.cluster_map.items()
      }
  
      self.cluster_tree = raw_condensed_tree[
          raw_condensed_tree["child_size"] > 1
      ]
      self.max_lambdas = {}
      self.leaf_max_lambdas = {}
      self.exemplars = []
  
      all_clusters = set(
          np.hstack(
              [self.cluster_tree["parent"], self.cluster_tree["child"]]
          )
      )
  
      for cluster in all_clusters:
          self.leaf_max_lambdas[cluster] = raw_condensed_tree[
              "lambda_val"
          ][raw_condensed_tree["parent"] == cluster].max()
  
      for cluster in selected_clusters:
          self.max_lambdas[cluster] = raw_condensed_tree["lambda_val"][
              raw_condensed_tree["parent"] == cluster
          ].max()
  
          for sub_cluster in self._clusters_below(cluster):
              self.cluster_map[sub_cluster] = self.cluster_map[cluster]
              self.max_lambdas[sub_cluster] = self.max_lambdas[cluster]
  
          cluster_exemplars = np.array([], dtype=np.int64)
          for leaf in self._recurse_leaf_dfs(cluster):
              leaf_max_lambda = raw_condensed_tree["lambda_val"][
                  raw_condensed_tree["parent"] == leaf
              ].max()
              points = raw_condensed_tree["child"][
                  (raw_condensed_tree["parent"] == leaf)
                  & (
                      raw_condensed_tree["lambda_val"]
                      == leaf_max_lambda
                  )
              ]
              cluster_exemplars = np.hstack([cluster_exemplars, points])
  
          self.exemplars.append(self.raw_data[cluster_exemplars])
  
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 3 to create a new PredictionData object from inherited base classes: object with example: obj = PredictionData(data, condensed_tree, min_samples, tree_type, metric)