def _find_cluster_and_probability(tree, cluster_tree, neighbor_indices, neighbor_distances, core_distances, cluster_map, max_lambdas, min_samples):
    '\n    Return the cluster label (of the original clustering) and membership\n    probability of a new data point.\n\n    Parameters\n    ----------\n    tree : CondensedTree\n        The condensed tree associated with the clustering.\n\n    cluster_tree : structured_array\n        The raw form of the condensed tree with only cluster information (no\n        data on individual points). This is significantly more compact.\n\n    neighbor_indices : array (2 * min_samples, )\n        An array of raw distance based nearest neighbor indices.\n\n    neighbor_distances : array (2 * min_samples, )\n        An array of raw distances to the nearest neighbors.\n\n    core_distances : array (n_samples, )\n        An array of core distances for all points\n\n    cluster_map : dict\n        A dictionary mapping cluster numbers in the condensed tree to labels\n        in the final selected clustering.\n\n    max_lambdas : dict\n        A dictionary mapping cluster numbers in the condensed tree to the\n        maximum lambda value seen in that cluster.\n\n    min_samples : int\n        The min_samples value used to generate core distances.\n    '
    raw_tree = tree._raw_tree
    tree_root = cluster_tree['parent'].min()
    (nearest_neighbor, lambda_) = _find_neighbor_and_lambda(neighbor_indices, neighbor_distances, core_distances, min_samples)
    neighbor_tree_row = get_tree_row_with_child(raw_tree, nearest_neighbor)
    potential_cluster = neighbor_tree_row['parent']
    if (neighbor_tree_row['lambda_val'] > lambda_):
        while ((potential_cluster > tree_root) and (cluster_tree['lambda_val'][(cluster_tree['child'] == potential_cluster)] >= lambda_)):
            potential_cluster = cluster_tree['parent'][(cluster_tree['child'] == potential_cluster)][0]
    if (potential_cluster in cluster_map):
        cluster_label = cluster_map[potential_cluster]
    else:
        cluster_label = (- 1)
    if (cluster_label >= 0):
        max_lambda = max_lambdas[potential_cluster]
        if (max_lambda > 0.0):
            lambda_ = min(max_lambda, lambda_)
            prob = (lambda_ / max_lambda)
        else:
            prob = 1.0
    else:
        prob = 0.0
    return (cluster_label, prob)
Return the cluster label (of the original clustering) and membership
probability of a new data point.

Parameters
----------
tree : CondensedTree
    The condensed tree associated with the clustering.

cluster_tree : structured_array
    The raw form of the condensed tree with only cluster information (no
    data on individual points). This is significantly more compact.

neighbor_indices : array (2 * min_samples, )
    An array of raw distance based nearest neighbor indices.

neighbor_distances : array (2 * min_samples, )
    An array of raw distances to the nearest neighbors.

core_distances : array (n_samples, )
    An array of core distances for all points

cluster_map : dict
    A dictionary mapping cluster numbers in the condensed tree to labels
    in the final selected clustering.

max_lambdas : dict
    A dictionary mapping cluster numbers in the condensed tree to the
    maximum lambda value seen in that cluster.

min_samples : int
    The min_samples value used to generate core distances.
def _find_cluster_and_probability(tree, cluster_tree, neighbor_indices, neighbor_distances, core_distances, cluster_map, max_lambdas, min_samples):
    '\n    Return the cluster label (of the original clustering) and membership\n    probability of a new data point.\n\n    Parameters\n    ----------\n    tree : CondensedTree\n        The condensed tree associated with the clustering.\n\n    cluster_tree : structured_array\n        The raw form of the condensed tree with only cluster information (no\n        data on individual points). This is significantly more compact.\n\n    neighbor_indices : array (2 * min_samples, )\n        An array of raw distance based nearest neighbor indices.\n\n    neighbor_distances : array (2 * min_samples, )\n        An array of raw distances to the nearest neighbors.\n\n    core_distances : array (n_samples, )\n        An array of core distances for all points\n\n    cluster_map : dict\n        A dictionary mapping cluster numbers in the condensed tree to labels\n        in the final selected clustering.\n\n    max_lambdas : dict\n        A dictionary mapping cluster numbers in the condensed tree to the\n        maximum lambda value seen in that cluster.\n\n    min_samples : int\n        The min_samples value used to generate core distances.\n    '
    raw_tree = tree._raw_tree
    tree_root = cluster_tree['parent'].min()
    (nearest_neighbor, lambda_) = _find_neighbor_and_lambda(neighbor_indices, neighbor_distances, core_distances, min_samples)
    neighbor_tree_row = get_tree_row_with_child(raw_tree, nearest_neighbor)
    potential_cluster = neighbor_tree_row['parent']
    if (neighbor_tree_row['lambda_val'] > lambda_):
        while ((potential_cluster > tree_root) and (cluster_tree['lambda_val'][(cluster_tree['child'] == potential_cluster)] >= lambda_)):
            potential_cluster = cluster_tree['parent'][(cluster_tree['child'] == potential_cluster)][0]
    if (potential_cluster in cluster_map):
        cluster_label = cluster_map[potential_cluster]
    else:
        cluster_label = (- 1)
    if (cluster_label >= 0):
        max_lambda = max_lambdas[potential_cluster]
        if (max_lambda > 0.0):
            lambda_ = min(max_lambda, lambda_)
            prob = (lambda_ / max_lambda)
        else:
            prob = 1.0
    else:
        prob = 0.0
    return (cluster_label, prob)