# Why is a 2D->2D tSNE transformation not idempotent (up to random influences)?

My understanding of tSNE is that probability distributions are optimized in a way to maintain Euclidean (by default) distances (on average) when transforming from the input to the output space. If that is the case, when transforming from 2D to another 2D space, wouldn't the identity transformation be the ideal tSNE? I know that tSNE transformation is a somewhat random process, but I'd expect distances to be maintained generally.

By contrast, when applying a tSNE to the following data, the result has a very different distribution of distances. Note in particular the distribution of red dots:

Input

Output

This example has been produced using

from sklearn.manifold import TSNE
tsne = TSNE(random_state=1).fit_transform(data)

• Have you looked at your distances matrices ? It is fairly possible that two differents looking graphes have similar distance matrices. – lcrmorin Oct 28 '20 at 9:42
• tSNE does not preserve distance, here is a good blog that presents various experiments with t-SNE : distill.pub/2016/misread-tsne – mprouveur Oct 28 '20 at 15:10
• @mprouveur thanks, that's a good read! "The t-SNE algorithm adapts its notion of “distance” to regional density variations in the data set. As a result, it naturally expands dense clusters, and contracts sparse ones, evening out cluster sizes." – bers Oct 28 '20 at 21:42