Subsampling for Ridge Regression via Regularized Leverage Scores
Authors: Haim Avron, Kenneth L. Clarkson, David P. Woodruff
Published: 2017
Venue: ICML / Journal of Machine Learning Research
Link: arXiv
Summary
This paper introduces regularized leverage score sampling for kernel ridge regression. It shows that sampling training points proportionally to their leverage scores yields estimators with optimal statistical and computational properties.
Key Contributions
1. Regularized Leverage Scores
The regularized leverage score of point is:
where is the -th column of the kernel matrix.
2. Statistical Leverage Sampling
Sample points with probabilities:
where is the effective dimension.
3. Optimal Subsampling Rate
With leverage score sampling, only need:
samples to achieve nearly the same error as full kernel ridge regression.
Mathematical Framework
Ridge Regression
Full kernel ridge regression:
Solution:
Subsampled Estimator
Given indices sampled with weights :
Importance Weighting
The reweighting ensures unbiasedness:
Theoretical Guarantees
Main Theorem
Theorem: With leverage score sampling using samples:
with high probability.
Matrix Approximation View
The leverage score sampling preserves spectral properties:
where is the subsampled approximation.
Statistical Efficiency
The subsampled estimator achieves:
Algorithm
import numpy as np
def compute_leverage_scores(K, lambda_reg):
"""
Compute regularized leverage scores.
Parameters:
-----------
K : kernel matrix (n, n)
lambda_reg : regularization parameter
Returns:
--------
scores : leverage scores (n,)
"""
n = K.shape[0]
# Compute (K + λI)^{-1}
K_reg_inv = np.linalg.inv(K + lambda_reg * np.eye(n))
# Leverage score i = K[i,:] @ K_reg_inv @ K[:,i]
scores = np.sum(K * K_reg_inv, axis=1)
return scores
def approximate_leverage_scores(X, kernel_func, lambda_reg, n_samples=100):
"""
Approximate leverage scores using random projection.
"""
n = len(X)
# Use random Nyström approximation
idx = np.random.choice(n, min(n_samples, n), replace=False)
K_nm = kernel_func(X, X[idx])
K_mm = kernel_func(X[idx], X[idx])
# Approximate leverage scores
L = np.linalg.cholesky(K_mm + 1e-6 * np.eye(len(idx)))
Z = np.linalg.solve(L, K_nm.T).T # n x m
scores = np.sum(Z**2, axis=1) / (lambda_reg + np.sum(Z**2, axis=1) / n_samples)
return scores
def leverage_score_sampling(X, y, kernel_func, lambda_reg, m):
"""
Kernel ridge regression with leverage score sampling.
"""
n = len(X)
K = kernel_func(X, X)
# Compute leverage scores
scores = compute_leverage_scores(K, lambda_reg)
probs = scores / scores.sum()
# Sample m points
idx = np.random.choice(n, m, replace=False, p=probs)
weights = 1.0 / (m * probs[idx])
# Weighted kernel ridge regression on subsample
K_sub = K[np.ix_(idx, idx)]
y_sub = y[idx]
W = np.diag(np.sqrt(weights))
alpha_sub = np.linalg.solve(
W @ K_sub @ W + n * lambda_reg * np.eye(m),
W @ y_sub
)
alpha = W @ alpha_sub
return idx, alpha
Comparison of Sampling Strategies
| Strategy | Sample Size Needed | Computation |
|---|---|---|
| Uniform | ||
| Leverage | for exact | |
| Approx. Leverage |
Advantages of Leverage Sampling
- Optimal sample size: Matches lower bounds
- Adapts to data: More samples in important regions
- Preserves structure: Maintains spectral properties
Practical Considerations
- Approximate scores: Use Nyström or RFF to estimate
- Iterative refinement: Recompute scores after initial fit
- Streaming: Can be adapted for online setting
Applications
- Large-scale regression: Scale kernel methods to big data
- Coresets: Construct data summaries
- Active learning: Prioritize informative samples
- Distributed computing: Reduce communication in distributed KRR
Citation
@article{avron2017random,
title={Random Fourier features for kernel ridge regression: Approximation bounds and statistical guarantees},
author={Avron, Haim and Clarkson, Kenneth L and Woodruff, David P},
journal={International Conference on Machine Learning},
pages={253--262},
year={2017}
}
Further Reading
- Drineas, P. & Mahoney, M. (2005). On the Nyström method for approximating a Gram matrix
- Ma, P., et al. (2015). A statistical perspective on algorithmic leveraging
- Alaoui, A. & Mahoney, M. (2015). Fast randomized kernel ridge regression