how to add/remove data points to/from a scikit-lea

2019-05-11 03:50发布

问题:

I am wondering if it is possible to add or remove data points from a scikit-lern KD-Tree instance after its creation ?

For example:

from sklearn.neighbors import KDTree
import numpy as np
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
kdt = KDTree(X, leaf_size=30, metric='euclidean')

'''
Do another stuff

'''
# Then, I want to add [8,3] point to kdt without rebuilding it again
# How to remove [-2,-1] from kdt ?

I did not find such information in the KD-Tree documentation