Approximating Metric Magnitude of Point Sets

Rayna Andreeva, James Ward, Primoz Skraba, Jie Gao, Rik Sarkar

Introduction: The Challenge of Measuring Data Complexity

Metric magnitude is a powerful mathematical tool for measuring the "effective size" and complexity of point clouds. Unlike simple cardinality, which merely counts points, magnitude accounts for how points are distributed in space. For example, three points clustered tightly together might have a magnitude near 1, while three points spread far apart have a magnitude closer to 3.

Illustration of how point distribution affects metric magnitude.

In machine learning, magnitude has shown promise for predicting generalization gaps and detecting edges. However, calculating it exactly requires inverting a large similarity matrix ($\zeta_{ij} = e^{-d_{ij}}$), which costs $O(n^3)$. This computational bottleneck has limited its use to small datasets. This paper introduces $O(n^2)$ iterative approximation algorithms and geometric subset selection methods to make magnitude scalable for modern data science.

Efficient Approximation Methods

The authors propose three primary ways to bypass the matrix inversion bottleneck:

  1. Iterative Normalization Algorithm: By framing magnitude weights as a convex optimization problem, the authors introduce a simple iterative scheme where weights are updated by dividing by their current row-sums in the similarity matrix. This reduces the cost to $O(n^2)$ per iteration and typically converges in fewer than 20 iterations.
  2. Greedy Subset Selection: Since magnitude increases monotonically as points are added, the authors explore selecting a small subset that approximates the total magnitude. While they prove that magnitude is not strictly submodular in high dimensions, they find that greedy selection works exceptionally well in practice, rapidly approaching the ground truth magnitude.
Greedy maximization of magnitude value as points are added to a subset.
  1. Discrete Center Hierarchy: To further accelerate selection, they use a geometric hierarchy (independent covering sets) to identify representative points without needing to repeatedly recompute magnitude at every step.

Theoretical Insights and Applications

A major theoretical contribution is the proof that magnitude is submodular in 1D ($\mathbb{R}^1$) but fails to be submodular in higher dimensions. In $\mathbb{R}^D$, adding a single point can increase the magnitude by much more than 1. Despite this, empirical results show that greedy algorithms provide excellent approximations.

The authors demonstrate the utility of these scalable methods in two key areas:

  • Magnitude Regularization: Using the magnitude of a neural network's weights as a penalty term (similar to $L_2$ weight decay) allows for more intelligent penalization of weight distribution complexity.
  • Magnitude Clustering: A novel "Magnitude Clustering" criterion adds points to a cluster only if they do not increase the cluster's magnitude beyond a threshold. This approach naturally handles outliers better than density-based methods like DBSCAN.

Key Results and Future Work

The Iterative Normalization algorithm significantly outperformed standard matrix inversion and Gradient Descent in time-to-convergence, especially for datasets exceeding 2,000 points. Applying magnitude regularization to an MNIST model reduced the generalization gap from 0.0736 to 0.0464 while maintaining test performance.

While $O(n^2)$ is a massive improvement, future work will explore combining these methods with Nyström approximations or random projections to reach $O(n \log n)$ or $O(n)$ complexity, enabling magnitude analysis for datasets with millions of points.

Summary updated

BibTeX
@inproceedings{andreeva2025approximating,
  author = {Rayna Andreeva and James Ward and Primoz Skraba and Jie Gao and Rik Sarkar},
  title = {{Approximating Metric Magnitude of Point Sets}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  url = {https://openreview.net/forum?id=PjPgcLf4tM},
}
Figure