Tree-Wasserstein Distance for High Dimensional Data with a Latent Feature Hierarchy

Ya-Wei Eileen Lin, Ronald R. Coifman, Gal Mishne, Ronen Talmon

Finding meaningful distances between high-dimensional data samples is a fundamental challenge in machine learning and scientific research. Standard metrics often fall short because they ignore the hidden, hierarchical relationships between features. A new paper accepted to ICLR 2025 introduces a novel approach to this problem: a Tree-Wasserstein Distance (TWD) that automatically learns a latent hierarchy of features by embedding them into a multi-scale hyperbolic space.

This data-driven tree not only makes distance calculations significantly more efficient but also improves classification accuracy across diverse domains, from text processing to genomics.

The Challenge of High-Dimensional Distances

In high-dimensional datasets, features are rarely independent; they typically exist within a hidden hierarchy. For example, in a document, the words "apple" and "orange" are semantically closer to each other (as fruits) than to "beetroot." Standard metrics like Euclidean distance treat all features as orthogonal, completely ignoring this underlying structure.

While Optimal Transport (Wasserstein distance) can incorporate these feature relationships, it is notoriously expensive to compute, scaling at $O(m^3 \log m)$ for $m$ features. Existing "Tree-Wasserstein" approximations attempt to speed this up by routing the transport problem through a tree structure. However, they typically rely on random trees or simple Euclidean clustering, which fail to capture the true underlying hierarchy of the features. This paper bridges that gap by learning the hierarchy directly from the data to build a more meaningful and computationally efficient distance metric.

A Two-Step Framework: Hyperbolic Embedding and Tree Decoding

To uncover the latent feature hierarchy, the authors propose a novel two-step framework:

  1. Hyperbolic Diffusion Embedding: The method uses diffusion geometry to capture local affinities between features. These affinities are then embedded into a multi-scale hyperbolic space (specifically, the Poincaré half-space). Hyperbolic geometry is uniquely suited for this task because its "exponentially expanding" volume naturally mirrors the exponential growth of nodes in a hierarchical tree.
  2. Tree Decoding via HD-LCA: The core innovation is a new "Hyperbolic Diffusion Lowest Common Ancestor" (HD-LCA) method. The authors establish a continuous analog of a tree's Lowest Common Ancestor within hyperbolic space. By finding these geometric "meeting points" for pairs of features, they can decode a binary tree in a bottom-up, hierarchical manner.
Illustration of the Hyperbolic Diffusion Lowest Common Ancestor (HD-LCA) concept, mapping tree nodes to hyperbolic space.

Once this tree is built, the Tree-Wasserstein Distance can be computed in linear time. The authors mathematically prove that this distance effectively recovers the Wasserstein distance defined by the "true" (but hidden) feature hierarchy.

Algorithms for HD Binary Tree Decoding and computing the TWD with a latent feature hierarchy.

Key Theoretical Insights

  • Trees as a Fundamental Model: Traditionally, TWD is used merely as a computational shortcut—a "poor man's Wasserstein." Here, the tree is treated as a fundamental model of the feature space that provides deep semantic meaning.
  • Closed-Form Solutions: The paper provides a closed-form solution for the hyperbolic LCA, making the tree-building algorithm both interpretable and highly efficient.
  • Differentiability: Unlike many discrete tree-based methods, the proposed TWD is differentiable, allowing it to be seamlessly integrated into modern gradient-based machine learning pipelines.

Experimental Validation and Results

The method was rigorously evaluated across several distinct data types, including synthetic word-document data, real-world text benchmarks (BBCSPORT, TWITTER, CLASSIC, AMAZON), single-cell RNA-sequencing (scRNA-seq) datasets (Zeisel, CBMC), and even MNIST as a non-hierarchical baseline.

The results demonstrate significant advantages:

  • Superior Accuracy: On the BBCSPORT dataset, the proposed TWD achieved 96.1% accuracy, outperforming the popular Word Mover’s Distance (95.4%) and other TWD variants.
  • Biological Discovery: In scRNA-seq analysis, the method outperformed pre-trained models (like GMD). This suggests that the learned gene hierarchy is more biologically relevant than generic gene proximity metrics, successfully capturing complex cellular relationships.
  • Scalability: By utilizing "diffusion landmarks," the authors reduced the computational complexity to roughly $O(m^{1.2})$. This allows the method to handle massive datasets with tens of thousands of features (such as the AMAZON dataset with ~42,000 features) where full Optimal Transport would be computationally impossible.
  • Robustness: Even on MNIST—a dataset that isn't naturally hierarchical—the method outperformed all other tree-based baselines, proving its viability as a robust, general-purpose distance metric.

Limitations and Future Directions

While powerful, the current formulation requires data to be normalized as probability distributions (histograms), which may not suit all data types, particularly those with negative values. Additionally, like many manifold learning techniques, its performance can be sensitive to the choice of the initial distance metric and the kernel scale parameter.

Future work will likely explore different initial metrics and extend the tree-decoding logic to broader contexts beyond Wasserstein distances, opening new avenues for hierarchical data analysis.

Summary updated

BibTeX
@inproceedings{lin2025tree,
  author = {Ya-Wei Eileen Lin and Ronald R. Coifman and Gal Mishne and Ronen Talmon},
  title = {{Tree-Wasserstein Distance for High Dimensional Data with a Latent Feature Hierarchy}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=nYjAzwor9R},
}
Figure