Class MDS
Defined in File MDS.hpp
Nested Relationships
Nested Types
Class Documentation
-
class MDS
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 best 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.
References
J. W. Sammon. A Nonlinear Mapping for Data Structure Analysis. IEEE 1969.
Public Functions
-
MDS(int n_components = 2, int max_iter = 100, double eps = 1e-4, double learning_rate = 0.2, int random_state = 0, const std::string &dissimilarity = "euclidean")
Constructor.
- Parameters
n_components – the dimension of the projection.
max_iter – maximum number of iterations.
eps – the tolerance on objective function for stopping iterations, also the tolerance on step size.
learning_rate – initial value of the step size.
random_state – determines the random number generator used to initialize the centers.
dissimilarity – dissimilarity measure to use. ‘euclidean’: pairwise Euclidean distances between points in the dataset. ‘precomputed’: pre-computed dissimilarities which are passed to ::fitTransform.
- Throws
std::invalid_argument – if any of the first four arguments is <= 0, or if ‘dissimilarity’ argument is invalid.
-
Matrix fitTransform(const Eigen::Ref<const Matrix> &x, std::optional<const Eigen::Ref<const Matrix>> init = std::nullopt)
Fit mapping.
- Parameters
x – training data, or matrix of dissimilarities if ‘dissimilarity’ == ‘precomputed’.
init – the initial projected coordinates, of which the column size is the projection dimension.
- Throws
std::invalid_argument – if dissimilarities are precomputed but the matrix of dissimilarities isn’t symmetric, or if ‘init’ matrix is present but has incorrect shape.
- Returns
the final projected coordinates.