NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Constrained Least-Squares Density-Difference Estimation

Tuan Duong Nguyen, Marthinus Christoffel du Plessis, Takafumi Kanamori, Masashi Sugiyama · DOI

Abstract

Estimating the difference between two probability distributions is a fundamental challenge in machine learning, critical for tasks like detecting concept drift and medical image registration. While the Least-Squares Density-Difference (LSDD) estimator provides a direct "single-shot" approach, it often overlooks the intrinsic property that the integral of the difference between two probability densities must be zero. This paper introduces Constrained Least-Squares Density-Difference (CLSDD) estimation, which incorporates this mathematical constraint to improve accuracy and reduce variance.

Introduction

In many data-driven applications, understanding how two datasets differ is more important than modeling each dataset individually. For instance, in class-prior change scenarios, the distribution of labels may shift between training and deployment. A naive approach—estimating each density separately and subtracting them—often amplifies estimation errors. The LSDD method addressed this by estimating the difference directly. However, the authors demonstrate that LSDD can be further refined by enforcing the physical reality of probability densities: since every density integrates to 1, their difference must integrate to 0.

The CLSDD Method

The proposed CLSDD estimator builds upon a linear-in-parameter model, typically utilizing Gaussian kernels. The key innovation is the addition of a hard constraint to the squared-loss minimization problem: $\int g(x) dx = 0$. Using Karush-Kuhn-Tucker (KKT) conditions, the authors derive a closed-form analytical solution. This ensures that the added constraint does not sacrifice computational efficiency, as the model can still be solved using standard matrix algebra. Furthermore, theoretical analysis using the central limit theorem proves that CLSDD achieves lower asymptotic variance than its unconstrained predecessor.

Experimental Validation

The effectiveness of CLSDD was evaluated through synthetic simulations and real-world UCI benchmark datasets.

Visual comparison of LSDD and CLSDD estimates. The left panels show histograms of the two samples. The right panel displays the true densities $p(x)$ and $p'(x)$, the true difference $f(x)$, and the estimates. CLSDD (green) tracks the ground truth more accurately than LSDD (red).

In 1D artificial data experiments, CLSDD consistently produced estimates closer to the ground truth. As shown in the visual comparison above, the CLSDD curve (green) exhibits less oscillation and better alignment with the true difference $f(x)$ (black dashed line) compared to the standard LSDD (red).

Quantitative performance comparison. These plots show the Density Difference Square Error as a function of the mean $\mu_2$ of the second distribution. CLSDD consistently maintains a lower error and smaller variance across different distribution shifts.

Quantitatively, CLSDD demonstrated superior performance across various distribution parameters. As seen in the figure above, CLSDD maintains a significantly lower density difference square error than LSDD as the distribution mean shifts. On real-world datasets like Adult, Image, and Sonar, CLSDD improved semi-supervised class-balance estimation, leading to more accurate classification weights and lower overall misclassification rates.

Conclusion

CLSDD represents a significant advancement in density difference estimation by integrating domain-specific mathematical constraints into the optimization process. By enforcing the zero-integral property, the method achieves higher accuracy and stability without increasing computational complexity. While its performance depends on the appropriate selection of basis functions, CLSDD offers a robust and practical tool for modern machine learning pipelines.

Summary updated

BibTeX
@article{nguyen2014constrained,
  author = {Tuan Duong Nguyen and Marthinus Christoffel du Plessis and Takafumi Kanamori and Masashi Sugiyama},
  title = {{Constrained Least-Squares Density-Difference Estimation}},
  journal = {IEICE Trans. Information and Systems},
  year = {2014},
  doi = {10.1587/transinf.e97.d.1822},
}
Figure