def membership_vector(clusterer, points_to_predict):
    'Predict soft cluster membership. The result produces a vector\n    for each point in ``points_to_predict`` that gives a probability that\n    the given point is a member of a cluster for each of the selected clusters\n    of the ``clusterer``.\n\n    Parameters\n    ----------\n    clusterer : HDBSCAN\n        A clustering object that has been fit to the data and\n        either had ``prediction_data=True`` set, or called the\n        ``generate_prediction_data`` method after the fact.\n\n    points_to_predict : array, or array-like (n_samples, n_features)\n        The new data points to predict cluster labels for. They should\n        have the same dimensionality as the original dataset over which\n        clusterer was fit.\n\n    Returns\n    -------\n    membership_vectors : array (n_samples, n_clusters)\n        The probability that point ``i`` is a member of cluster ``j`` is\n        in ``membership_vectors[i, j]``.\n\n    See Also\n    --------\n    :py:func:`hdbscan.predict.predict`\n    :py:func:`hdbscan.predict.all_points_membership_vectors`\n'
    clusters = np.array(sorted(list(clusterer.condensed_tree_._select_clusters()))).astype(np.intp)
    result = np.empty((points_to_predict.shape[0], clusters.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]):
        (nearest_neighbor, lambda_) = _find_neighbor_and_lambda(neighbor_indices[i], neighbor_distances[i], clusterer.prediction_data_.core_distances, min_samples)
        neighbor_tree_row = get_tree_row_with_child(clusterer.condensed_tree_._raw_tree, nearest_neighbor)
        if (neighbor_tree_row['lambda_val'] <= lambda_):
            lambda_ = neighbor_tree_row['lambda_val']
        distance_vec = dist_membership_vector(points_to_predict[i], clusterer.prediction_data_.exemplars, clusterer.prediction_data_.dist_metric)
        outlier_vec = outlier_membership_vector(nearest_neighbor, lambda_, clusters, clusterer.condensed_tree_._raw_tree, clusterer.prediction_data_.leaf_max_lambdas, clusterer.prediction_data_.cluster_tree)
        result[i] = ((distance_vec ** 0.5) * (outlier_vec ** 2.0))
        result[i] /= result[i].sum()
        result[i] *= prob_in_some_cluster(nearest_neighbor, lambda_, clusters, clusterer.condensed_tree_._raw_tree, clusterer.prediction_data_.leaf_max_lambdas, clusterer.prediction_data_.cluster_tree)
    return result
Predict soft cluster membership. The result produces a vector
for each point in ``points_to_predict`` that gives a probability that
the given point is a member of a cluster for each of the selected clusters
of the ``clusterer``.

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
-------
membership_vectors : array (n_samples, n_clusters)
    The probability that point ``i`` is a member of cluster ``j`` is
    in ``membership_vectors[i, j]``.

See Also
--------
:py:func:`hdbscan.predict.predict`
:py:func:`hdbscan.predict.all_points_membership_vectors`
def membership_vector(clusterer, points_to_predict):
    'Predict soft cluster membership. The result produces a vector\n    for each point in ``points_to_predict`` that gives a probability that\n    the given point is a member of a cluster for each of the selected clusters\n    of the ``clusterer``.\n\n    Parameters\n    ----------\n    clusterer : HDBSCAN\n        A clustering object that has been fit to the data and\n        either had ``prediction_data=True`` set, or called the\n        ``generate_prediction_data`` method after the fact.\n\n    points_to_predict : array, or array-like (n_samples, n_features)\n        The new data points to predict cluster labels for. They should\n        have the same dimensionality as the original dataset over which\n        clusterer was fit.\n\n    Returns\n    -------\n    membership_vectors : array (n_samples, n_clusters)\n        The probability that point ``i`` is a member of cluster ``j`` is\n        in ``membership_vectors[i, j]``.\n\n    See Also\n    --------\n    :py:func:`hdbscan.predict.predict`\n    :py:func:`hdbscan.predict.all_points_membership_vectors`\n'
    clusters = np.array(sorted(list(clusterer.condensed_tree_._select_clusters()))).astype(np.intp)
    result = np.empty((points_to_predict.shape[0], clusters.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]):
        (nearest_neighbor, lambda_) = _find_neighbor_and_lambda(neighbor_indices[i], neighbor_distances[i], clusterer.prediction_data_.core_distances, min_samples)
        neighbor_tree_row = get_tree_row_with_child(clusterer.condensed_tree_._raw_tree, nearest_neighbor)
        if (neighbor_tree_row['lambda_val'] <= lambda_):
            lambda_ = neighbor_tree_row['lambda_val']
        distance_vec = dist_membership_vector(points_to_predict[i], clusterer.prediction_data_.exemplars, clusterer.prediction_data_.dist_metric)
        outlier_vec = outlier_membership_vector(nearest_neighbor, lambda_, clusters, clusterer.condensed_tree_._raw_tree, clusterer.prediction_data_.leaf_max_lambdas, clusterer.prediction_data_.cluster_tree)
        result[i] = ((distance_vec ** 0.5) * (outlier_vec ** 2.0))
        result[i] /= result[i].sum()
        result[i] *= prob_in_some_cluster(nearest_neighbor, lambda_, clusters, clusterer.condensed_tree_._raw_tree, clusterer.prediction_data_.leaf_max_lambdas, clusterer.prediction_data_.cluster_tree)
    return result