Re: Distributing n points in space



On Jun 11, 4:02 pm, Robert Israel
<isr...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have n points i don't have any coordinates, only thing i have is
distance matrix por each pair of points distance from one to the
other, i want to put them all in k<n dimensional space, it is probably
impossible to do it precisly what i want is to distribiute points in
space in in the way that minimize sum of diference between proper
distance and the real one. Is there any solution of this, does the
problem have any official name?

Consider the Gram matrix G:
G_{ij} = (x_i).(x_j)
G must be positive semidefinite. The n x n positive semidefinite matrix G
is the Gram matrix for n points of R^k if and only if G has rank <= k, and
these points can be obtained using the diagonalization of G. If G has some
negative eigenvalues or rank > k, the best approximation, in some sense,
is obtained by using the (up to) k largest positive eigenvalues and
eigenvectors.

Now given the distance matrix D:
D_{ij} = |x_i - x_j|
we can designate one of the points (say x_n) as the origin, and then
G_{ij} = (D_{in}^2 + D_{jn}^2 - D_{ij}^2)/2

For example, suppose you have the 4 x 4 distance matrix
[ 0 2 2 3]
[ 2 0 3 2]
D = [ 2 3 0 1]
[ 3 2 1 0]

and you want k=2. This leads to

[ 9 4.5 3 0 ]
[ 4.5 4 -2 0 ]
G = [ 3 -2 1 0 ]
[ 0 0 0 0 ]

which has a negative eigenvalue. If lambda_1 and lambda_2 are the two
positive eigenvalues and u_1 and u_2 the corresponding orthonormal
eigenvectors, then we take the points of R^2 corresponding to the
rows of the matrix with columns sqrt(lambda_1) u_1 and sqrt(lambda_2) u_2,
namely

[-3.01692215332068070, .520107363143339496],
[-1.58230163082378516, -1.45887821879530888],
[-.540150726393245684, 1.36862161370595770],
[0., 0.]

which would have the distance matrix
[0. 2.444283121 2.618085777 3.061426293]
[2.444283121 0. 3.013442187 2.152209123]
[2.618085777 3.013442187 0. 1.471355813]
[3.061426293 2.152209123 1.471355813 0. ]
--
Robert Israel isr...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada

The fit will sometimes be slightly better if you take the origin at
the centroid. To do this, let G be -.5 times the double-centered
matrix of squared distances; i.e.,
G_{i,j} = -.5 * ( DD_{i,j} - DD_{i,.} - DD_{.,j} + DD_{.,.} ),
where DD contains the squared distances,
and a "." denotes averaging over the corresponding index.

For the example data, the recovered distances in 2 dimensions are

0. 2.22918 2.30898 3.00478
2.22918 0. 3.00478 2.30898
2.30898 3.00478 0. 1.65858
3.00478 2.30898 1.65858 0.
.



Relevant Pages

  • Re: Understanding Array indexing and the find command
    ... % diagonal of DM are zero, DM may not necessary symetric (distance from a to ... so i can get the total tour distance from the distance matrix, DM, by ... or the maximum distance between two stops as, ...
    (comp.soft-sys.matlab)
  • Re: Finding similar entries
    ... then you don't need the interpoint distance ... the huge interpoint distance matrix. ... also for free at least in SOM toolbox ...
    (comp.soft-sys.matlab)
  • Re: fast curve similarity needed
    ... For a cuve defined by N points, the distance matrix would be the NxN array of all the pairwise distances. ... The distance matrix is invariant under rotations of the curve, and by normalizing the distances you can make it invariant under uniform scaling as well. ... The functions should have the option to match curves regardless of rotation in 3D space, and be preferably invariant in terms of uniform scale as well. ...
    (comp.graphics.algorithms)
  • Re: Looking for "diff" algorithm.
    ... > I'm looking for an implementation of a difference algorithm. ... Google for "minimal edit distance". ... where lev_matrix calculates the distance matrix. ...
    (comp.lang.prolog)
  • Re: Maximum relative error in Multidimensional sca
    ... yes, it's a bit non-euclidean, but the magnitudes of the negative ... > "D need not be a Euclidean distance matrix. ... > and CMDSCALE chooses p as the number of positive eigenvalues. ...
    (comp.soft-sys.matlab)