Record Class MDS

Record Components:
scores - the component scores.
proportion - the proportion of variance contained in each principal component.
coordinates - the principal coordinates

public record MDS(double[] scores, double[] proportion, double[][] coordinates) extends Record
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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    MDS(double[] scores, double[] proportion, double[][] coordinates)
    Creates an instance of a MDS record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[][]
    Returns the value of the coordinates record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    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.
    double[]
    Returns the value of the proportion record component.
    double[]
    Returns the value of the scores record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MDS

      public MDS(double[] scores, double[] proportion, double[][] coordinates)
      Creates an instance of a MDS record class.
      Parameters:
      scores - the value for the scores record component
      proportion - the value for the proportion record component
      coordinates - the value for the coordinates record component
  • 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.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • scores

      public double[] scores()
      Returns the value of the scores record component.
      Returns:
      the value of the scores record component
    • proportion

      public double[] proportion()
      Returns the value of the proportion record component.
      Returns:
      the value of the proportion record component
    • coordinates

      public double[][] coordinates()
      Returns the value of the coordinates record component.
      Returns:
      the value of the coordinates record component