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:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    MDS hyperparameters.
  • 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.
    static MDS
    fit(double[][] proximity)
    Fits the classical multidimensional scaling.
    static MDS
    fit(double[][] proximity, MDS.Options options)
    Fits the classical multidimensional scaling.
    final int
    Returns a hash code value for this object.
    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

    • fit

      public static MDS fit(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.
    • fit

      public static MDS fit(double[][] proximity, MDS.Options options)
      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.
      options - the hyperparameters.
      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