From Covariance to Comode in context of Principal Component Analysis

Daniyal Kazempour, Long Mathias Yan, Thomas Seidl

Abstract

Standard Principal Component Analysis (PCA) is notoriously sensitive to outliers because it relies on the mean-based covariance matrix. This paper proposes a "comode" matrix—a mode-based alternative to covariance—calculated using the MeanShift algorithm to create a more robust version of PCA. By replacing the traditional covariance matrix with the comode, the authors demonstrate a "drop-in" method for dimensionality reduction that can better handle noisy data. Experimental results on the Iris dataset show that with an appropriate bandwidth, Comode-PCA significantly reduces reconstruction error compared to classical PCA.

Introduction

PCA is a cornerstone of dimensionality reduction, used to project high-dimensional data into a lower-dimensional space while preserving as much variance as possible. However, its mathematical foundation is the covariance matrix, which is built using the arithmetic mean. In statistics, the mean is "non-robust": a single extreme outlier can pull the mean far away from the center of the data. Consequently, outliers can skew the entire PCA projection, leading to a reconstruction that reflects noise rather than the underlying signal.

While researchers have developed complex "Robust PCA" methods (like RANSAC or sparse matrix decompositions), these are often computationally heavy. The authors of this paper propose a simpler alternative: replacing the covariance matrix with a more stable, mode-based metric.

Methodology

The authors introduce the comode, a generalization of the mode in the same way covariance is a generalization of the variance.

  1. The Definition: While covariance looks at the expected value of the product of deviations from the mean, the comode looks at the mode of the product of deviations from the mode: $$com(A_i, A_j) := mode((A_i - mode(A_i))(A_j - mode(A_j)))$$
  2. Finding the Mode: To calculate the mode of a continuous distribution, the authors use the MeanShift algorithm. This iterative mode-seeking algorithm "shifts" data points toward the densest regions of the feature space.
  3. The Hyperparameter: The MeanShift algorithm relies on a bandwidth ($\sigma$), which defines the size of the neighborhood used to calculate density. The authors experiment with different bandwidths to observe their impact on PCA performance.
  4. Handling Multimodality: In cases where the data has multiple peaks (modes), the method selects the "top mode"—the one with the highest frequency of data points.

Experimental Results

The approach was evaluated using the Iris dataset, a classic benchmark consisting of 150 instances and 4 features. The primary metric for comparison was the Mean Squared Error (MSE) of the data reconstruction.

Mean Squared Error (MSE) comparison between standard cov-PCA and com-PCA at various bandwidths.

As shown in the figure above, the choice of bandwidth ($\sigma$) is critical. Using a bandwidth of $\sigma = 0.1$, Comode-PCA achieved a reconstruction MSE of approximately 1.0 when using only the first principal component. In contrast, the classical covariance-based PCA (cov-PCA) had a significantly higher MSE of approximately 7.0.

However, as the bandwidth increased to 4.0 and 5.5, the performance of Comode-PCA degraded significantly, eventually resulting in much higher errors than standard PCA. This confirms that the "mode-seeking" benefit of the algorithm is highly dependent on the local neighborhood size. When the bandwidth is too large, the algorithm fails to isolate the dense core of the data from the noise.

Discussion: The MSE Paradox

The authors highlight a counter-intuitive point in robust statistics: A low Mean Squared Error (MSE) isn't always good. If a model achieves a very low MSE on a noisy dataset, it might mean the model is successfully reconstructing the outliers—meaning the outliers have successfully skewed the principal components. Conversely, a higher MSE might indicate that the model ignored the outliers to focus on the "clean" majority of the data. In this study, the low MSE of Comode-PCA at $\sigma = 0.1$ suggests that the first principal component is capturing the primary signal more effectively than the mean-based approach.

Limitations and Future Work

Despite the promising results, several challenges remain:

  • The Multimodal Challenge: Simply picking the most frequent mode might ignore important data structures in complex datasets with multiple significant clusters.
  • Bandwidth Selection: There is currently no automated way to pick the "optimal" bandwidth for Comode-PCA. Future work is needed to determine if feature-specific bandwidths could improve results.
  • Scalability: While effective on the Iris dataset, the computational cost of running MeanShift for every pair of features in a high-dimensional dataset could be a bottleneck for larger applications.

Summary updated

BibTeX
@inproceedings{kazempour2019from,
  author = {Daniyal Kazempour and Long Mathias Yan and Thomas Seidl},
  title = {{From Covariance to Comode in context of Principal Component Analysis}},
  booktitle = {LWDA},
  year = {2019},
}
Figure