Nearest-neighbor classification is widely used in machine learning, yet existing methods often suffer from low computational efficiency and limited robustness in noisy environments. To jointly address these challenges, this paper proposes an efficient and reliable weighted $K$-nearest neighbor classification framework based on quantum granular balls, termed QGB-W$k$NN. The proposed framework improves computational efficiency by integrating quantum-enhanced granular-ball representation with hierarchical nearest-neighbor search, while enhancing classification reliability through a purity-aware weighted decision mechanism. Specifically, quantum-kernel granular balls are constructed to reduce retrieval redundancy and strengthen nonlinear feature representation under limited quantum resources. A granular-ball purity-guided HNSW optimization strategy is developed to exploit structural reliability for hierarchical graph construction during neighbor retrieval, alleviating the local optimality issue caused by conventional random layering. Finally, a weighted voting mechanism jointly incorporating granular-ball similarity and purity is introduced to produce more reliable classification decisions in noisy environments. Extensive experiments on benchmark datasets demonstrate that QGB-W$k$NN achieves competitive classification accuracy while exhibiting favorable Pareto trade-offs between classification performance and computational cost. Moreover, the proposed framework consistently improves robustness under various noisy conditions, suggesting that reliability-aware quantum granular-ball learning provides a promising paradigm for efficient and robust nearest-neighbor classification.
QGB-WkNN: Quantum Granular-Ball Learning for Robust Classification
Nearest-neighbor classification is widely used in machine learning, yet existing methods often suffer from low computational efficiency and limited robustness in noisy environments. To jointly address these challenges, this paper proposes an efficient and reliable weighted K-nearest neighbor classification framework based on quantum granular balls, termed QGB-WkNN. The proposed framework improves computational efficiency by integrating quantum-enhanced granular-ball representation with hierarchical nearest-neighbor search, while enhancing classification reliability through a purity-aware weighted decision mechanism. Specifically, quantum-kernel granular balls are constructed to reduce retrieval redundancy and strengthen nonlinear feature representation under limited quantum resources. A granular-ball purity-guided HNSW optimization strategy is developed to exploit structural reliability for hierarchical graph construction during neighbor retrieval, alleviating the local optimality issue caused by conventional random layering. Finally, a weighted voting mechanism jointly incorporating granular-ball similarity and purity is introduced to produce more reliable classification decisions in noisy environments. Extensive experiments on benchmark datasets demonstrate that QGB-WkNN achieves competitive classification accuracy while exhibiting favorable Pareto trade-offs between classification performance and computational cost. Moreover, the proposed framework consistently improves robustness under various noisy conditions, suggesting that reliability-aware quantum granular-ball learning provides a promising paradigm for efficient and robust nearest-neighbor classification.
High time complexity is one of the biggest challenges faced by k-Nearest Neighbors (kNN). Although current classical and quantum kNN algorithms have made some improvements, they still have a speed bottleneck when facing large amounts of data. To address this issue, we propose an innovative algorithm called Granular-Ball based Quantum kNN(GB-QkNN). This approach achieves higher efficiency by first employing granular-balls, which reduces the data size needed to processed. The search process is then accelerated by adopting a Hierarchical Navigable Small World (HNSW) method. Moreover, we optimize the time-consuming steps, such as distance calculation, of the HNSW via quantization, further reducing the time complexity of the construct and search process. By combining the use of granular-balls and quantization of the HNSW method, our approach manages to take advantage of these treatments and significantly reduces the time complexity of the kNN-like algorithms, as revealed by a comprehensive complexity analysis.
Quantum clustering aims to exploit quantum feature representations to uncover complex data structures beyond conventional Euclidean geometry. Yet this sample-level kernel construction requires O(n^2) quantum circuit executions for n data points, creating a major bottleneck under near-term quantum resource constraints. Prior solutions fail to resolve this efficiency-accuracy dilemma: classical granular-ball clustering reduces sample complexity but relies on Euclidean metrics that cannot capture quantum correlations, while existing quantum compression schemes prioritize efficiency over structural preservation, degrading performance on non-convex or noisy data. Here we propose Granular-Ball Quantum Clustering (GBQC), a framework that tightly couples granular-ball structural abstraction with quantum feature learning. GBQC first compresses raw data into compact, representative granular balls via a PCA-guided splitting strategy, reducing kernel evaluations by 80% compared to full-sample methods. A quantum cohesion mechanism then filters noisy granules in Hilbert space to improve clustering robustness. Extensive experiments on synthetic, noisy, overlapping, and real-world datasets demonstrate that GBQC consistently achieves superior clustering accuracy and robustness compared with representative classical and quantum clustering methods. Meanwhile, the proposed granular-ball compression significantly reduces quantum kernel evaluations and computational overhead, enabling quantum clustering experiments on larger datasets within parameterized quantum learning frameworks. These results suggest that granular-ball representations serve not only as a compression mechanism to reduce quantum computational costs but also as an effective structural abstraction mechanism that improves clustering quality by eliminating redundant and structurally ambiguous learning units.
This paper presents a novel quantum K-nearest neighbors (QKNN) algorithm, which offers improved performance over the classical k-NN technique by incorporating quantum computing (QC) techniques to enhance classification accuracy, scalability, and robustness. The proposed modifications focus on optimizing quantum data encoding using Hadamard and rotation gates, ensuring more effective rendering of classical data in quantum states. In addition, the quantum feature extraction process is significantly enhanced by the use of entangled gates such as IsingXY and CNOT, which enables better feature interactions and class separability. A novel quantum distance metric, based on the swap test, is introduced to calculate similarity measures between various quantum states, offering superior accuracy and computational efficiency compared to traditional Euclidean distance metrics. We assess the achievement of the proposed QKNN algorithm on three benchmark datasets: Wisconsin Breast Cancer, Iris, and Bank Note Authentication, and have noted its superior performance relative to both classical k-NN (CKNN) and Quantum Neural Network (QNN). The proposed QKNN algorithm is found to achieve prediction accuracies of 98.25%, 100%, and 99.27% ,respectively, for the three datasets, while the customized QNN shows prediction accuracies of only 97.17%, 83.33%, and 86.18%, respectively. Furthermore, we address the challenges of quantum noise by incorporating a repetition encoding-based error mitigation strategy, which ensures the stability and resilience of the algorithm in noisy quantum environments. The results highlight the potential of the proposed QKNN as a scalable, efficient and robust quantum-enhanced machine learning algorithm, especially in high-dimensional and complex datasets, when traditional approaches frequently fail.
Noisy data is inherent in quantum computing and significantly affects the performance of many quantum machine learning algorithms. Conventional Quantum Support Vector Machines (QSVMs) often lack built-in mechanisms to handle noise, which can lead to unreliable decision boundaries under noisy conditions. To address this challenge, this work proposes a Hybrid Ensemble Anti-Noise QSVM framework designed for robust classification. The proposed approach integrates neural network–based feature extraction to generate noise-resilient representations with an Anti-Noise QSVM that incorporates a sample-weighted hinge loss to reduce the influence of noisy or mislabeled samples. Furthermore, an ensemble voting mechanism combines the Anti-Noise QSVM with multiple classical classifiers to enhance stability and generalization. The framework is structured to support evaluation on synthetic and real-world datasets, including image, biomedical, and network intrusion data, under various noise conditions such as Gaussian, impulse, and label noise using quantum simulators. This hybrid quantum–classical design aims to improve robustness, scalability, and adaptability compared to conventional QSVM-based approaches.
ABSTRACT A quantum K‐nearest neighbors(QKNN) algorithm is proposed to offer superior performance compared to the classical KNN(CKNN) approach, improving classification accuracy, scalability, and robustness. Our approach optimizes Hadamard and rotation gates for quantum data encoding and efficiently embeds classical data into quantum states. Entangled gates, such as IsingXY and CNOT, enhance feature extraction and classification by enabling complex feature interactions. A new quantum distance metric based on swap test results is used to calculate similarity measures between quantum states. This algorithm offers superior accuracy and computational efficiency compared to traditional Euclidean distance metrics. We used three benchmark datasets to evaluate the suggested QKNN method. The results demonstrated that it outperformed the other two methods, classical KNN (CKNN) and quantum neural networks (QNN), as well as the more recent QKNN research. The proposed QKNN algorithm achieves prediction accuracies of 98.25%, 100%, and 99.27% for the three datasets, whereas the QNN achieves prediction accuracies of 97.17%, 83.33%, and 86.18%, respectively. Moreover, quantum noise challenges are addressed by integrating a Shor code‐based error mitigation strategy, which ensures stability of the algorithm and resilience to noisy quantum environments. The results demonstrate the scalability, efficiency, and robustness of the proposed QKNN algorithm.
Dealing with high-dimensional data is a well-known limitation for the classic K-Nearest Neighbors (KNN) algorithm, creating substantial computational and memory overhead. While Quantum Machine Learning (QML) presents a compelling alternative, many existing Quantum KNN (QKNN) frameworks are largely theoretical, remaining impractical for current hardware due to their significant qubit demands. This paper introduces the Fidelity-Based Quantum K-Nearest Neighbors (FQKNN) algorithm, a method specifically designed for feasibility on near-term devices. Our primary contribution is the use of quantum fidelity as a similarity function, which offers a more nuanced metric than conventional distance calculations. This is combined with an efficient amplitude encoding strategy that logarithmically scales the qubit requirement to just log2(N) for an N-dimensional feature vector. This combination makes FQKNN a resource-efficient and practical algorithm. We validated its performance on the benchmark Iris and Breast Cancer datasets, achieving classification accuracies of 96.7% and 93.3% respectively, surpassing the performance of the classical KNN baseline. These findings not only confirm the viability of our fidelity-based similarity measure but also underscore the demonstrable potential of QML to enhance classification tasks.