Skip to main content

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

ParameterDefaultDescription
n_components2Embedding dimensionality.
max_iter300SMACOF iterations.
tol1e-3Stress-convergence tolerance.
metrictrueMetric MDS; non-metric MDS is deferred.
random_statenulloptOptional seed for reproducible starts.
n_init4Number of random SMACOF starts; the best stress is retained.

Methods

MethodDescription
fit_transform(X)Return the embedding.

Fitted Attributes

AccessorDescription
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.