arXiv:2610.40579cs.DBOct 2026

Manuscript Offprint

arXiv:2610.40579

When Imputation Changes the Nearest Neighbor: Exact Certification of Similarity Retrieval for Incomplete Sensor Time Series

Jianru Shen

Jianru Shen

Columbia University

New York, NY, USA

js5929@columbia.edu

Abstract—Sensor time series routinely reach similarity search with missing values, and the retrieved neighbours then depend on how the gaps were filled. We ask which retrieval conclusions hold for every admissible completion of an incomplete query. For a family of window-minimum distances that contains the L1 distance as its separable end we give a pairwise certificate that one candidate is strictly closer than another, a guaranteed candidate set that contains every possible nearest neighbour, and a certificate that a nearest-neighbour label cannot change. The guarantees hold uniformly over the specified box and apply to the true query whenever it lies inside. At the separable end a closed form is known, but beyond it the worst-case gap need not be attained at a corner of the box. We prove a finite reduction to critical values, give an exact interval dynamic programme for the worst-case ranking gap, and a quadratic-time fast layer of valid bounds and feasible witnesses, supported by an exact criterion for when the feature-box relaxation is tight. On three traffic-sensor collections with real gap patterns, linear interpolation changes the nearest neighbour in 15 to 33 percent of the queries. At the full band the feature-box relaxation misses up to 14 percent of the exactly stable boundary pairs, whereas fixed-completion and Monte Carlo checks issue false certificates. The fast layer resolves about 90 percent of all tested boundary pairs without dynamic programming, and on paired network-scale queries the exact method is 82 to 110 times faster than the programme alone. Label certificates transfer to three public benchmarks, and the band width trades forecasting accuracy and certification coverage for lower imputation sensitivity, with dataset-dependent crossovers.

Index Terms—similarity search, missing values, time series, certified retrieval, dynamic programming, sensor data

I. INTRODUCTION

A sensor produces one series per day, and a common way to use such data is to look up similar days. An operator asks which past afternoons looked like today on this loop detector, a forecaster averages the hours that followed those afternoons, and a classifier takes the label of the closest day. When today has gaps, practice fills them by some rule and then ranks the archive as if the data were complete. The ranking then belongs to the rule as much as to the data. On three public traffic-sensor collections with real gap patterns, filling the gaps by linear interpolation returns a nearest neighbour different from the one the true series would return for 15% to 33% of the queries, and the historical mean does so for up to 44%.

This paper asks a question that does not depend on any rule. Given only bounds on the missing values, which retrieval conclusions hold no matter how the gaps are filled. We answer it for a family of window-minimum distances, which compare two series through the minimum of every time span up to a chosen width. One end of the family is the L1 distance, where every coordinate is compared on its own. The other end compares the deepest congestion in every span, a natural quantity for speed data. In between, a band width trades one for the other. We do not claim that this family beats L1 or warping distances. It carries a window semantics that some users want, and it is a simple nonseparable family in which exact certification is needed, because the worst completion need not lie at a corner of the box. The unit of every guarantee is the worst-case ranking gap of a pair of candidates over the box, certified when negative, and the two-slot example in Fig. 1 shows a worst-case gap not attained at a corner, which corner-only checks miss. Section VI shows where the augmented fixed-completion and Monte Carlo baselines fail.

Our goal is exact certification for a distance family with overlapping-window semantics, and the guarantees hold uniformly over the specified uncertainty box and apply to the true query whenever it lies in that box. In summary, this paper makes three contributions.

• Exact worst-case analysis. We prove a finite reduction to critical values and derive an exact interval dynamic programme that computes the worst-case gap in O(n3m)O(n^{3}m) time and O(n2)O(n^{2}) space for the value, where m≤4nm \leq 4n is the number of critical values.

• Fast and complete pairwise certification. We characterise exactly when the feature-box relaxation is tight and construct a witness completion in O(n2)O(n^{2}) time. Combining the bound, witness checks and the programme gives ExactCert, which decides whether Γ(a,b)<0\Gamma(a,b) < 0 for every pair and supports sound candidate sets and sufficient label-invariance certificates.

• Evaluation on six datasets. We quantify imputation-induced retrieval changes, certification quality, computational cost and band-width trade-offs on three traffic datasets with real gap patterns and three UCR benchmarks.

(a)

Figure

(b)

Figure

Fig. 1. Overview. (a) The two-slot example of Section IV. Filled circles are the two corners of the box, where aa is closer, but every completion with tt in the shaded range makes bb closer, so checking only the corners is insufficient. (b) ExactCert. The fast layer certifies a pair from a cheap bound or refutes it from a few witness completions, the exact layer runs the dynamic programme on the pairs that remain, and every outcome is an exact decision of Γ<0\Gamma < 0. The pairwise verdicts assemble into the derived guarantees.