'Predict the class labels for the provided data
Parameters
X : array-like, shape (n_query, n_features),                 or (n_query, n_indexed) if metric == \'precomputed\'
Test samples.
Returns
y : array of shape [n_samples] or [n_samples, n_outputs]
Class labels for each data sample.'

def predict(self, X):

    X = check_array(X, accept_sparse='csr')
    n_samples = X.shape[0]
    (neigh_dist, neigh_ind) = self.radius_neighbors(X)
    inliers = [i for (i, nind) in enumerate(neigh_ind) if (len(nind) != 0)]
    outliers = [i for (i, nind) in enumerate(neigh_ind) if (len(nind) == 0)]
    classes_ = self.classes_
    _y = self._y
    if (not self.outputs_2d_):
        _y = self._y.reshape(((-1), 1))
        classes_ = [self.classes_]
    n_outputs = len(classes_)
    if (self.outlier_label is not None):
        neigh_dist[outliers] = 1e-06
    elif outliers:
        raise ValueError(('No    neighbors    found    for    test    samples    %r,    you    can    try    using    larger    radius,    give    a    label    for    outliers,    or    consider    removing    them    from    your    dataset.' % outliers))
    weights = _get_weights(neigh_dist, self.weights)
    y_pred = np.empty((n_samples, n_outputs), dtype=classes_[0].dtype)
    for (k, classes_k) in enumerate(classes_):
        pred_labels = np.zeros(len(neigh_ind), dtype=object)
        pred_labels[:] = [_y[(ind, k)] for ind in neigh_ind]
        if (weights is None):
            mode = np.array([stats.mode(pl)[0] for pl in pred_labels[inliers]], dtype=np.int)
        else:
            mode = np.array([weighted_mode(pl, w)[0] for (pl, w) in zip(pred_labels[inliers], weights[inliers])], dtype=np.int)
        mode = mode.ravel()
        y_pred[(inliers, k)] = classes_k.take(mode)
    if outliers:
        y_pred[outliers, :] = self.outlier_label
    if (not self.outputs_2d_):
        y_pred = y_pred.ravel()
    return y_pred
