Abstract
Support Vector Machines (SVM) and Large Margin Nearest Neighbor (LMNN) are cornerstone algorithms in machine learning with seemingly distinct biases—global vs. local. This paper establishes a unified framework, demonstrating that SVM can be cast as a metric learning problem. We show that LMNN is equivalent to learning a set of local SVM-like models within a quadratic space. Furthermore, we introduce $\epsilon$-SVM, a novel variant inspired by this metric perspective that incorporates a penalty for within-class spread. Empirical results across benchmark datasets indicate that $\epsilon$-SVM often outperforms both standard SVM and LMNN.
Introduction
In classification, SVMs are typically viewed as global models seeking a maximum-margin hyperplane to separate classes. Conversely, LMNN is a local approach that learns a Mahalanobis distance metric to ensure a point's $k$-nearest neighbors belong to the same class. While both utilize hinge loss and margin concepts, their relationship has historically been considered superficial. This work aims to bridge this gap, providing a deeper theoretical connection that allows for cross-pollination between these two paradigms.
The Metric Learning Perspective of SVM
The standard SVM formulation involves finding a hyperplane that maximizes the margin $\gamma$ relative to the data radius $R$. We propose a shift in perspective: instead of moving the hyperplane in a fixed space, we fix the hyperplane and transform the underlying data space.
By warping the space using a diagonal transformation matrix, we prove that this metric learning approach is mathematically equivalent to the traditional SVM. This insight leads to the development of $\epsilon$-SVM. Unlike standard SVMs that only penalize points violating the margin, $\epsilon$-SVM introduces a penalty for points that are excessively distant from the hyperplane, effectively minimizing within-class variance—a core objective in metric learning.
Unifying LMNN and SVM
The most significant contribution of this work is the demonstration that LMNN can be re-interpreted as an ensemble of local SVMs. By mapping data into a higher-dimensional quadratic space, the Mahalanobis distance becomes linear. In this space, the LMNN objective function transforms into a collection of $n$ local $\epsilon$-SVM models, one centered around each data point.
This "local-to-global" mapping reveals that LMNN is not merely similar to SVM; it is a localized application of the same fundamental principles. This unified view suggests that $\epsilon$-SVM serves as a computationally efficient proxy for the theoretically ideal but complex radius-margin bound.
Experimental Evaluation
We evaluated $\epsilon$-SVM against standard SVM and LMNN using ten benchmark datasets from the UCI Repository, covering medical (e.g., breast cancer, leukemia) and physical (e.g., sonar, ionosphere) domains. Experiments utilized 10-fold cross-validation across linear, polynomial, and Gaussian kernels.
Key findings include:
- Performance: $\epsilon$-SVM achieved lower error rates than standard SVM in 19 of 40 experimental runs and outperformed LMNN in 20 cases.
- Statistical Significance: Using the McNemar test, $\epsilon$-SVM (46 points) demonstrated clear superiority over SVM (37.5) and LMNN (36.5).
- Kernel Synergy: The advantages of $\epsilon$-SVM were most pronounced with Gaussian kernels, where its inherent regularization helps manage high-dimensional feature spaces.
Conclusion
By reframing SVM as a metric learning problem, we have uncovered a deep mathematical link between global margin maximization and local distance metric learning. The resulting $\epsilon$-SVM variant provides a robust middle ground that leverages the strengths of both approaches. Future work will focus on extending this framework to multiclass classification and addressing the computational challenges of large-scale implementations.
Summary updated