I have a similarity/distance matrix:

   a | b | c
 a 0 | 1 | 2
 b 1 | 0 | 3
 c 2 | 3 | 0

I want to build an encoder/model that learns an n-dimensional representation of each of the points in the dataset s.t. the euclidean-difference between the representations produces the difference provided in the matrix, e.g. distance(a,b) = 1 etc.

Any ideas?

  • $\begingroup$ Why you cannot just use the row as representation (e.g. a=[0, 1, 2], b=[1, 0 3], etc). $\endgroup$ Feb 18, 2018 at 15:24
  • $\begingroup$ Because the Euclidean distance between [0,1,2] and [1,0,3] does not equal 1 $\endgroup$
    – kPow989
    Feb 18, 2018 at 15:54
  • $\begingroup$ But if you impose a distance between two of those vectors the other will result as scaled. If you want that the difference between any two of those vectors to be equal to one, than you loose information on the real distance between them, so there is no point in starting from that matrix $\endgroup$ Feb 18, 2018 at 17:12

1 Answer 1


This is essentially what t-SNE does. It supports transforming data from any input dimension to any output dimension, and it tries to preserve distances between all pairs of points.

From the author's website:

Can I use a pairwise Euclidean distance matrix as input into t-SNE?

Yes you can! Download the Matlab implementation, and use your pairwise Euclidean distance matrix as input into the tsne_d.m function.

  • 1
    $\begingroup$ Why your answer has been accepted without upvote? here we go $\endgroup$ Feb 18, 2018 at 19:21
  • 1
    $\begingroup$ @Media to the rescue $\endgroup$
    – Imran
    Feb 18, 2018 at 19:22
  • $\begingroup$ @Media apologies...I'm new to this exchange and so don't have sufficient points to upvote $\endgroup$
    – kPow989
    Feb 21, 2018 at 6:49
  • $\begingroup$ dear @kPow989 it was just kidding to make laugh :D $\endgroup$ Feb 21, 2018 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.