Source-linked AI summary
KNN Classification with One-step Computation
Shichao Zhang, Jiaye Li
TL;DR
KNN's query-time setting of K and search for neighbors can make neighbor search a bottleneck. The paper replaces that lazy step with a one-step matrix computation and a new classification rule. Experiments report higher average classification performance than KNN and DCLA-KNN, as well as improvements in accuracy and running cost over state-of-the-art methods.
Problem
Standard KNN selects K and searches for neighbors when predicting a test item, and the full training-space neighbor search is described as a bottleneck.
Source: §1 · p. 1Method
The method fits training samples to a test item with least-squares loss, weights them into a relationship matrix, and uses group lasso for sparse learning in one computation.
Source: §1 · pp. 1–2Results
Average classification performance increases by 7.24% over KNN and 4.16% over DCLA-KNN across all datasets; the conclusion also reports exceeding state-of-the-art methods in ACC and running cost.
Source: §4 · p. 9, §5 · p. 12Takeaways & Limitations
The approach learns the test item's K value and neighbors during training, offering a non-lazy alternative to query-time KNN search.
Source: §1 · p. 2
Abstract
from arXiv · showhide
KNN classification is an improvisational learning mode, in which they are carried out only when a test data is predicted that set a suitable K value and search the K nearest neighbors from the whole training sample space, referred them to the lazy part of KNN classification. This lazy part has been the bottleneck problem of applying KNN classification due to the complete search of K nearest neighbors. In this paper, a one-step computation is proposed to replace the lazy part of KNN classification. The one-step computation actually transforms the lazy part to a matrix computation as follows. Given a test data, training samples are first applied to fit the test data with the least squares loss function. And then, a relationship matrix is generated by weighting all training samples according to their influence on the test data. Finally, a group lasso is employed to perform sparse learning of the relationship matrix. In this way, setting K value and searching K nearest neighbors are both integrated to a unified computation. In addition, a new classification rule is proposed for improving the performance of one-step KNN classification. The proposed approach is experimentally evaluated, and demonstrated that the one-step KNN classification is efficient and promising
1 INTRODUCTION
Standard KNN selects K and searches neighbors when a test item arrives, leaving a lazy, potentially costly search step. This paper proposes a non-lazy one-step computation that combines those tasks and reports improved classification performance and running cost.
1 INTRODUCTION
- Earlier approaches addressed K selection or neighbor search, while the paper identifies combining both through one-step calculation as a new contribution.The introduction distinguishes this from K*tree, which requires two steps.Source: §1 · pp. 1–2
- K*tree is non-lazy but still handles K selection and neighbor search in two phases, while neighbor search generally scans the full training space.For K*tree, one step finds a nearest neighbor and K; another identifies K−1 neighbors from that neighbor's set.Source: §1 · p. 1
- The proposed one-step computation combines K selection and neighbor search, reducing the stated search complexity to O(N^2).It first fits training samples to the test data using least-squares loss.Source: §1 · p. 1
- A relationship matrix weights training samples by their influence on the test data, and group lasso sparsely learns that matrix.The paper also proposes a new classification rule to improve one-step KNN performance.Source: §1 · p. 2
- The proposed algorithm is reported to exceed state-of-the-art methods in classification performance and running cost.The paper presents it as learning the test data's K value and neighbors during training.Source: §1 · p. 2
2 PRELIMINARY
The preliminary section reviews K-value selection, neighbor search, and adaptations of KNN to different data and tasks. It frames the paper's novelty as combining K selection and neighbor search in one calculation.
2 PRELIMINARY
- Expert settings and cross-validation assign the same K to all test data; too-small K risks overfitting, while too-large K increases approximate error.Reviewed alternatives include adaptive K selection and class-dependent neighbor counts.Source: §2 · p. 2
- Ktree predicts a test item's K but searches the full training set, whereas K*tree narrows the search to neighbor information stored in corresponding leaves.The paper says this reduces K*tree's running time relative to Ktree.Source: §2 · p. 2
- Related work improves neighbor search through distance or similarity functions, including local, paired, and low-rank metrics for varied classification settings.Examples include indoor positioning, MRI, soil classification, and time-series classification.Source: §2 · pp. 2–3
- Other reviewed variants combine KNN with multi-label inference, robustness methods, anomaly detection, compression, or dimensionality reduction.The section also surveys applications and adaptations such as tremor recognition and progressive top-KNN search.Source: §2 · p. 3
- The paper identifies one-step calculation for both selecting K and finding neighbors as work not previously done.It notes that prior work had focused more on neighbor search than K selection.Source: §2 · p. 3
3 OUR APPROACH
The approach replaces nearest-neighbor search with a sparse relationship matrix that jointly encodes each test sample’s K value and neighbors. It then uses the selected neighbors’ weights to classify the test data.
3.1 Notation
- The notation distinguishes matrices from vectors and defines X as the training data matrix and Y as the test data matrix.The section also specifies transpose, inverse, and trace notation.Source: §3.1 · p. 3
3.2.1 Sparse Model Based on Linear Representation
- Least-squares fitting and an improved group-lasso constraint produce a sparse relationship matrix for the test data.The paper uses least squares for its high fit and describes group lasso as the sparse restriction.Source: §3.2.1 · p. 4
- Each column of W represents one test sample; its nonzero count gives that sample’s optimal K, and the nonzero entries identify its neighbors.The relationship matrix contains each test sample’s optimal K value and corresponding nearest neighbors.Source: §3.2.1 · pp. 4–5
- The classification rule uses Q to weight selected neighbors, since entries of W for non-neighbors are zero.The predicted class label is obtained using the indicator function in the rule.Source: §3.2.1 · p. 5
- The group-lasso formulation groups training samples, promotes within-group sparsity, and weights training samples to reflect their importance.The authors say this grouping considers similarity relationships among the data.Source: §3.2.1 · pp. 4–5
- The algorithm updates W using Equation (18), and its objective value decreases monotonically at each iteration.The pseudocode stops when the algorithm converges.Source: §3.2.1 · p. 6
4 EXPERIMENTS
The experiments compare classification performance and running cost across simulated and UCI datasets. The proposed method reports gains on real datasets and simulated Data1 and Data3, while parameter sensitivity, convergence, and runtime are also evaluated.
4 EXPERIMENTS
- Evaluation used four simulated datasets and 12 UCI datasets, with 10-fold cross-validation.The simulated sets included binary and multiclass tasks; the UCI collection likewise included six of each.Source: §4 · pp. 7–8
- On simulated Data1 and Data3, the proposed method achieved the best performance; on Data3, it improved by 5.46% over KNN and 0.22% over DCLA-KNN.Results on Data2 and Data4 were similar across algorithms, which the authors attribute to dataset distribution, including redundant features.Source: §4 · p. 8, Table 3 · p. 9
- On real datasets, the proposed method averaged increases of 7.24% over KNN and 4.16% over DCLA-KNN.Table 5 reports accuracy for UCI datasets.Source: §4 · p. 9, Table 5 · p. 11
4.5.2 Parameter Sensitivity
- The proposed method is more sensitive to parameters a and b, so their values require careful adjustment.Both parameters control neighbor weights, and b also affects the sparsity of W and the number of neighbors.Source: §4.5.2 · pp. 9–10, Figure 5 · p. 9
4.5.3 Convergence Analysis
- The objective function value gradually decreases to convergence, usually within 15 iterations across datasets.The reported stopping condition uses a relative objective-function change threshold of 10^-5.Source: Figure 3 · p. 8, §4.5.3 · p. 10, Figure 6 · p. 10
4.5.4 Running Cost Analysis
- The proposed method has the lowest running cost; KNN, W-KNN, and K*tree are also low-cost, while CF-KNN, LMRKNN, and DCLA-KNN cost more.The running-cost comparison covers simulated and real datasets.Source: §4.5.4 · pp. 10, 12, Table 4 · p. 11, Table 6 · p. 12
5 CONCLUSION
The conclusion presents one-step KNN as a unified computation using least-squares fitting and a relationship matrix, followed by weighted classification. Experiments report advantages over state-of-the-art methods, while future work targets high-dimensional data and feature selection.
- Experiments on simulated and UCI datasets show the proposed algorithm exceeds state-of-the-art methods in ACC and running cost.Source: §5 · p. 12
- The method uses least-squares loss and an l2,1-norm to obtain a relationship matrix and weight vector, then classifies with weighted rules.Source: §5 · p. 12
- Future work proposes a new metric function to improve KNN’s applicability to high-dimensional data, where Euclidean distance is less applicable.Source: §5 · p. 12
- The authors also plan to embed feature selection into KNN, with dimensionality-reduction results acting on KNN and KNN classification results reacting on feature selection.Source: §5 · p. 12