Correcting Sample Selection Bias by Unlabeled Data

Jiayuan Huang, Alexander J. Smola, Arthur Gretton, Karsten M. Borgwardt, Bernhard SchölkopfNeurIPS 2006

The Problem of Sample Selection Bias

Most machine learning algorithms operate under the assumption that training and test data are independent and identically distributed (i.i.d.). In real-world applications, however, this is rarely the case. For instance, a medical diagnostic model trained on data from hospital volunteers—who might skew older or more health-conscious—may perform poorly when applied to the general population. This discrepancy is known as sample selection bias or covariate shift.

The standard approach to correcting this bias is "importance sampling," which involves reweighting training data points by the ratio of the test density to the training density ($Pr'(x)/Pr(x)$). Unfortunately, accurately estimating these probability densities is notoriously difficult, particularly in high-dimensional spaces. Even minor errors in density estimation can produce massive, unstable weights that severely degrade model performance.

1D Toy Regression Example

Kernel Mean Matching (KMM)

To address the instability of density estimation, the authors introduce Kernel Mean Matching (KMM), a non-parametric method that bypasses density estimation entirely.

Instead of calculating density ratios, KMM directly computes resampling weights by matching the means of the training and test sets in a high-dimensional feature space. The methodology follows these core steps:

  1. RKHS Mapping: Both the training data and the (unlabeled) test data are mapped into a Reproducing Kernel Hilbert Space (RKHS) using a universal kernel, such as a Gaussian kernel.
  2. Mean Matching: A theoretical property of universal kernels is that if the means of two distributions match in this high-dimensional space, the distributions themselves are likely identical (matching the mean is mathematically equivalent to matching all moments of the distribution).
  3. Quadratic Programming (QP): The authors formulate an optimization problem to find a set of weights ($\beta$) for the training points. The goal is to choose weights such that the weighted average of the training points in the feature space is as close as possible to the unweighted average of the test points.
  4. Constraints: To ensure the weights remain well-behaved, constraints are applied: weights must be positive, they are capped by a maximum constant $B$, and their overall average should be close to 1.

Once calculated, these weights can be seamlessly integrated into standard algorithms like Support Vector Machines (SVMs) or Linear Regression to train a "de-biased" model tailored to the test distribution.

Key Results and Insights

The authors evaluated KMM across a variety of scenarios, including a toy polynomial regression task, 18 UCI benchmark datasets with artificially induced bias, and real-world microarray data for prostate and breast cancer.

  • Direct is Better: By skipping the intermediate step of density estimation, KMM successfully avoids the error propagation that plagues traditional importance sampling methods.
  • Benchmark Dominance: In 13 out of 23 benchmark experiments, KMM emerged as the most accurate method. Crucially, it consistently outperformed the standard "unweighted" machine learning baselines.
  • Outperforming the "Truth": Surprisingly, in some scenarios, KMM even outperformed reweighting methods that used the true sampling distribution. This indicates that KMM is highly effective at finding weights that are robust to the specific finite sample at hand.
  • Medical Impact: On high-stakes biological datasets where different lab protocols naturally create distribution shifts, KMM significantly improved classification accuracy. This highlights its potential as a vital tool for cross-platform medical diagnostics.
Test Error Comparison Across Training Proportions

Limitations and Future Work

While highly effective, KMM does have some limitations:

  • Computational Cost: KMM requires solving a Quadratic Program. While this is a standard optimization task, it can become computationally expensive for very large datasets.
  • Transductive Nature: The method requires access to a representative sample of unlabeled test data at the time of training to calculate the weights. It cannot proactively de-bias a model for a completely unknown future distribution.
  • Sample Size Sensitivity: Reweighting effectively reduces the "sample size" of the training set by down-weighting many points. Consequently, KMM may not be beneficial on very small datasets, as the reduction in effective sample size can lead to higher variance.

Summary updated

BibTeX
@inproceedings{huang2006correcting,
  author = {Jiayuan Huang and Alexander J. Smola and Arthur Gretton and Karsten M. Borgwardt and Bernhard Schölkopf},
  title = {{Correcting Sample Selection Bias by Unlabeled Data}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2006},
  url = {https://openreview.net/forum?id=19EQEfSW4cW},
}
Figure