On adaptivity and minimax optimality of two-sided nearest neighbors

Tathagata Sadhukhan, Manit Paul, Raaz Dwivedi · DOI

Introduction

Matrix completion—the task of predicting missing entries in a partially observed grid—is a cornerstone of modern data science, powering everything from recommendation engines to counterfactual analysis in healthcare. Traditionally, the field has relied heavily on the assumption that the underlying matrix is low-rank and bilinear. While mathematically convenient, these assumptions often fail to capture the complexity of real-world data, which frequently exhibits non-linear relationships, non-smooth patterns, and "Missing Not At Random" (MNAR) biases.

This paper introduces the Two-Sided Nearest Neighbors (TS-NN) algorithm, a non-parametric approach that moves beyond the low-rank paradigm. By leveraging local similarities across both rows and columns simultaneously, TS-NN achieves minimax optimality across a broad class of functions, including those with low smoothness, while remaining robust to biased missingness patterns.

Problem Formulation: Beyond Low-Rank Smoothness

Most matrix completion literature assumes the data follows a smooth, Lipschitz-continuous structure. This research expands the scope to the Hölder class, allowing for "jaggier" or less smooth functions where the smoothness parameter $\lambda$ can be less than one. This is critical for modeling real-world phenomena that exhibit abrupt changes or high local variability.

Furthermore, the authors address the challenge of MNAR data. In many applications, such as the Netflix Prize, data is not missing by accident; users are more likely to rate items they feel strongly about. This creates a selection bias that invalidates many standard singular value thresholding or nuclear norm minimization techniques. TS-NN is designed to remain consistent even when the probability of observation is tied to the underlying signal.

The Two-Sided Nearest Neighbors (TS-NN) Algorithm

The TS-NN algorithm operates on the principle of collaborative filtering but applies it symmetrically. The estimation process consists of three primary phases:

  1. Distance Estimation: The algorithm calculates the distance between two rows (or columns) by comparing observed entries in their intersection. Unlike standard methods that might require a full latent factor model, this approach relies only on the empirical distances between observed features.
  2. Neighborhood Construction: For a target entry $(i, j)$, the algorithm identifies a set of nearest neighbor rows for $i$ and a set of nearest neighbor columns for $j$.
  3. Two-Sided Averaging: The missing value at $(i, j)$ is estimated by averaging the observed values found at the intersection of these row and column neighborhoods.

Theoretical Contributions

A key contribution of this work is the proof of adaptivity. The TS-NN algorithm does not require prior knowledge of the smoothness parameter $\lambda$. It automatically adapts to the underlying regularity of the data, achieving the minimax optimal error rate of $O((mn)^{-2\lambda / (2\lambda + d_1 + d_2)})$, where $m$ and $n$ are the matrix dimensions and $d_1, d_2$ are the dimensions of the latent spaces.

Furthermore, the authors establish an Oracle Equivalence: TS-NN performs asymptotically as well as an "oracle" estimator that has access to the true latent factors of the users and items. The paper also provides a Central Limit Theorem (CLT) for the TS-NN estimator, enabling the construction of valid confidence intervals for the imputed values.

Empirical Validation

Synthetic Simulations

The authors tested TS-NN against industry-standard baselines, including SoftImpute and Universal Singular Value Thresholding (USVT). In scenarios involving Hölder-smooth functions and deterministic MNAR patterns (where 20% of data was missing based on signal strength), TS-NN consistently demonstrated lower Mean Squared Error (MSE). As the matrix size increased, the performance gap between TS-NN and traditional low-rank methods widened, highlighting the algorithm's superior scalability in terms of accuracy.

HeartSteps Case Study

The algorithm was applied to the HeartSteps dataset, a mobile health study tracking physical activity. In this context, matrix completion is used to estimate counterfactuals—predicting a user's step count had they received a different notification at a specific time. With 37 users and 210 decision points, the data is sparse and likely non-linear. TS-NN achieved the lowest median error and the most stable error distribution compared to five other nearest-neighbor and matrix-factorization baselines, proving its utility in high-stakes, real-world decision-making environments.

Discussion and Limitations

While TS-NN offers significant theoretical and practical advantages, the authors identify several areas for future research:

  • Computational Complexity: The current implementation scales at $O(n^2m + m^2n)$. For massive datasets (e.g., millions of users and items), further optimization or approximate nearest neighbor techniques will be required.
  • Latent Independence: The theory assumes that row and column latent factors are independent. Future work could explore dependencies, such as social network influences among users or temporal trends among items.
  • Higher-Order Smoothness: While the algorithm excels in the Hölder class ($\lambda < 1$), its performance relative to kernel-based methods for extremely smooth functions (where $\lambda > 1$) remains an open question.

Conclusion

Two-Sided Nearest Neighbors represents a significant step forward in making matrix completion robust for real-world applications. By providing a minimax optimal, adaptive, and non-parametric framework, the authors bridge the gap between theoretical graphon estimation and practical recommender systems, offering a new gold standard for handling complex, biased, and non-smooth data.

Summary updated

BibTeX
@inproceedings{sadhukhan2025adaptivity,
  author = {Tathagata Sadhukhan and Manit Paul and Raaz Dwivedi},
  title = {{On adaptivity and minimax optimality of two-sided nearest neighbors}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=fThPOZ1GKW},
}
Figure