smile.mds

## Class MDS

• java.lang.Object
• smile.mds.MDS

• ```public class MDS
extends java.lang.Object```
Classical multidimensional scaling, also known as principal coordinates analysis. Given a matrix of dissimilarities (e.g. pairwise distances), MDS finds a set of points in low dimensional space that well-approximates the dissimilarities in A. We are not restricted to using a Euclidean distance metric. However, when Euclidean distances are used MDS is equivalent to PCA.
`PCA`, `SammonMapping`
• ### Constructor Summary

Constructors
Constructor and Description
`MDS(double[][] proximity)`
Constructor.
```MDS(double[][] proximity, int k)```
Constructor.
```MDS(double[][] proximity, int k, boolean add)```
Constructor.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double[][]` `getCoordinates()`
Returns the principal coordinates of projected data.
`double[]` `getEigenValues()`
Returns the component scores, ordered from largest to smallest.
`double[]` `getProportion()`
Returns the proportion of variance contained in each eigenvectors, ordered from largest to smallest.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MDS

`public MDS(double[][] proximity)`
Constructor. Learn the classical multidimensional scaling. Map original data into 2-dimensional Euclidean space.
Parameters:
`proximity` - the nonnegative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric. For pairwise distances matrix, it should be just the plain distance, not squared.
• #### MDS

```public MDS(double[][] proximity,
int k)```
Constructor. Learn the classical multidimensional scaling.
Parameters:
`proximity` - the nonnegative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric. For pairwise distances matrix, it should be just the plain distance, not squared.
`k` - the dimension of the projection.
• #### MDS

```public MDS(double[][] proximity,
int k,
Constructor. Learn the classical multidimensional scaling.
Parameters:
`proximity` - the nonnegative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric. For pairwise distances matrix, it should be just the plain distance, not squared.
`k` - the dimension of the projection.
`add` - true to estimate an appropriate constant to be added to all the dissimilarities, apart from the self-dissimilarities, that makes the learning matrix positive semi-definite. The other formulation of the additive constant problem is as follows. If the proximity is measured in an interval scale, where there is no natural origin, then there is not a sympathy of the dissimilarities to the distances in the Euclidean space used to represent the objects. In this case, we can estimate a constant c such that proximity + c may be taken as ratio data, and also possibly to minimize the dimensionality of the Euclidean space required for representing the objects.
• ### Method Detail

• #### getEigenValues

`public double[] getEigenValues()`
Returns the component scores, ordered from largest to smallest.
• #### getProportion

`public double[] getProportion()`
Returns the proportion of variance contained in each eigenvectors, ordered from largest to smallest.
• #### getCoordinates

`public double[][] getCoordinates()`
Returns the principal coordinates of projected data.