fuzzyclust.viz.sammon_stress#

fuzzyclust.viz.sammon_stress(X, Y)[source]#

Sammon’s stress of an embedding Y of the data X.

\[E = \frac{1}{\lambda}\sum_{k<l}\frac{\left(d_{kl}-d^*_{kl}\right)^2}{d_{kl}}, \qquad \lambda = \sum_{k<l} d_{kl},\]

where \(d_{kl}=\|\mathbf{x}_k-\mathbf{x}_l\|\) are the Euclidean distances in the original space and \(d^*_{kl}=\|\mathbf{y}_k-\mathbf{y}_l\|\) those in the projection. Pairs with \(d_{kl}=0\) (duplicate samples) are skipped. \(E=0\) means that all inter-point distances are preserved; the normalization by \(\lambda\) makes the value independent of the scale of the data (MATLAB toolbox samstr).

Parameters:
Xarray_like of shape (n_samples, n_features)
Yarray_like of shape (n_samples, n_components)
Returns:
Efloat

Examples

>>> import numpy as np
>>> from fuzzyclust.viz import sammon_stress
>>> X = np.array([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]])
>>> sammon_stress(X, X)        # the identity preserves every distance
0.0

Examples using fuzzyclust.viz.sammon_stress#

PCA versus Sammon mapping: preserving variance or distances

PCA versus Sammon mapping: preserving variance or distances