def approximate_predict(clusterer, points_to_predict):
    "Predict the cluster label of new points. The returned labels\n    will be those of the original clustering found by ``clusterer``,\n    and therefore are not (necessarily) the cluster labels that would\n    be found by clustering the original data combined with\n    ``points_to_predict``, hence the 'approximate' label.\n\n    If you simply wish to assign new points to an existing clustering\n    in the 'best' way possible, this is the function to use. If you\n    want to predict how ``points_to_predict`` would cluster with\n    the original data under HDBSCAN the most efficient existing approach\n    is to simply recluster with the new point(s) added to the original dataset.\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    labels : array (n_samples,)\n        The predicted labels of the ``points_to_predict``\n\n    probabilities : array (n_samples,)\n        The soft cluster scores for each of the ``points_to_predict``\n\n    See Also\n    --------\n    :py:func:`hdbscan.predict.membership_vector`\n    :py:func:`hdbscan.predict.all_points_membership_vectors`\n\n    "
    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.int)
    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)
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`
def approximate_predict(clusterer, points_to_predict):
    "Predict the cluster label of new points. The returned labels\n    will be those of the original clustering found by ``clusterer``,\n    and therefore are not (necessarily) the cluster labels that would\n    be found by clustering the original data combined with\n    ``points_to_predict``, hence the 'approximate' label.\n\n    If you simply wish to assign new points to an existing clustering\n    in the 'best' way possible, this is the function to use. If you\n    want to predict how ``points_to_predict`` would cluster with\n    the original data under HDBSCAN the most efficient existing approach\n    is to simply recluster with the new point(s) added to the original dataset.\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    labels : array (n_samples,)\n        The predicted labels of the ``points_to_predict``\n\n    probabilities : array (n_samples,)\n        The soft cluster scores for each of the ``points_to_predict``\n\n    See Also\n    --------\n    :py:func:`hdbscan.predict.membership_vector`\n    :py:func:`hdbscan.predict.all_points_membership_vectors`\n\n    "
    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.int)
    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)