Computational Efficiency under Covariate Shift in Kernel Ridge Regression

Andrea Della Vecchia, Arnaud Mavakala Watusadisi, Ernesto De Vito, Lorenzo Rosasco

Introduction

Kernel Ridge Regression (KRR) is a powerful non-parametric learning tool, but it scales poorly to large datasets. This limitation becomes especially problematic in the presence of covariate shift—a common real-world scenario where the distribution of input features changes between training and testing, even though the underlying relationship between inputs and the target variable remains constant.

To correct for covariate shift, researchers typically use Importance Weighting (IW), which reweights training samples based on their resemblance to the test data. While IW effectively addresses statistical bias, it does not resolve the computational bottleneck of KRR. Standard KRR requires building and inverting a massive $n \times n$ matrix, incurring an $O(n^3)$ time complexity and $O(n^2)$ memory cost. This makes the method practically unusable for datasets exceeding $10^5$ samples. This paper investigates whether randomized approximation techniques can accelerate Importance-Weighted KRR without sacrificing its ability to handle covariate shift.

The Proposed Solution: Nyström W-KRR

To overcome these computational barriers, the authors propose Nyström W-KRR, an algorithm that integrates Importance-Weighted KRR with the Nyström method.

  • The Nyström Method: Instead of utilizing all $n$ training points to construct the kernel matrix, the algorithm projects the problem onto a much smaller random subspace spanned by $m$ points (where $m \ll n$).
  • Approximate Leverage Score (ALS) Sampling: Rather than selecting these $m$ points uniformly at random, the algorithm employs ALS sampling. This technique intelligently selects points that are structurally critical to the kernel matrix, ensuring a high-quality approximation.

The core contribution of the paper is a robust mathematical framework demonstrating that this Nyström approximation holds up even when training and test distributions mismatch, and even when importance weights are potentially unbounded during empirical risk minimization.

Key Insights and Theoretical Guarantees

  • No Compromise on Accuracy: The most significant theoretical takeaway is that the Nyström approximation does not degrade the statistical learning rate. The compressed model achieves the exact same optimal theoretical guarantees as the full, computationally heavy model.
  • Handling Unbounded Weights: A major technical hurdle in covariate shift is that the density ratio between test and train distributions (the importance weight) can theoretically approach infinity. The authors successfully prove their bounds for unbounded weights, provided that the moments of the weight function remain bounded.
  • Well-Specified vs. Misspecified Models: The mathematical analysis reveals an interesting nuance: if a model is perfectly well-specified (i.e., the true function lies exactly within the kernel space), standard unweighted Nyström KRR achieves the same convergence rate as the weighted version. However, the weighted version exhibits better constant factors, making it more robust in practical applications.

Empirical Validation

The authors validated their theoretical claims using both simulated data (with controlled levels of model misspecification) and real-world benchmark datasets commonly used in domain adaptation, such as HHAR, HAR70+, HARChildren, and WISDM. To simulate covariate shift in the real-world data, models were trained on data from one user and tested on a different user.

The results demonstrate massive improvements in efficiency:

  • Theoretical Speedup: Nyström W-KRR reduces time complexity from $O(n^3)$ to $O(m^3 + m^2n)$ and memory complexity from $O(n^2)$ to $O(mn)$.
  • Empirical Time Savings: On the HAR70+ dataset ($n=20,000$), standard W-KRR required approximately 1,785 seconds to train. In contrast, Nyström W-KRR (using just $m=1,100$ points) completed training in roughly 89 seconds—a 20x speedup.
  • Identical Performance: Despite the drastic reduction in compute, the Mean Squared Error (MSE) on HAR70+ remained identical (5.0 for both the full and approximated methods). This pattern of identical MSE with significantly lower training time held true across all four real-world datasets.

Limitations and Future Directions

While Nyström W-KRR offers a compelling solution, the authors note a few limitations. To accommodate unbounded weights mathematically, the analysis assumes that all moments of the weight function are bounded—a relatively strong condition compared to some recent literature that only requires bounded second moments. Additionally, the theoretical framework assumes the projection of the true regression function lies within the hypothesis space; fully misspecified settings introduce complexities not covered in this work.

Looking forward, the authors suggest investigating the nature of covariate shift itself. Because covariate shift can sometimes be harmless ("benign") and other times highly destructive ("adversarial"), future work should explore how the specific alignment between data distributions and the target function drives these divergent behaviors.

Summary updated

BibTeX
@inproceedings{vecchia2025computational,
  author = {Andrea Della Vecchia and Arnaud Mavakala Watusadisi and Ernesto De Vito and Lorenzo Rosasco},
  title = {{Computational Efficiency under Covariate Shift in Kernel Ridge Regression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=TU2MZHZLkP},
}
Figure