Record Class SammonMapping

java.lang.Object
java.lang.Record
smile.manifold.SammonMapping
Record Components:
stress - the objective function value.
coordinates - the principal coordinates

public record SammonMapping(double stress, double[][] coordinates) extends Record
The Sammon's mapping is an iterative technique for making interpoint distances in the low-dimensional projection as close as possible to the interpoint distances in the high-dimensional object. Two points close together in the high-dimensional space should appear close together in the projection, while two points far apart in the high dimensional space should appear far apart in the projection. The Sammon's mapping is a special case of metric least-square multidimensional scaling.

Ideally when we project from a high dimensional space to a low dimensional space the image would be geometrically congruent to the original figure. This is called an isometric projection. Unfortunately it is rarely possible to isometrically project objects down into lower dimensional spaces. Instead of trying to achieve equality between corresponding inter-point distances we can minimize the difference between corresponding inter-point distances. This is one goal of the Sammon's mapping algorithm. A second goal of the Sammon's mapping algorithm is to preserve the topology as good as possible by giving greater emphasize to smaller interpoint distances. The Sammon's mapping algorithm has the advantage that whenever it is possible to isometrically project an object into a lower dimensional space it will be isometrically projected into the lower dimensional space. But whenever an object cannot be projected down isometrically the Sammon's mapping projects it down to reduce the distortion in interpoint distances and to limit the change in the topology of the object.

The projection cannot be solved in a closed form and may be found by an iterative algorithm such as gradient descent suggested by Sammon. Kohonen also provides a heuristic that is simple and works reasonably well.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    SammonMapping(double stress, double[][] coordinates)
    Creates an instance of a SammonMapping 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.
    of(double[][] proximity)
    Fits Sammon's mapping with default k = 2, lambda = 0.2, tolerance = 1E-4 and maxIter = 100.
    of(double[][] proximity, double[][] init, double lambda, double tol, double stepTol, int maxIter)
    Fits Sammon's mapping.
    of(double[][] proximity, int k)
    Fits Sammon's mapping.
    of(double[][] proximity, int k, double lambda, double tol, double stepTol, int maxIter)
    Fits Sammon's mapping.
    of(double[][] proximity, Properties params)
    Fits Sammon's mapping.
    double
    Returns the value of the stress 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

    • SammonMapping

      public SammonMapping(double stress, double[][] coordinates)
      Creates an instance of a SammonMapping record class.
      Parameters:
      stress - the value for the stress record component
      coordinates - the value for the coordinates record component
  • Method Details

    • of

      public static SammonMapping of(double[][] proximity)
      Fits Sammon's mapping with default k = 2, lambda = 0.2, tolerance = 1E-4 and maxIter = 100.
      Parameters:
      proximity - the non-negative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric.
      Returns:
      the model.
    • of

      public static SammonMapping of(double[][] proximity, int k)
      Fits Sammon's mapping.
      Parameters:
      proximity - the non-negative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric.
      k - the dimension of the projection.
      Returns:
      the model.
    • of

      public static SammonMapping of(double[][] proximity, Properties params)
      Fits Sammon's mapping.
      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 SammonMapping of(double[][] proximity, int k, double lambda, double tol, double stepTol, int maxIter)
      Fits Sammon's mapping.
      Parameters:
      proximity - the non-negative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric.
      k - the dimension of the projection.
      lambda - initial value of the step size constant in diagonal Newton method.
      tol - the tolerance on objective function for stopping iterations.
      stepTol - the tolerance on step size.
      maxIter - maximum number of iterations.
      Returns:
      the model.
    • of

      public static SammonMapping of(double[][] proximity, double[][] init, double lambda, double tol, double stepTol, int maxIter)
      Fits Sammon's mapping.
      Parameters:
      proximity - the non-negative proximity matrix of dissimilarities. The diagonal should be zero and all other elements should be positive and symmetric.
      init - the initial projected coordinates, of which the column size is the projection dimension. It will be modified.
      lambda - initial value of the step size constant in diagonal Newton method.
      tol - the tolerance for stopping iterations.
      stepTol - the tolerance on step size.
      maxIter - maximum number of iterations.
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • stress

      public double stress()
      Returns the value of the stress record component.
      Returns:
      the value of the stress record component
    • coordinates

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