Wasserstein t-SNE

Fynn Bachmann, Philipp Hennig, Dmitry Kobak · DOI

Introduction

In many scientific domains, data is inherently hierarchical. For instance, in social sciences, individual survey respondents (samples) are nested within geographic regions (units). Traditional dimensionality reduction techniques like t-SNE or PCA typically require a single vector per observation. To accommodate hierarchical structures, researchers often resort to a "mean-only" approach, representing each unit by the average of its constituent samples. However, this simplification discards critical information regarding the internal distribution—the "shape"—of the data. Two units may share an identical mean but possess vastly different variance or correlation structures, representing distinct phenomena.

Methodology: From Points to Distributions

Wasserstein t-SNE addresses this limitation by treating each unit not as a point, but as a probability distribution. The core innovation lies in using the Wasserstein metric (specifically the $W_2$ distance, or Earth Mover’s Distance) to compute pairwise distances between these distributions.

Conceptual workflow of Wasserstein t-SNE, mapping hierarchical samples to unit distributions and then to a 2D embedding.

The Tunable Distance Formula

To balance computational efficiency with descriptive power, the authors propose a Gaussian approximation for each unit. This leads to a closed-form solution for the $W_2$ distance. Furthermore, they introduce a tunable hyperparameter $\lambda \in [0, 1]$ in a generalized distance formula: $$\tilde{W}(\mu, \nu)^2 = (1 - \lambda) \|m_1 - m_2\|_2^2 + \lambda \cdot \text{tr}(C_1 + C_2 - 2(C_2C_1)^{1/2})$$ This allows researchers to explicitly weight the importance of differences in means ($m$) versus differences in covariance ($C$). When $\lambda=0$, the method reduces to a standard mean-based approach; when $\lambda=1$, it focuses entirely on the internal "shape" of the units.

Key Insights and Results

The utility of capturing shape information is most evident when units overlap significantly in their average values. In synthetic tests using Hierarchical Gaussian Mixture Models (HGMM), Wasserstein t-SNE successfully separated classes that mean-based embeddings failed to distinguish.

(A) Synthetic distributions with overlapping means but different orientations. (B) Scaling of 2-Wasserstein distance and computation time as a function of sample size.

Real-World Application: German Election Data

The method was applied to the 2017 German Parliamentary Election data, treating polling stations as samples and voting districts as units. Each sample is a 6D vector representing vote percentages for major parties. By setting $\lambda \approx 0.75$, the authors achieved an Adjusted Rand Index (ARI) of 0.70, significantly outperforming the mean-only baseline (0.55). This suggests that the correlations between party votes within a district are more informative for regional clustering than the average vote shares alone.

Computational Efficiency

While exact Wasserstein distances are computationally intensive, the Gaussian approximation provides a massive speedup, reducing processing time from days to seconds for large datasets. As shown in the scaling analysis, the computation time for the exact method grows significantly with sample size, whereas the approximation remains highly tractable for moderately sized datasets.

Discussion and Limitations

Wasserstein t-SNE offers a powerful lens for hierarchical data, yet it faces challenges in extreme high-dimensionality due to the $O(d^3)$ complexity of matrix operations. Additionally, while the Gaussian approximation is effective for many datasets, it may overlook complex internal structures like bimodality or multi-modal polarization. Future work may explore more flexible distribution models or further optimizations for massive datasets with millions of units.

Summary updated

BibTeX
@inproceedings{bachmann2022wasserstein,
  author = {Fynn Bachmann and Philipp Hennig and Dmitry Kobak},
  title = {{Wasserstein t-SNE}},
  booktitle = {ECML/PKDD},
  year = {2022},
  doi = {10.1007/978-3-031-26387-3\_7},
}
Figure