Meta-Learning for Relative Density-Ratio Estimation

Atsutoshi Kumagai, Tomoharu Iwata, Yasuhiro Fujiwara

TL;DR

Estimating the ratio between two probability distributions typically requires large sample sizes, making it impractical in few-shot regimes like clinical trials or newly deployed systems. This paper introduces the first meta-learning framework for relative density-ratio estimation (relative DRE), pairing permutation-invariant dataset embeddings with a differentiable, closed-form linear solver. By training end-to-end across related source datasets, the model quickly adapts to unseen target distributions with as few as one to five samples.

What Problem Does This Paper Address?

The density ratio $r(x) = p_{\text{nu}}(x) / p_{\text{de}}(x)$ compares two probability distributions directly without having to solve the notoriously difficult task of estimating each density individually. It underpins crucial machine learning tasks such as covariate shift adaptation, two-sample dataset comparison, and outlier detection.

Because standard density ratios can diverge to infinity when the denominator density is small, practitioners rely on relative density ratios—$r_\alpha(x) = \frac{p_{\text{nu}}(x)}{\alpha p_{\text{nu}}(x) + (1-\alpha) p_{\text{de}}(x)}$ for $\alpha \in [0, 1)$—which are strictly bounded by $1/\alpha$ and much smoother. However, existing relative DRE techniques (like RuLSIF) and deep DRE models require abundant samples. When only a tiny handful of instances are available (e.g., $N_S \le 5$), classical kernel methods fail to generalize, and standard deep neural networks severely overfit.

Methods

The authors cast relative DRE as a meta-learning problem, training across a collection of related source datasets to learn how to adapt from few-shot support sets:

Support sets (S_nu, S_de) ──> Permutation-Invariant Nets (f, g) ──> Context vectors (z_nu, z_de)
                                                                            │
Query instance x ───────────> Feature Embedding Net h([x, z_nu, z_de]) ─────┘
                                        │
                      Closed-Form RuLSIF Linear Solver: w* = (K + λI)⁻¹ k
                                        │
                             Relative Density Ratio r̂_α(x)
  1. Dataset Representation: Using permutation-invariant DeepSets-style networks, the model computes global latent summary vectors for the numerator and denominator support sets: $$z = g\left(\frac{1}{|S|} \sum_{x \in S} f(x)\right)$$
  2. Context-Aware Embeddings: A feed-forward network maps each instance $x$ into an embedding space conditioned on both datasets: $h([x, z_{\text{nu}}, z_{\text{de}}])$.
  3. Differentiable Closed-Form Solver: The relative density ratio is modeled as a linear function over the embeddings, $w^\top h(\cdot)$. Under an $\ell_2$-regularized squared error, optimal linear weights $\tilde{w}$ have a closed-form solution: $$\tilde{w} = (K + \lambda I)^{-1} k$$ Negative weights are clamped via $\hat{w} = \max(0, \tilde{w})$ to preserve non-negativity.

  4. End-to-End Meta-Training: Because the closed-form adaptation is completely differentiable, the entire system (the neural nets $f, g, h$, and regularizer $\lambda$) is trained via Adam on query sets from the source tasks. This circumvents the expensive, unrolled optimization steps typical of MAML-style gradient meta-learners.

Datasets

The authors evaluated the method across three distinct task formulations using both synthetic and real-world benchmarks:

  • Synthetic Data: One-dimensional Gaussian distributions with randomly sampled means and variances (600 source, 3 validation, 20 target datasets).
  • Mnist-r: MNIST digits rotated across 6 angles ($0^\circ$ to $75^\circ$), forming 60 domain/class tasks.
  • Isolet: Audio recordings of spoken letters grouped into 5 speaker clusters, yielding 130 datasets.
  • Outlier Detection Benchmarks: IoT (network traffic from 9 malware-infected devices), Landmine (29 radar imaging datasets), and School (74 school performance datasets).

Key Insights and Ideas

  • Convex Solvers in the Meta-Loop: Instead of relying on approximate recurrent adaptation (like Neural Processes) or high-order backpropagation through optimization steps (like MAML), plugging an exact regularized least-squares solver into the final layer guarantees global optimality for the support task while remaining completely differentiable.
  • Two-Tier Adaptation: The model adapts at two complementary levels: coarsely via the permutation-invariant dataset embeddings ($z_{\text{nu}}, z_{\text{de}}$) that inform the representation, and finely via the support-adapted linear coefficients $\hat{w}$. Ablation experiments confirmed that removing either stage sharply degrades performance.

Key Results

  • Relative DRE: The proposed method substantially lowered test squared errors compared to kernel RuLSIF and a fine-tuned deep baseline (RuLSIF-FT). On Mnist-r, the average test squared error was -0.754 (Ours) vs. -0.580 (RuLSIF) and -0.515 (RuLSIF-FT); on Isolet, it achieved -0.895 vs. -0.681 (RuLSIF).
  • Dataset Comparison: In 1-shot dataset comparison ($N_S = 1$), the method achieved 83.53% AUC on Mnist-r (where RuLSIF scored 47.86% and MMD scored 45.14%) and 96.28% AUC on Isolet (RuLSIF: 50.18%).
  • Inlier-Based Outlier Detection: Across IoT, Landmine, and School datasets, the model outperformed 13 baselines—including LOF, Isolation Forests, Deep SVDD, and autoencoders—averaging 75.27% AUC across all sets.
  • Runtime Efficiency: During testing, evaluating 100 dataset comparisons took only 0.32 seconds on a standard CPU—on par with simple kernel methods (0.38s) and orders of magnitude faster than retraining deep DRE models from scratch.

Limitations and Future Work

  • Negative Transfer: If target distributions differ radically from the source distribution family, performance can degrade (a persistent open challenge in meta-learning).
  • Model Scope: The current derivation is tailored to squared-loss relative DRE; incorporating alternatives like telescopic DRE remains future work.
  • Data Privacy Risks: Meta-learning assumes access to pooled multi-source data, raising security and privacy concerns when source datasets originate from multiple distinct owners.

Summary updated

BibTeX
@inproceedings{kumagai2021meta,
  author = {Atsutoshi Kumagai and Tomoharu Iwata and Yasuhiro Fujiwara},
  title = {{Meta-Learning for Relative Density-Ratio Estimation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=NBpwZs6sm2},
}
Figure