Package smile.manifold
Record Class MDS
java.lang.Object
java.lang.Record
smile.manifold.MDS
- Record Components:
scores
- the component scores.proportion
- the proportion of variance contained in each principal component.coordinates
- the principal coordinates
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
ConstructorDescriptionMDS
(double[] scores, double[] proportion, double[][] coordinates) Creates an instance of aMDS
record class. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
Returns the value of thecoordinates
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
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 theproportion
record component.double[]
scores()
Returns the value of thescores
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
MDS
public MDS(double[] scores, double[] proportion, double[][] coordinates) Creates an instance of aMDS
record class.- Parameters:
scores
- the value for thescores
record componentproportion
- the value for theproportion
record componentcoordinates
- the value for thecoordinates
record component
-
-
Method Details
-
of
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
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
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
scores
public double[] scores()Returns the value of thescores
record component.- Returns:
- the value of the
scores
record component
-
proportion
public double[] proportion()Returns the value of theproportion
record component.- Returns:
- the value of the
proportion
record component
-
coordinates
public double[][] coordinates()Returns the value of thecoordinates
record component.- Returns:
- the value of the
coordinates
record component
-