kNNSampler: Stochastic Imputations for Recovering Missing Value Distributions

Parastoo Pashmchi, Jérôme Benoit, Motonobu Kanagawa
9/10/2025
stat.MLcs.LGmath.ST

Official code: SAP/knn-sampler (10 stars, Apache-2.0, last commit 2026-05-04).

Abstract

We study a missing-value imputation method, termed kNNSampler, that imputes a given unit's missing response by randomly sampling from the observed responses of the $k$ most similar units to the given unit in terms of the observed covariates. This method can sample unknown missing values from their distributions, quantify the uncertainties of missing values, and be readily used for multiple imputation. Unlike popular kNNImputer, which estimates the conditional mean of a missing response given an observed covariate, kNNSampler is theoretically shown to estimate the conditional distribution of a missing response given an observed covariate. Experiments illustrate the performance of kNNSampler. The code for kNNSampler is made publicly available (https://github.com/SAP/knn-sampler).

View on arXivView PDF

Code Implementations(1)

SAP/knn-samplerOfficial100%
Apache-2.0

Machine learning imputation method to recover the distribution of missing values, based on kNN. This method can be enabled to be used as multiple imputation and provide uncertainty quantification.

102Python, Jupyter NotebookApr 29, 20245 months agoApache-2.0
imputationmachine-learning

Cite this paper

@article{pashmchi2025knnsampler,
  title  = {kNNSampler: Stochastic Imputations for Recovering Missing Value Distributions},
  author = {Parastoo Pashmchi and Jérôme Benoit and Motonobu Kanagawa},
  year   = {2025},
  eprint = {2509.08366},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.08366v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2509.08366.svg)](https://codeofpaper.com/paper/2509.08366)

Discussion