MDS
Multidimensional scaling places points in a low-dimensional space so that pairwise distances match the originals as closely as possible.
Algorithm
Metric (and non-metric) MDS via the SMACOF majorisation iteration, which monotonically decreases the stress functional.
Constructor
Skigen::MDS<Scalar> model(
int n_components = 2,
int max_iter = 300,
Scalar tol = 1e-3,
bool metric = true,
std::optional<uint64_t> random_state = std::nullopt,
int n_init = 4);
Parameters
| Parameter | Default | Description |
|---|---|---|
n_components | 2 | Embedding dimensionality. |
max_iter | 300 | SMACOF iterations. |
tol | 1e-3 | Stress-convergence tolerance. |
metric | true | Metric MDS; non-metric MDS is deferred. |
random_state | nullopt | Optional seed for reproducible starts. |
n_init | 4 | Number of random SMACOF starts; the best stress is retained. |
Methods
| Method | Description |
|---|---|
fit_transform(X) | Return the embedding. |
Fitted Attributes
| Accessor | Description |
|---|---|
stress() | Final stress value. |
n_iter() | Number of SMACOF iterations used by the best start. |
n_init() | Number of random starts tried. |
Example
Skigen::MDS<double> mds(2);
auto Y = mds.fit_transform(X);
Verified against scikit-learn
This estimator is checked by the parity suite. See the generator
tests/parity/generate_manifold_reference.py and the reference fixtures in
tests/parity/data/mds/, exercised by tests/parity/parity_manifold.cpp.
API Reference
For full signatures see the MDS API Reference.