def __init__(self, data, condensed_tree, min_samples, tree_type='kdtree', metric='euclidean', **kwargs):
    self.raw_data = data
    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 = condensed_tree._select_clusters()
    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])
def __init__(self, data, condensed_tree, min_samples, tree_type='kdtree', metric='euclidean', **kwargs):
    self.raw_data = data
    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 = condensed_tree._select_clusters()
    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])