Generalizing Importance Weighting to A Universal Solver for Distribution Shift Problems

Tongtong Fang, Nan Lu, Gang Niu, Masashi Sugiyama · DOI

In the ideal landscape of machine learning, training data serves as a perfect mirror of the real-world environments where models are deployed. In practice, however, researchers and engineers almost universally encounter distribution shift (DS)—a phenomenon where the training and test data distributions diverge. While Importance Weighting (IW) has long been the standard approach for correcting these shifts, recent research from the University of Tokyo, RIKEN, and the University of Tübingen identifies a critical failure point: traditional IW cannot account for "unseen" regions in the test data that the training set never covered.

Presented at NeurIPS 2023, "Generalizing Importance Weighting to A Universal Solver for Distribution Shift Problems" introduces Generalized Importance Weighting (GIW). This framework is designed to serve as a universal solver capable of handling any distribution shift scenario, including those involving support shifts.

The Fundamental Problem: Support Shift

Most research into distribution shift focuses on the shape of probability densities. However, this paper argues that the more fundamental issue lies in the support—the set of points where the probability density is non-zero. The authors categorize the relationship between training support ($S_{tr}$) and test support ($S_{te}$) into four distinct cases:

  1. Exact Match: $S_{tr} = S_{te}$.
  2. Train covers Test: $S_{tr} \supset S_{te}$.
  3. Test covers Train: $S_{te} \supset S_{tr}$ (The "Unseen" problem).
  4. Partial Overlap: $S_{tr} \cap S_{te} \neq \emptyset$, but both have unique regions.

Traditional IW is highly effective for cases 1 and 2, where it reweights training samples to match the test distribution. However, in cases 3 and 4—which are common due to data-collection biases—IW becomes mathematically "risk-inconsistent." Because it cannot reweight what it has never seen, IW essentially ignores the parts of the test set outside the training support. This leads to models that guess wildly or fail to generalize in these "unseen" regions, often resulting in an over-optimistic view of model performance.

The GIW Framework: A Divide and Conquer Approach

To address this, the authors propose Generalized Importance Weighting (GIW). The core innovation is a mathematical decomposition of the test risk into two manageable parts:

1. Support Splitting

The framework splits the test support into an In-Training (IT) region (where training data exists) and an Out-of-Training (OOT) region (where it does not). To implement this practically, the authors utilize a One-Class SVM (O-SVM) on the latent features of a pre-trained model to automatically detect which validation samples belong to the "seen" versus "unseen" regions.

2. Risk Decomposition

The total risk is rewritten as a weighted sum of two terms:

  • Weighted Classification Term: This handles the IT part using standard importance weighting techniques.
  • Standard Classification Term: This handles the OOT part by utilizing labeled validation data that is representative of the test distribution.

3. Joint Training and Dynamic Weighting

For the IT component, the authors employ Dynamic Importance Weighting (DIW), allowing weights to be learned alongside the deep neural network. The model is then trained simultaneously on the reweighted training data and the raw OOT validation data, ensuring the classifier learns features relevant to the entire test support.

Experimental Validation

The authors tested GIW against several support shift benchmarks, including MNIST, Color-MNIST, and CIFAR-20. In these scenarios, the training set was intentionally restricted (e.g., training only on red digits or a subset of classes) while the test set included the full variety.

  • Superior Accuracy: In the Color-MNIST "Test covers Train" scenario, GIW achieved approximately 93.8% accuracy. In contrast, standard IW methods struggled at around 39%, and Domain Adaptation (DA) methods like DANN only reached 64%.
  • Robustness to Noise: GIW demonstrated significant resilience to label noise. With 40% noise, GIW maintained ~93% accuracy on MNIST, whereas DANN performance dropped to ~65%.
  • Feature Recovery: Visualization of convolution kernels revealed that GIW was the only method that successfully learned to recognize features across all color channels. Other methods overfitted to the specific colors present in the training set.

Conclusion and Future Directions

GIW represents a "safe" generalization of importance weighting. If no OOT data exists (Cases 1 or 2), the OOT term in the GIW objective naturally disappears, and the framework reduces back to standard IW. This makes it a robust choice for practitioners who may not know the exact nature of the distribution shift beforehand.

However, the framework does rely on the availability of a validation set that is "exactly test-distributed." If this validation set is biased or extremely small, the model may overfit to those specific OOT samples. Future research may explore reducing this dependency through semi-supervised or self-supervised techniques to further enhance the universality of the GIW solver.

Summary updated

BibTeX
@inproceedings{fang2023generalizing,
  author = {Tongtong Fang and Nan Lu and Gang Niu and Masashi Sugiyama},
  title = {{Generalizing Importance Weighting to A Universal Solver for Distribution Shift Problems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=KmdlUP23qh},
}
Figure