Class MDS

java.lang.Object
smile.manifold.MDS

public class MDS extends 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. We are not restricted to using Euclidean distance metric. However, when Euclidean distances are used MDS is equivalent to PCA.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double[][]
    The principal coordinates.
    final double[]
    The proportion of variance contained in each principal component.
    final double[]
    The component scores.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MDS(double[] scores, double[] proportion, double[][] coordinates)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static MDS
    of(double[][] proximity)
    Fits the classical multidimensional scaling.
    static MDS
    of(double[][] proximity, int k)
    Fits the classical multidimensional scaling.
    static MDS
    of(double[][] proximity, int k, boolean positive)
    Fits the classical multidimensional scaling.
    static MDS
    of(double[][] proximity, Properties params)
    Fits the classical multidimensional scaling.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • scores

      public final double[] scores
      The component scores.
    • coordinates

      public final double[][] coordinates
      The principal coordinates.
    • proportion

      public final double[] proportion
      The proportion of variance contained in each principal component.
  • Constructor Details

    • MDS

      public MDS(double[] scores, double[] proportion, double[][] coordinates)
      Constructor.
      Parameters:
      scores - the component scores.
      proportion - the proportion of variance contained in each principal component.
      coordinates - the principal coordinates
  • Method Details

    • of

      public static MDS of(double[][] proximity)
      Fits the classical multidimensional scaling. Map original data into 2-dimensional Euclidean space.
      Parameters:
      proximity - the non-negative 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.
      Returns:
      the model.
    • of

      public static MDS of(double[][] proximity, int k)
      Fits the classical multidimensional scaling.
      Parameters:
      proximity - the non-negative 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.
      Returns:
      the model.
    • of

      public static MDS of(double[][] proximity, Properties params)
      Fits the classical multidimensional scaling.
      Parameters:
      proximity - the non-negative 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.
      params - the hyperparameters.
      Returns:
      the model.
    • of

      public static MDS of(double[][] proximity, int k, boolean positive)
      Fits the classical multidimensional scaling.
      Parameters:
      proximity - the non-negative 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.
      positive - if true, 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.
      Returns:
      the model.