Classical Multidimensional Scaling¶
In general, Multidimensional Scaling (MDS) refers to techniques that transforms samples into lower dimensional space while preserving the inter-sample distances as well as possible.
Overview of Classical MDS¶
Classical MDS is a specific technique in this family that accomplishes the embedding in two steps:
Convert the distance matrix to a Gram matrix.
This conversion is based on the following relations between a distance matrix
Dand a Gram matrixG:
Here,
indicates the element-wise square of
, and
is the diagonal elements of
. This relation is
itself based on the following decomposition of squared Euclidean distance:
Perform eigenvalue decomposition of the Gram matrix to derive the coordinates.
Functions¶
This package provides functions related to classical MDS.
-
gram2dmat(G)¶ Convert a Gram matrix
Gto a distance matrix.
-
gram2dmat!(D, G) Convert a Gram matrix
Gto a distance matrix, and write the results toD.
-
dmat2gram(D)¶ Convert a distance matrix
Dto a Gram matrix.
-
dmat2gram!(G, D) Convert a distance matrix
Dto a Gram matrix, and write the results toG.
-
classical_mds(D, p[, dowarn=true])¶ Perform classical MDS. This function derives a
p-dimensional embedding based on a given distance matrixD.It returns a coordinate matrix of size
(p, n), where each column is the coordinates for an observation.Note
The Gramian derived from
Dmay have nonpositive or degenerate eigenvalues. The subspace of nonpositive eigenvalues is projected out of the MDS solution so that the strain function is minimized in a least-squares sense. If the smallest remaining eigenvalue that is used for the MDS is degenerate, then the solution is not unique, as any linear combination of degenerate eigenvectors will also yield a MDS solution with the same strain value. By default, warnings are emitted if either situation is detected, which can be suppressed withdowarn=false.If the MDS uses an eigenspace of dimension
mless thanp, then the MDS coordinates will be padded withp-mzeros each.Reference:
@inbook{Borg2005, Author = {Ingwer Borg and Patrick J. F. Groenen}, Title = {Modern Multidimensional Scaling: Theory and Applications}, Edition = {2}, Year = {2005}, Chapter = {12}, Doi = {10.1007/0-387-28981-X}, Pages = {201--268}, Series = {Springer Series in Statistics}, Publisher = {Springer}, }