Nearest Neighbor Sampling for Covariate Shift Adaptation
François Portier, Lionel Truquet, Ikko Yamane
TL;DR
This work tackles covariate shift by eschewing weight estimation in favor of a nonparametric, hyperparameter-free approach that labels unlabeled target data using a $1$-nearest-neighbor sampler built from the source, enabling direct ERM on the augmented target. The authors establish a sharp error decomposition into marginal and conditional components, showing that the conditional $k$-NN error trades off bias and variance in a way that favors $k=1$, yielding near-parametric rates in many regimes and a quasi-linear runtime when accelerated with kd-trees. They connect the method to empirical risk minimization, proving consistency and rates for general and linear models under covariate shift, and demonstrate strong empirical performance and substantial speedups over kernel and weight-based baselines on synthetic and real data. Overall, the paper provides a scalable, theory-backed framework for covariate shift adaptation that leverages unlabeled target data through simple nearest-neighbor labeling, with practical impact for large-scale learning under distributional shift.
Abstract
Many existing covariate shift adaptation methods estimate sample weights given to loss values to mitigate the gap between the source and the target distribution. However, estimating the optimal weights typically involves computationally expensive matrix inversion and hyper-parameter tuning. In this paper, we propose a new covariate shift adaptation method which avoids estimating the weights. The basic idea is to directly work on unlabeled target data, labeled according to the $k$-nearest neighbors in the source dataset. Our analysis reveals that setting $k = 1$ is an optimal choice. This property removes the necessity of tuning the only hyper-parameter $k$ and leads to a running time quasi-linear in the sample size. Our results include sharp rates of convergence for our estimator, with a tight control of the mean square error and explicit constants. In particular, the variance of our estimators has the same rate of convergence as for standard parametric estimation despite their non-parametric nature. The proposed estimator shares similarities with some matching-based treatment effect estimators used, e.g., in biostatistics, econometrics, and epidemiology. Our experiments show that it achieves drastic reduction in the running time with remarkable accuracy.
