Metric Learning as Convex Combinations of Local Models with Generalization Guarantees

Valentina Zantedeschi, Rémi Emonet, Marc Sebban

Introduction

Metric learning is a fundamental task in machine learning, focused on learning distance or similarity functions tailored to specific data distributions. While global metrics, such as the Mahalanobis distance, are robust, they often lack the flexibility to capture complex non-linearities. Local metric learning addresses this by partitioning the input space into regions, each with its own metric. However, this approach introduces two significant challenges: the comparison gap—the difficulty of comparing instances assigned to different local models—and a high risk of overfitting due to the localized nature of the learning process.

The comparison gap in local metric learning: while distances within a region (green) are well-defined, comparing points across different regions (red) is problematic.

The C2LM Framework

To address these issues, we introduce C2LM (Convex Combinations of Local Models). C2LM bridges the gap between global and local approaches by defining the distance between any two points as a weighted combination of all available local models.

Methodology

The C2LM approach follows a structured pipeline:

  1. Space Partitioning: The input space is divided into $K$ regions (e.g., via K-means clustering).
  2. Local Model Assignment: Each region is associated with a local model, such as a bilinear form or a Mahalanobis-like distance.
  3. Convex Combinations: For a pair of points $(x_1, x_2)$ belonging to regions $R_i$ and $R_j$ respectively, the similarity score is computed as a weighted sum of all $K$ local models. The weight vector $W_{ij}$ is specific to the pair of regions.
  4. Regularization for Smoothness and Robustness: To ensure global consistency and prevent overfitting, C2LM employs two forms of regularization:
  5. Prior Influence: Penalizes weights that rely on local models spatially distant from the regions being compared, often guided by a Minimum Spanning Tree of region centroids.
  6. Spatial Smoothness: Encourages weight vectors for adjacent pairs of regions to be similar, ensuring the metric evolves smoothly across the space.

Theoretical Foundations

A key contribution of this work is the derivation of theoretical generalization guarantees. Using the framework of algorithmic robustness, we prove that C2LM maintains a bounded generalization error. This ensures that the model's performance on training data translates reliably to unseen test data, a common failure point for traditional local metric learning.

Experimental Evaluation

C2LM was evaluated on two distinct regression tasks requiring precise distance or similarity estimation.

Perceptual Color Distances

In color science, predicting the perceptual difference ($\Delta E_{00}$) between colors under different camera distortions is a non-linear problem. Using a dataset of nearly 30,000 RGB patches, C2LM demonstrated superior accuracy. Notably, C2LM achieved lower test loss with only 5 clusters than baseline methods achieved with 30, highlighting its efficiency.

Semantic Word Similarities

The framework was also applied to the WordSim353 dataset to predict human-assigned similarity scores between word embeddings. C2LM successfully improved upon standard Cosine Similarity and global bilinear models, demonstrating its versatility in high-dimensional semantic spaces.

Test loss vs. number of clusters. C2LM (green) achieves lower loss and greater stability compared to standard local models as complexity increases.

Key Insights

  • Global Consistency: By treating local models as basis functions, C2LM creates a "bridge" for comparing distant points, effectively closing the comparison gap.
  • Stability and Scalability: Unlike standard local models that often overfit as the number of clusters increases, C2LM remains stable and continues to improve or plateau at a low error rate.
  • Regression-First Design: While most metric learning focuses on classification or triplet ranking, C2LM is optimized for regression, making it ideal for applications where the magnitude of similarity is critical.

Conclusion

C2LM offers a robust solution for local metric learning by combining the flexibility of local models with the stability of global regularization. Its ability to provide smooth transitions between regions and its theoretical guarantees make it a powerful tool for complex distance estimation tasks in both geometric and semantic domains.

Summary updated

BibTeX
@inproceedings{zantedeschi2016metric,
  author = {Valentina Zantedeschi and Rémi Emonet and Marc Sebban},
  title = {{Metric Learning as Convex Combinations of Local Models with Generalization Guarantees}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2016},
  url = {https://openreview.net/forum?id=HkbEC2bdZr},
}
Figure