How to build an encoder using a distance matrix


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?


Posted 2018-02-18T14:59:58.727

Reputation: 123

Why you cannot just use the row as representation (e.g. a=[0, 1, 2], b=[1, 0 3], etc). – Vincenzo Lavorini – 2018-02-18T15:24:06.923

Because the Euclidean distance between [0,1,2] and [1,0,3] does not equal 1 – kPow989 – 2018-02-18T15:54:01.067

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 – Vincenzo Lavorini – 2018-02-18T17:12:32.443



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.


Posted 2018-02-18T14:59:58.727

Reputation: 2 301

1Why your answer has been accepted without upvote? here we go – Media – 2018-02-18T19:21:28.677

1@Media to the rescue – Imran – 2018-02-18T19:22:30.127

@Media apologies...I'm new to this exchange and so don't have sufficient points to upvote – kPow989 – 2018-02-21T06:49:11.920

dear @kPow989 it was just kidding to make laugh :D – Media – 2018-02-21T15:53:52.530