While the classical KNN (k nearest neighbor) shares its avoidance of the consistent distribution assumption between training and testing samples to achieve fast prediction, it still faces two challenges: (a) its generalization ability heavily depends on an appropriate number k of nearest neighbors; (b) its prediction behavior lacks interpretability. In order to address the two challenges, a novel Bayes-decisive linear KNN with adaptive nearest neighbors (i.e., BLA-KNN) is proposed to obtain the following three merits: (a) a diagonal matrix is introduced to adaptively select the nearest neighbors and simultaneously improve the generalization capability of the proposed BLA-KNN method; (b) the proposed BLA-KNN method owns the group effect, which inherits and extends the group property of the sum of squares for total deviations by reflecting the training sample class-aware information in the group effect regularization term; (c) the prediction behavior of the proposed BLA-KNN method can be interpreted from the Bayes-decision-rule perspective. In order to do so, we first use a diagonal matrix to weigh each training sample so as to obtain the importance of the sample, while constraining the importance weights to ensure that the adaptive k value is carried out efficiently. Second, we introduce a class-aware information regularization term in the objective function to obtain the nearest neighbor group effect of the samples. Finally, we introduce linear expression weights related to the distance measure between the testing and training samples in the regularization term to ensure that the interpretation of Bayes-decision-rule can be performed smoothly. We also optimize the proposed objective function using an alternating optimization strategy. We experimentally demonstrate the effectiveness of the proposed BLA-KNN method by comparing it with 7 comparative methods on 15 benchmark datasets.
In sparse representation learning-based linear k-nearest neighbors methods, the linear representation assumption frequently fails when applied to nonlinear distributed data, leading to degraded generalization and a loss of physical interpretability. To address this, we propose the Kernelized Manifold-Optimized Linear Nearest Neighbor (KMOLNN) method. Methodologically, KMOLNN projects the data into a high-dimensional kernel space to capture the nonlinear relationships, while introducing an adaptive manifold-preserving regularization term—via an adaptive Laplacian matrix—to dynamically preserve the local geometric structures. Theoretically, this study provides a mathematical proof of the nearest neighbor group effect for the kernel framework and reveals that its weight optimization behavior implicitly implements the Bayesian decision rule. Furthermore, we derive a rigorous generalization error bound using Rademacher complexity to validate its theoretical robustness. Empirically, we evaluate KMOLNN on 15 small-to-medium-scale benchmark datasets against eight comparative methods, including recent variants. The results demonstrate significant numeric superiority, with KMOLNN achieving an average accuracy of 90.76% and a Macro F1-score of 88.62% across the evaluated datasets. Finally, we present a comprehensive runtime analysis, explicitly acknowledging that these gains in generalization capability and theoretical interpretability present a practical trade-off, requiring increased computational runtime due to the iterative alternating optimization process.