mdsj

Class ClassicalScaling


public class ClassicalScaling
extends java.lang.Object

The classical version of Multidimensional Scaling. Input is a set of n objects and some or all possible dissimilarities between them, given as nonnegative doubles; the smaller dissimilarity i,j the more similar and proximate are object i and object j. Output is a configuration of all n objects in a low-dimensional space such that the Euclidean distance between two objects is similar to the given dissimilarity between the two objects. In classical scaling the input matrix is slightly transformed and decomposed spectrally, i.e., the largest eigenvectors are computed and used as coordinates. These coordinates are optimal in a certain sense, by minimizing the mismatch between the inner products derived from the input and the inner products derived from the coordinates. See Torgerson, W. S. Multidimensional scaling: I Theory and method. Psychometrika, 1952, 17, 401-419

Method Summary

static void
eigen(double[][] matrix, double[][] evecs, double[] evals)
Computes the dominant eigenvectors of a square symmetric matrix.
static double[]
fullmds(double[][] distances, double[][] result)
Computes a classical multidimensional scaling of a square matrix of distances.
static double
largestEigenvalue(double[][] matrix)
Computes the largest eigenvalue of a given square symmetric matrix.
static double[]
lmds(double[][] P, double[][] result)
Computes an approximation of classical multidimensional scaling for a given matrix of dissimilarities.
static double[]
pivotmds(double[][] input, double[][] result)
Computes an approximation of classical multidimensional scaling for a given matrix of dissimilarities.
static double
smallestEigenvalue(double[][] matrix)
Computes the smallest eigenvalue of a given square symmetric matrix.

Method Details

eigen

public static void eigen(double[][] matrix,
                         double[][] evecs,
                         double[] evals)
Computes the dominant eigenvectors of a square symmetric matrix. The number of desired output dimensions is determined by evecs.length, which should equal evals.length. The matrix is modified over the course of the computation.
Parameters:
matrix - the matrix to be decomposed
evecs - the eigenvectors of the matrix
evals - the eigenvalues of the matrix

fullmds

public static double[] fullmds(double[][] distances,
                               double[][] result)
Computes a classical multidimensional scaling of a square matrix of distances. The number of dimensions is determined by result.length. This minimizes the strain criterion. See Torgerson, Multidimensional scaling: I. Theory and Method. Psychometrika 17:401-419, 1952.
Parameters:
distances - square matrix of square dissimilarities
result - the low-dimensional configuration

largestEigenvalue

public static double largestEigenvalue(double[][] matrix)
Computes the largest eigenvalue of a given square symmetric matrix.
Parameters:
matrix - a square symmetric matrix
Returns:
the smallest eigenvalue

lmds

public static double[] lmds(double[][] P,
                            double[][] result)
Computes an approximation of classical multidimensional scaling for a given matrix of dissimilarities. See V. de Silva, J.B. Tenenbaum, Sparse multidimensional scaling using landmark points.
Parameters:
result - matrix of positions
Returns:
eigenvalues of the landmark matrix

pivotmds

public static double[] pivotmds(double[][] input,
                                double[][] result)
Computes an approximation of classical multidimensional scaling for a given matrix of dissimilarities. It is based on decomposing a rectangular subset of the matrix columns of the complete dissimilarity matrix. See U. Brandes and C. Pich: Eigensolver Methods for Progressive Multidimensional Scaling of Large Data. Proc. 14th Intl. Symp. Graph Drawing (GD '06). LNCS 4372, pp. 42-53.
Parameters:
input - matrix of squared dissimilarities
result - matrix of low-dimensional coordinates

smallestEigenvalue

public static double smallestEigenvalue(double[][] matrix)
Computes the smallest eigenvalue of a given square symmetric matrix.
Parameters:
matrix - a square symmetric matrix
Returns:
the smallest eigenvalue