Hybrid support vector machine optimization method and system based on granular ball calculation and quantum HHL algorithm
Through the hybrid optimization method of granular computing and quantum HHL algorithm, the quadratic programming problem of granular support vector machine is converted into a system of linear equations. By using quantum parallel processing and condition number control, the problems of computational efficiency and accuracy under large-scale data are solved, and efficient support vector machine decision-making is achieved.
Patent Information
- Application Number
- CN202510816115.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-26
Smart Images

Figure CN120706253A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection of machine learning and quantum computing, and relates to a hybrid support vector machine optimization method and system based on granular sphere computing and quantum linear system solving (Harrow-Hassidim-Lloyd algorithm, HHL algorithm). Background Art
[0002] With the explosive growth of data and the continuous increase in problem complexity, traditional machine learning models face severe challenges in terms of computational efficiency, robustness, and scalability. In particular, in complex optimization models such as support vector machines, the exponential increase in computational complexity due to the increasing data dimensionality and sample size makes it difficult to meet the demands of real-time decision-making.
[0003] Granular-Ball Computing, a multi-granularity learning method that simulates the human global priority cognitive mechanism, demonstrates significant advantages in tasks such as classification and clustering by abstracting data into a hyperspherical granularity representation. This method aggregates data samples into granules defined by geometric centers and radii, effectively reducing the scale of data processing and improving noise resistance. However, the existing Granular-Ball Support Vector Machine (GBSVM) model has fundamental bottlenecks: first, the theoretical derivation of the original model does not involve the least squares form, which limits the algorithm implementation; second, when processing high-dimensional or ultra-large-scale data sets, the complexity of traditional optimization methods such as the sequential minimum optimization algorithm and the particle swarm optimization algorithm still grows polynomially with the number of granules, which cannot meet the needs of real-time computing.
[0004] At the same time, the rapid development of quantum computing has provided a new path to breaking through the bottleneck of classical computing. Quantum algorithms such as the HHL algorithm have demonstrated exponential acceleration potential in solving linear equations. Their core advantage lies in leveraging quantum superposition and entanglement to achieve parallel computing. In recent years, research in quantum machine learning (QML) has focused on the direct migration of traditional point-input models and has yet to effectively integrate multi-granularity data representation with the deep integration of quantum computing. This disconnect leads to two key drawbacks: quantum resource consumption increases dramatically with data size, and traditional data representations are difficult to adapt to the characteristics of quantum algorithms.
[0005] Therefore, how to utilize the quantum HHL algorithm to overcome optimization bottlenecks while maintaining the high efficiency of granular-sphere computation and construct a new hybrid optimization framework for support vector machines (SVMs) has become a key technical challenge. Existing technologies lack systematic research on the quantization of multi-granularity data, and even lack a collaborative optimization mechanism for granular-sphere representation and the HHL algorithm. This results in an inability to balance efficiency and accuracy in large-scale data processing scenarios. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a hybrid support vector machine optimization method and system based on granular sphere computing and quantum HHL algorithm to solve the problem of high time complexity of granular sphere support vector machine in solving quadratic programming problems when the data scale is large.
[0007] In order to achieve the above object, the present invention provides the following technical solutions:
[0008] Based on the granular quantum support vector machine method based on the HHL quantum algorithm, the method includes the following steps:
[0009] S1: Generate a granular sphere dataset from the original dataset through granular sphere calculation;
[0010] S2: Using the sphere as the input of SVM, a mathematical optimization model of the sphere support vector machine is constructed;
[0011] S3: Based on the mathematical model obtained in S2, the least squares form of the granular support vector machine is derived, the original quadratic programming problem is converted into the form of solving a system of linear equations, and a matrix model is constructed to facilitate the use of the quantum HHL algorithm for solution. Here, it is assumed that the nonlinear radius constraint ||w|| is a local constant and initialized to 1;
[0012] S4: Verify the validity of the matrix and use diagonal loading to reduce the matrix condition number, and use quantum random access memory (QRAM) and amplitude coding to encode classical data into quantum states;
[0013] S5: Use the HHL quantum algorithm to solve the linear equations and obtain the important parameters of the current decision plane;
[0014] S6: Update the radius constraint using the fixed point iteration method, return the updated value to S3, rebuild the matrix, and repeat S4, S5, and S6 until convergence;
[0015] S7: Obtain the decision plane of the support vector machine according to the optimal solution obtained in S6, and classify the test data points through the decision plane.
[0016] Furthermore, in S1, the original data set is converted into a granular data set by granular-spherical calculation, which is completed using classical calculation, specifically including the following steps:
[0017] S11: Treat the entire dataset as an initial large sphere and calculate its geometric center c and radius r (the average distance method is used by default);
[0018] S12: Calculate the purity of the sphere, that is, count the category labels of the samples in the sphere and take the proportion of the category with the highest proportion;
[0019] S13: Determine whether the purity of each ball meets the threshold T. If the purity is greater than or equal to the preset threshold T, the ball does not need to be split and is directly added to the ball list. Otherwise, the process proceeds to the splitting step. The threshold T in this step is an adaptive threshold.
[0020] S14: When splitting, select a splitting axis (such as the maximum variance direction or the k-means clustering result) according to the data distribution, and then divide the samples in the sphere into two parts along the splitting axis. Recalculate the center c and radius r of each part of the sample (use the subset mean as the center and the average distance as the radius) to generate a new sub-sphere;
[0021] S15: Then recursively execute S12-S14 on the newly generated sub-particles until the purity of all particles meets the threshold T, stop splitting, and return the generated particles.
[0022] Furthermore, in S2, the spheres are used as inputs of the SVM to construct a mathematical optimization model of the sphere support vector machine, which specifically includes the following steps:
[0023] S21: Using spheres of varying sizes as input to the classifier, the two sphere support planes are constrained by two rules: the first is that the support plane must be tangent to the supporting spheres; the second is that the distance between the support plane and each sphere must be no less than the corresponding radius. Based on the geometric relationship, the optimized mathematical model and constraints for the sphere support vector machine are derived.
[0024] S22: Introduce the Lagrange multiplier, get its Lagrange function, and according to the KKT condition, we can get the dual model of the granular support vector machine;
[0025] Furthermore, in S3, based on the mathematical model obtained in S2, the least squares form of the granular support vector machine is derived, the original quadratic programming problem is converted into a form of solving a system of linear equations, and a matrix model is constructed to facilitate the use of the quantum HHL algorithm for solution. Here, it is assumed that the nonlinear radius constraint is a local constant and initialized to 1. Specifically, the following steps are included:
[0026] S31: Introducing an error term transforms the inequality constraint into an equality constraint. The regularization parameter C is used to control the complexity of the model and its tolerance to error. A new GBSVM model is obtained.
[0027] S32: For the nonlinear term ||w||r i We assume that the radius constraint ||w|| is approximately constant within a local range. We first initialize ||w|| to a constant (usually set to 1.0), decomposing the non-convex problem into multiple convex subproblems to ensure convergence. We then iteratively update the value of ||w|| through the optimization algorithm.
[0028] S33: Introduce Lagrange multipliers to construct Lagrange functions;
[0029] S34: According to the KKT condition, the optimal value should satisfy the partial derivative of each variable to be 0, and its matrix form is obtained;
[0030] S35: By removing w and e, we can obtain the simplified normal matrix form of GBSVM least squares.
[0031] Furthermore, in S4, verifying the validity of the matrix and reducing the matrix condition number by diagonal loading, and encoding the classical data into quantum states by using QRAM and amplitude coding, specifically includes the following steps:
[0032] S41: Verify the sparsity and Hermitian properties of the matrix and the feasibility of the quantum HHL algorithm;
[0033] S42: Use diagonal loading to improve the condition number of the matrix. The basic idea of diagonal loading is to add a small constant term to the diagonal of the original matrix to make the matrix more positive definite, thereby reducing its condition number;
[0034] S43: Using QRAM to encode the input matrix and input vector on the basis state of the quantum bit, QRAM stores the vector in blocks, with each address corresponding to a data block. Then all data blocks can be read using quantum parallelism. QRAM selects the location of the data through the quantum address bus and reads the data through the quantum data bus, realizing quantum parallel reading of the data. Specifically, first apply the H gate to the address register to obtain the quantum maximum superposition state After that, for each address |i> and data bit k (from low to high), add a control revolving gate: if b i,k = 1, then a controlled X gate is applied to the kth data bit, controlled by address |i>
[0035] S44: Recursively apply rotation gates to encode data on the amplitude of the quantum bits. You can use built-in functions in quantum circuit libraries (Qiskit, Qpanda) to generate amplitude encoding circuits, such as top-down amplitude encoding.
[0036] Furthermore, in S5, the HHL quantum algorithm is used to solve the linear equations to obtain important parameters of the current decision plane, which is completed using the quantum algorithm, specifically including the following steps:
[0037] S51: Initialize the input of the HHL quantum algorithm. The input of HHL consists of three quantum registers. Quantum register 1 is an auxiliary quantum register with an initial state of |0>, quantum register 2 is a storage quantum register with an initial state of |0,0,...,0>, and quantum register 3 is an input quantum register with an initial state of |b eq >
[0038] S52: Performing quantum phase estimation (QPE) on quantum register 2 and quantum register 3, wherein the characteristic information of the characteristic matrix is calculated and stored in the quantum state of quantum register 2;
[0039] S53: Using the eigenvalue in quantum register 2 as controlled information, control the rotation of the auxiliary quantum bit, namely quantum register 1, so as to save the eigenvalue information into the probability amplitude of the auxiliary quantum bit;
[0040] S54: Estimate the quantum phase of the inverse action of quantum register 2 and quantum register 3, and disentangle the second quantum register from the other registers;
[0041] S55: Finally, an amplitude amplification module is applied. This is because due to the existence of errors, it is difficult to obtain the solution quantum state with probability 1 when measuring the auxiliary quantum bit. In order to increase the measurement probability value, an amplitude amplification module is added;
[0042] S56: Measure quantum register 1. If the measurement result is 0, recalculate until the measurement result is 1, and then get the final result in quantum register 3.
[0043] Furthermore, in S6, the radius constraint is updated using a fixed point iteration method, and the updated value is returned to S3, the matrix is reconstructed, and S4, S5, and S6 are repeated until convergence. The classical algorithm is used, specifically including the following steps:
[0044] S61: First set the initial radius constraint γ 0 The value of (for example, γ 0 =1), set the initial iteration number k = 0. Then construct the matrix A k and vector b k ;
[0045] S62: Use the quantum HHL algorithm in S5 to solve the linear equation and get the current solution x k+1 , and calculate ||w|| based on the current solution k+1 ;
[0046] S63: Introduce a relaxation factor η∈[0,1]. In optimization algorithms, the relaxation factor is often used to adjust the step size of parameter updates to balance the weight between the current iteration value and the newly calculated value. In fixed-point iterations, the relaxation factor can blend the new and old values in a certain proportion, which may accelerate convergence or prevent oscillation. Return the calculated new radius constraint value to S3, reconstruct the matrix, and repeat S4, S5, and S6 until convergence.
[0047] Furthermore, in S7, a decision plane of a support vector machine is obtained according to the optimal solution obtained in S6, and classification of the test data points is implemented through the decision plane, which specifically includes the following steps:
[0048] S71: Construct the classification decision plane of the support vector machine based on the optimal solution obtained when S6 converges;
[0049] S72: Substitute the test data sample points into the mathematical expression of the decision plane, and determine the category of the test sample points based on the mathematical calculation results (+1 / -1), where +1 represents positive samples and -1 represents negative samples, thereby achieving binary classification.
[0050] The beneficial effects of the present invention are:
[0051] (1) This paper breaks through the polynomial complexity bottleneck in traditional support vector machine optimization by deeply integrating the coarse-grained data compression capabilities of granular sphere computing with the parallel solution advantages of the quantum HHL algorithm. The granular sphere represents the abstraction of the original high-dimensional data into a hypersphere, significantly reducing the size of the data involved in the calculation; the quantum HHL algorithm achieves exponential acceleration in the solution stage of the linear equation system. The synergistic effect of the two reduces the optimization time of very large data sets from hours to minutes.
[0052] (2) The sphere representation uses radius constraints to model the uncertainty of data distribution, which is naturally resistant to outliers and noise interference. Combined with the iterative optimization framework derived from the least squares form, the diagonal loading technique is introduced in the quantum solution process to effectively control the deterioration of the matrix condition number. This design stabilizes the decision plane to local perturbations of the data distribution, significantly improving classification accuracy in high-noise scenarios such as medical diagnosis and financial risk control.
[0053] (3) The quantum computing unit only needs to process the compressed data after spherization, reducing quantum bit resource consumption by several orders of magnitude; the classical computing unit is responsible for spherical generation and iterative control, avoiding the storage bottleneck of full data loading in traditional quantum machine learning. The two realize dynamic scheduling of heterogeneous computing resources through a data exchange bus, and the data scale supported under the same hardware conditions is expanded by more than ten times.
[0054] (4) For the first time, a collaborative optimization mechanism between the sphere radius constraint and the quantum linear solver was established:
[0055] Decompose the non-convex problem into a sequence of convex sub-problems through fixed-point iteration to ensure global convergence;
[0056] The solution vector output by the quantum HHL algorithm drives the update of the radius constraint, forming a classical-quantum hybrid feedback loop;
[0057] The adaptive sphere splitting strategy is combined with quantum amplitude coding technology to achieve efficient quantum state representation of multi-granularity data.
[0058] (5) The construction time of the support vector machine decision plane is no longer subject to the rigid constraints of the number of data samples, making real-time classification of trillions of samples possible; at the same time, it is compatible with classical computing devices and quantum processors, and can be deployed on quantum-classical hybrid computing platforms before the popularization of general-purpose quantum computers, providing a landing path for industrial-grade big data intelligent processing.
[0059] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings, in which:
[0061] Figure 1 is an overall flow chart of the method in an embodiment of the present invention;
[0062] Figure 2 A visual model diagram of the overall algorithm design in an embodiment of the present invention;
[0063] Figure 3 Schematic diagram of GBSVM in an embodiment of the present invention;
[0064] Figure 4 This is a quantum circuit diagram for using QRAM to load data in an embodiment of the present invention;
[0065] Figure 5 This is a specific quantum circuit diagram of amplitude coding in an embodiment of the present invention;
[0066] Figure 6 The present invention implements a specific circuit diagram for solving a system of linear equations using the HHL algorithm. DETAILED DESCRIPTION
[0067] The following describes the embodiments of the present invention by means of specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0068] Among them, the accompanying drawings are only for illustrative purposes and represent only schematic diagrams rather than actual pictures, and should not be understood as limiting the present invention. In order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings may be omitted, enlarged or reduced, and do not represent the dimensions of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions may be omitted in the accompanying drawings.
[0069] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "left", "right", "front", "back", etc. indicating directions or positional relationships, they are based on the directions or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0070] See also Figures 1 to 6 , which is a granular sphere support vector machine method based on the quantum HHL algorithm.
[0071] like Figure 1 As shown, this embodiment provides a granular quantum support vector machine method based on the HHL quantum algorithm, which is subdivided into 7 steps: Figure 2 This is a visualization model diagram of the overall algorithm design in the embodiment of the present invention. Figure 1 The method comprises the following steps:
[0072] S1: Generate a granular sphere dataset from the original dataset through granular sphere calculation;
[0073] Specifically, the sphere generation process includes:
[0074] S11: The entire data set (x j ,y j) is considered as an initial large sphere (GB1, y1). y1 is the label category represented by most sample points. Then, its geometric center c and radius r are calculated (the average distance method is used by default);
[0075] S12: Calculate the purity of the current ball. The purity calculation formula is: That is, count the category labels of the samples in the sphere and take the proportion of the category with the highest proportion;
[0076] S13: Determine whether the purity of each ball meets the threshold T. If the purity of the ball is greater than or equal to the preset threshold T, the ball does not need to be split and is directly added to the ball list. Otherwise, enter the splitting step.
[0077] S14: When splitting, select a splitting axis (such as the maximum variance direction or the k-means clustering result) according to the data distribution, and then divide the samples in the sphere into two parts along the splitting axis. Recalculate the center and radius of each part of the samples (such as using the subset mean as the center and the average distance as the radius) to generate a new sub-sphere;
[0078] S15: Then recursively execute S12-S14 on the newly generated sub-particles until the purity of all particles meets the threshold T, stop splitting, and return the generated particles.
[0079] S2: Using the pellet as the input of SVM, a mathematical optimization model of the pellet support vector machine is constructed, such as Figure 3 As shown;
[0080] Specifically, the mathematical model construction process of the particle support vector machine includes:
[0081] S21: Using spheres of different sizes as input to the classifier, the two sphere support planes are constrained by two rules: the first is that the support plane must be tangent to the supporting spheres; the second is that the distance between the support plane and each sphere must be no less than the corresponding radius. For a linearly separable sphere support vector machine, assuming that all spheres can be correctly classified, the optimal mathematical model and constraints for the sphere support vector machine are derived based on geometric relationships:
[0082]
[0083] subject:y i (w·c i +b)-||w||r i ≥1,i=1,2,...,m
[0084] When r i= 0, the GBSVM model is equivalent to the traditional SVM. In this case, the sphere SVM can be used to predict common sample points. The equivalence of the two models confirms the correctness of the GBSVM model. In a separable support vector machine, all supporting spheres must satisfy the constraints. However, in most cases, some spheres cannot satisfy the constraints. Therefore, we introduce the slack variable ξ and the penalty coefficient C to obtain the linear non-separable support vector machine model:
[0085]
[0086] subject:y i (w·c i +b)-||w||r i ≥1-ξ i ,ξ i ≥0,i=1,2,...,m
[0087] S22: Introduce Lagrange multipliers to obtain its Lagrange function, and according to the KKT condition, the dual model of the linearly separable granular support vector machine can be obtained;
[0088]
[0089] Similarly, the dual model of the linearly inseparable granular support vector machine can be obtained as:
[0090]
[0091] S3: Based on the mathematical model obtained in S2, the least squares form of the granular support vector machine is derived, the original quadratic programming problem is converted into the form of solving a system of linear equations, and a matrix model is constructed to facilitate the use of the quantum HHL algorithm to solve the linear equations. Here, it is assumed that the nonlinear radius constraint is a local constant and is initialized to 1;
[0092] Specifically, the least squares form derivation process of the granular support vector machine includes:
[0093] S31: Introduce the error term e=[e1,e2,...,e m ] T Convert the inequality constraints into equality constraints. The regularization parameter C is used to control the complexity of the model and the tolerance to errors. The new GBSVM model is:
[0094]
[0095] subject:y i (w·c i +b)-||w||r i =1-e i,i=1,2,...,m
[0096] S32: For the treatment of nonlinear terms: The key challenge here is how to deal with ||w||r i This nonlinear term. In classical SVM, nonlinearity can be handled by kernel techniques, but in GBSVM, since the radius of the sphere is related to the w norm, direct linearization may be difficult. To simplify the problem, assume that ||w|| is approximately a constant in a certain local area, and the constant is recorded as the radius constraint γ, and then gradually optimized through iterative methods. Specifically, first initialize γ 0 =1, then calculate other variables and iteratively update the value of ||w|| through the optimization algorithm, similar to the coordinate descent method. In this way, the constraints become:
[0097] y i (w·c i +b)-γr i =1-e i ,i=1,2,...,m
[0098] S33: Introduce the Lagrange multiplier vector α=[α1,α2,...,α m ] T , construct the Lagrangian function:
[0099]
[0100] S34: According to the KKT condition, when taking the optimal value, the partial derivative of each variable should be 0, and the following formula is obtained:
[0101]
[0102] Then, convert it into matrix form:
[0103]
[0104] S35: By removing w and e, the normal matrix form of the simplified GBSVM least squares can be obtained as follows:
[0105]
[0106] Where Z = [y1c1 T ,y2c2 T ,...,y m c m T ],Y=[y1,y2,...y m ],
[0107] Therefore, the above formula can be organized into the input matrix A and input vector B of the HHL quantum algorithm as follows:
[0108]
[0109] S4: Verify the validity of the matrix and use diagonal loading to reduce the matrix condition number, and use QRAM and amplitude coding to encode classical data into quantum states;
[0110] Specifically, the matrix verification and encoding process includes:
[0111] S41: Verify the sparsity and Hermitian properties of the matrix, demonstrating the feasibility of the quantum HHL algorithm. First, the sparsity of matrix A depends on the number and dimension of the spheres. Since the number of spheres is much smaller than the number of sample points, the dimension is the original dimension plus a radius attribute. Therefore, the number of spheres and the dimension are not high, making the matrix sparse. Furthermore, since matrix A is a real symmetric matrix, adding diagonal terms does not change its real symmetry. Therefore, it is real symmetric and positive definite, satisfying the Hermitian property requirement.
[0112] S42: Use diagonal loading to improve the condition number of the matrix. The condition number may be too large due to multicollinearity or high dimensionality of the data when constructing the matrix. In linear algebra, the condition number of a matrix measures the sensitivity of the matrix in numerical calculations, that is, the degree to which the input error of the matrix affects the output solution. For the HHL algorithm, a matrix with a high condition number will reduce the accuracy of the solution and increase the required quantum resources, so reducing the condition number is an important optimization direction. Diagonal loading is a common preprocessing method, which is usually used to improve the condition number of the matrix. For the sub-block ZZ of the matrix A T +λI implements diagonal loading:
[0113] Ω'=ZZ T +λI
[0114] where δ = 10 -6 , δ is the diagonal loading coefficient, I is the unit matrix, Yes, the model regularization parameter can significantly reduce the condition number by choosing an appropriate λ.
[0115] S43: Use QRAM to encode the input matrix and input vector on the ground state of the quantum bit. First, perform quantum representation on the matrix A. Since A is a Hermitian matrix, it can be represented by Hamiltonian simulation or block encoding technology. If A is sparse, it is directly decomposed into Pauli terms; if it is dense, auxiliary quantum bits need to be introduced for approximate block encoding. This paper has verified that A is a sparse matrix composed of spherical parameters. Therefore, A is directly decomposed into Pauli terms:
[0116]
[0117] Among them, I, X, Y, and Z correspond to quantum Pauli-I gate, quantum Pauli-X gate, quantum Pauli-Y gate, and quantum Pauli-Z gate respectively.
[0118] The vector is then loaded into a quantum register using QRAM. QRAM is a technology that allows quantum computers to access classical or quantum data using quantum addresses. QRAM stores vectors in blocks, with each address corresponding to a data block. All data blocks can then be read using quantum parallelism. QRAM selects the data location via a quantum address bus and reads the data via a quantum data bus, enabling quantum parallel reading of data. Its basic operation can be expressed as:
[0119] QRAM:|i> addr |0> data →|i> addr |D i > data
[0120] Among them, |i> is the address register, |D i > is a data register that stores the i-th data item. Then vector b eq Normalized to a unit vector:
[0121]
[0122] Now split it into 2 n Each block stores a data item. Each data item is then assigned a unique quantum address |i>, which can be represented by d qubits. Its binary approximation is stored in QRAM. Therefore, the operation of QRAM can be expressed in more detail as follows:
[0123]
[0124] The address register consists of m quantum bits and can address 2 m The data register consists of d quantum bits, which are used to store the binary value of each data. QRAM writes data into the data register through the control gate. The specific implementation method is as follows Figure 4 , first apply H gate to the address register to obtain the quantum maximum superposition state After that, for each address |i> and data bit k (from low to high), if b i,k =1, then a controlled X gate is applied to the kth data bit, controlled by the address |i>.
[0125] S44: Recursively apply the rotation gate to encode the data on the amplitude of the quantum bit. You can use the built-in functions in the quantum circuit library (Qiskit, Qpanda) to generate amplitude encoding circuits, such as top-down amplitude encoding. Figure 5 This encoding has a line width of O(log2N) and a line depth of O(N).
[0126] S5: Use the HHL quantum algorithm to solve the linear equations and obtain the important parameters of the current decision plane. Its quantum circuit is as follows: Figure 6 shown.
[0127] Specifically, the solution process of the HHL algorithm includes:
[0128] S51: Initialize the input of the HHL algorithm. The input of HHL consists of three quantum registers. Quantum register 1 is an auxiliary quantum register with an initial state of |0>1, quantum register 2 is a storage quantum register with an initial state of |00...0>2, and quantum register 3 is an input quantum register with an initial state of |b>. Therefore, the input of the rectification algorithm can be expressed as express:
[0129]
[0130] S52: Perform quantum phase estimation (QPE) on quantum registers 2 and 3, calculate the characteristic information of the characteristic matrix, and save it in quantum register 2.
[0131]
[0132] in, is the matrix eigenvalue λ i An approximate integer of .
[0133] S53: Using the eigenvalue in quantum register 2 as the controlled information, control the rotation of the auxiliary quantum bit, quantum register 1, so as to save the eigenvalue information into the probability amplitude of the auxiliary quantum bit, and construct the following controlled rotation:
[0134]
[0135] Where C is Normalization coefficient of . Satisfy After the ergodic rotation quantum gate operation, we can get
[0136]
[0137] S54: Estimate the quantum phase of the inverse action of quantum register 2 and quantum register 3 to disentangle the second quantum register from the other registers; obtain
[0138]
[0139] S55: Finally, an amplitude amplification module is applied. This is because due to the existence of errors, it is difficult to obtain the solution quantum state with probability 1 when measuring the auxiliary quantum bit. In order to increase the measurement probability value, an amplitude amplification module is added. For any superposition state Amplitude amplification quantum circuits can transform superposition states The amplitude of |φ1> in the expression is amplified, thereby obtaining a result quantum state, which can measure the target quantum state |φ1> with high probability. Define the key quantum state:
[0140] is the initial state before bit estimation, that is is the target solution state (register 3 state when the auxiliary bit is 1);
[0141] The amplitude amplification operator is defined as:
[0142]
[0143] S56: Measure quantum register 1. If the measurement result is 0, recalculate until the measurement result is 1, and then get the final result in quantum register 3.
[0144]
[0145] Among them, |x> includes important parameters of the decision plane
[0146] S6: Use the fixed point iteration method to update the radius constraint, return the updated value to S3, rebuild the matrix, and repeat S4, S5, and S6 until convergence.
[0147] Specifically, the iterative process includes:
[0148] S61: First, set the value of the initial radius constraint, let γ 0 =1, set the initial iteration number k = 0. Then, construct the matrix A k and vector b k ;
[0149] S62: Use the HHL quantum algorithm in S5 to solve the linear equation and obtain the solution x under the current number of iterations k+1 , and based on
[0150] The current solution calculates ||w|| k+1 :
[0151]
[0152] S63: Introduce a relaxation factor η∈[0,1] to balance the weight between the current iteration value and the newly calculated value. In fixed-point iteration, the relaxation factor can mix the new value and the old value in a certain proportion, which may accelerate convergence or prevent oscillation. After adding the relaxation factor, the new γ update formula becomes:
[0153] γ k+1 =η·||w k+1 ||+(1-η)·γ k
[0154] The larger η is, the faster the update is, but it may oscillate. The smaller η is, the more stable it is, but the slower the convergence is. A common empirical choice is η∈[0.5,0.8], which balances convergence speed and stability.
[0155] Set the convergence threshold ε = 10 -4 , when |γ k+1 -γ k The iteration stops when |<ε. The relaxation factor η is adaptively adjusted:
[0156]
[0157] Verify the convergence of γ. If it does not meet the convergence requirement, return the calculated new radius constraint value to S3, rebuild the matrix, and repeat S4, S5, and S6 until convergence.
[0158] S7: Obtain the decision plane of the support vector machine according to the optimal solution obtained in S6, and classify the test data points through the decision plane.
[0159] Specifically, the classification process includes:
[0160] S71: Construct the classification decision plane of the support vector machine based on the optimal solution obtained when S6 converges;
[0161] S72: Substitute the test data sample points into the mathematical expression of the decision plane, and determine the category of the test sample points based on the mathematical calculation results (+1 / -1), where +1 represents positive samples and -1 represents negative samples, thereby achieving binary classification.
[0162] A hybrid support vector machine optimization system based on granular-sphere computing and quantum HHL algorithm, including:
[0163] Classic processing unit, which includes processor and memory;
[0164] A quantum encoding unit, data-connected to the classical processing unit, comprising a QRAM and a quantum circuit;
[0165] a quantum computing unit, quantum-state connected to the quantum encoding unit, comprising a quantum processor;
[0166] A data exchange bus physically connects the classical processing unit, the quantum encoding unit, and the quantum computing unit.
[0167] The quantum encoding unit includes:
[0168] QRAM module, which realizes quantum state mapping from address register to data register;
[0169] Amplitude encoding module,performs amplitude encoding via recursive revolving gate.
[0170] The quantum computing unit comprises:
[0171] a phase estimation module that performs quantum Fourier transforms;
[0172] Controlled rotation module to achieve Operation; where C is the normalization constant, is the approximate eigenvalue of matrix A;
[0173] The amplitude amplification module includes the operator Q=-PP1, where P is the projection operator, P1 is the projection operator
[0174] The classical processing unit includes an adaptive threshold module that performs:
[0175] T=κ·P global ,κ=0.85
[0176] Among them, T is the purity threshold of the pellet, P global is the global purity of the dataset, and κ is the proportionality coefficient.
[0177] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of the claims of the present invention.
Claims
1. A hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm, characterized by: It includes the following steps: S1: Generate a granule dataset from the original dataset through granule calculation, and each granule is defined by a center point c and a radius r; S2: Construct a support vector machine optimization model with the granule as the input; S3: Convert the optimization model into a linear equation system Ax=b eq , where A is a Hermitian matrix, b eq is a constant term vector, and the radius constraint γ is initialized to 1; S4: Matrix A and vector b are converted into quantum random access memory (QRAM). eq Encoded as quantum states; S5: Run the HHL quantum algorithm to solve the linear equations; S6: Update the radius constraint γ according to the solution vector x and iterate until convergence; S7: Classify the test data according to the decision plane.
2. The hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm according to claim 1, characterized in that: The S1 includes: Calculate the initial granule center c and radius r; Calculate purity p most is the number of samples of the category with the highest proportion among the spheres; p total is the total number of samples in the sphere; Split the granule along the maximum variance direction when P < T; Recursively process the sub-granules until all granules satisfy P ≥ T.
3. The hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm according to claim 1, characterized in that: The optimization model of the S2 is: subject:y i (w·c i +b)-||w||r i ≥1-ξ i ,ξ i ≥0,i=1,2,...,m Among them, w is the hyperplane normal vector, b is the bias term, C is the penalty coefficient, ξ i is the slack variable of the i-th sphere, y i is the category label of the i-th ball, c i is the center point of the i-th sphere, r i is the radius of the i-th sphere, and m is the total number of spheres.
4. The hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm according to claim 1, characterized in that: The linear equations of the S3 are: Where Y=[y1,...,y m ] T , b is the bias term, α is the Lagrange multiplier vector, Y is the category label vector, Z is the product matrix of the particle sphere center and the label, λ is the diagonal loading parameter, I is the identity matrix, γ is the radius constraint, and 1 is the all-one vector.
5. The hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm according to claim 1, characterized in that: The S4 includes: Add δI to implement diagonal loading to sub-block ZZ of matrix A T +λI, where δ=10 -6 , δ is the diagonal loading coefficient, I is the unit matrix; Implemented via QRAM Quantum state mapping; is the normalized input vector, ||b eq || is vector b eq The L2 norm of [[ID= 6. The hybrid support vector machine optimization method based on granular-sphere computing and quantum HHL algorithm according to claim 1, characterized in that: c k+1 =η·||w k+1 ||+(1-η)·γ k Among them, γ k is the radius constraint of the kth iteration, ||w k+1 || is the normal vector modulus of the k+1th iteration, η is the relaxation factor, η∈[0.5,0.8].
7. A hybrid support vector machine optimization system based on granular-sphere computing and quantum HHL algorithm, characterized by: 8. The hybrid support vector machine optimization system based on granular-sphere computing and quantum HHL algorithm according to claim 7, characterized in that: 9. The hybrid support vector machine optimization system based on granular-sphere computing and quantum HHL algorithm according to claim 7, characterized in that: Controlled rotation module to achieve Operation; where C is the normalization constant, is the approximate eigenvalue of matrix A; The amplitude amplification module includes the operator Q=-PP1, where P is the projection operator, P1 is the projection operator 10. The hybrid support vector machine optimization system based on granular-sphere computing and quantum HHL algorithm according to claim 7, characterized in that: T=κ·P global ,κ=0.85 Among them, T is the purity threshold of the pellet, P global is the global purity of the dataset, and κ is the proportionality coefficient.