Adding new points to the t-SNE model

2019-06-25 14:18发布

问题:

I try to use t-SNE algorithm in the scikit-learn:

import numpy as np
from sklearn.manifold import TSNE
X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
model = TSNE(n_components=2, random_state=0)
np.set_printoptions(suppress=True)
model.fit_transform(X) 

Output:

array([[ 0.00017599,  0.00003993], #1
       [ 0.00009891,  0.00021913], 
       [ 0.00018554, -0.00009357],
       [ 0.00009528, -0.00001407]]) #2

After that I try to add some points with the coordinates exactly like in the first array X to the existing model:

Y = np.array([[0, 0, 0], [1, 1, 1]])
model.fit_transform(Y) 

Output:

array([[ 0.00017882,  0.00004002], #1
       [ 0.00009546,  0.00022409]]) #2

But coords in the second array not equal to the first and last coords from the first array.

I understand that this is the right behaviour, but how can I add new coords to the model and get the same coords in the output array for the same coords in the input array?

Also I still need to get closest points even after appending new points.