Effects of sampling skewness of the importance-weighted risk estimator on model selection

Wouter M. Kouw, Marco Loog

TL;DR

Importance weighting is a standard technique used to correct for domain shift between training and test data, but this paper reveals a hidden trap: for small datasets, the risk estimator's sampling distribution is highly skewed. Because of this skew, the estimator usually underestimates the true risk, leading to suboptimal hyperparameter choices during cross-validation unless sufficient validation data is used.

What Problem Does This Paper Address?

In real-world machine learning, we often encounter covariate shift or sample selection bias—situations where the training data (source domain) does not perfectly represent the environment where the model will be deployed (target domain).

The standard fix for this is importance weighting: assigning higher weights to training samples that look like target samples, and lower weights to those that don't. This technique is widely used to evaluate models and tune hyperparameters via cross-validation. Mathematically, importance weighting is celebrated because it is an unbiased estimator—meaning, on average across infinite datasets, it perfectly guesses the true target risk.

However, practitioners don't have infinite datasets; they have one dataset. The authors ask a critical question: what does the actual distribution of these risk estimates look like for small sample sizes? If the distribution is heavily skewed, being "unbiased" on average doesn't prevent the estimator from being wildly inaccurate for the vast majority of individual datasets.

Methods

The authors approach this problem through both mathematical derivation and empirical simulation:

  • Mathematical Derivation: They derive the exact formulas for the sampling variance and the sampling skewness of the importance-weighted risk estimator, proving that multiplying a loss function by squared importance weights inherently scales up the skewness of the distribution.
  • Empirical Simulation: To visualize this, they set up a 1D synthetic classification problem. They used a linear classifier with $L_2$-regularization and a quadratic loss function.
  • Evaluation: They drew 10,000 small datasets, calculated the importance-weighted risk for each, and observed how the skewness affected the selection of the regularization parameter ($\lambda$). They specifically split the results into the "body" (the majority of datasets clustered together) and the "tail" (rare datasets with extreme values).

Datasets

No standard real-world benchmarks (like MNIST or CIFAR) were used. Instead, the authors generated a purely synthetic 1D dataset via rejection sampling to perfectly control the domain shift:

  • Target Domain: A standard normal distribution $\mathcal{N}(0, 1^2)$.
  • Source Domain: A narrower normal distribution $\mathcal{N}(0, 0.75^2)$.

Key Insights and Ideas

  • Unbiased $\neq$ Symmetric: Just because an estimator is unbiased doesn't mean it's reliable for a single small dataset. The heavy right-skew (positive skew) means the probability mass is concentrated to the left of the true mean. Consequently, the majority of datasets will yield an underestimate of the true risk.
  • The "Body" vs. "Tail" Illusion: The distribution consists of a dense "body" of underestimates, mathematically balanced out by a long, thin "tail" of rare, massive overestimates. They cancel out in expectation, but in practice, your specific dataset is highly likely to fall in the body.
  • Impact on Model Selection: Because most small datasets underestimate the risk, importance-weighted cross-validation will consistently pick the wrong hyperparameters. In their specific setup, it caused the model to overestimate the required regularization parameter for the majority of datasets.
  • The Cure is Data: Skewness is fundamentally a small-sample problem. As the sample size ($N$) increases, the skew diminishes, and the estimator becomes reliable.

Key Results

  • Extreme Skew at Small $N$: For a sample size of $N=2$, there were twice as many datasets in the "body" (underestimating risk) as in the tail.
  • Suboptimal Hyperparameters: For $N=2$, datasets in the body overestimated the optimal regularization parameter ($\lambda$) by roughly +1, while the rare datasets in the tail underestimated it by -2.
  • Convergence: As the sample size increased, the skewness vanished. By the time the sample size reached $N \ge 32$ in their synthetic setup, the difference between the body and tail estimates practically disappeared, resulting in accurate hyperparameter selection.

Limitations and Future Work

  • Toy Setting: The empirical study is limited to 1D Gaussian distributions and a quadratic loss function. While the math suggests the skewness applies broadly, the exact behavior in complex, high-dimensional spaces (like deep learning) wasn't tested.
  • Curse of Dimensionality: The authors hypothesize that in higher-dimensional, real-world settings, the amount of validation data required to overcome this skew is likely much larger than the $N=32$ observed in their 1D example.
  • Direction of Skew: The authors note that if the source domain is wider than the target domain (rather than narrower), the skew reverses (becomes negative), meaning the estimator will frequently overestimate the risk instead.

Summary updated

BibTeX
@inproceedings{kouw2018effects,
  author = {Wouter M. Kouw and Marco Loog},
  title = {{Effects of sampling skewness of the importance-weighted risk estimator on model selection}},
  booktitle = {ICPR},
  year = {2018},
  url = {https://openreview.net/forum?id=7rf07IQy4B6},
}

Loading related content...

Figure