Quantum classifier based on support vector machine
By using a quantum classifier based on support vector machines and employing quantum matrix inversion algorithms and feature mapping, the traditional SVM optimization problem is transformed into a linear algebra problem. This solves the problems of slow computation speed and unstable accuracy in high-dimensional data processing, and achieves efficient and stable quantum data classification.
Patent Information
- Application Number
- CN202411765271.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Traditional machine learning algorithms are slow and have unstable accuracy when processing high-dimensional data. Quantum support vector machines, under higher-order kernel function schemes, have increased quantum circuit size, high requirements for computing equipment, and are difficult to optimize parameters, resulting in poor flexibility.
A quantum classifier based on support vector machines is adopted. By using quantum matrix inversion algorithm and quantum feature mapping, the SVM optimization problem is transformed into an equivalent linear algebra problem. Quantum computers are used for data classification, and quantum circuits are constructed to achieve efficient classification.
It significantly improves training speed, maintains classification accuracy under high-dimensional data, broadens the application scope of quantum computing in the field of data classification, and simplifies the operation process.
Smart Images

Figure CN119272889A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of quantum computing and quantum information processing, and specifically is a quantum classifier based on a support vector machine. Background Art
[0002] With the continuous development of computer science, the era of big data has arrived. Quantum computing, as a new computing method, can be combined with big data machine learning to build an integrated platform of machine learning algorithms and quantum computers to achieve rapid and stable development. Support vector machine (SVM) is a typical model in machine learning that can achieve classification tasks. It has a large number of application scenarios, such as text classification, image recognition, gene expression analysis, medical diagnosis, etc. Although traditional machine learning models have strong data learning capabilities, they still have problems such as slow computing speed and unstable accuracy when dealing with objects with high dimensions and complex data. Quantum computing is highly targeted at these problems that are difficult to solve with traditional algorithms, providing new ideas for improvement and making it possible to use machine learning algorithms to process high-dimensional quantum data.
[0003] Support Vector Machine (SVM) is a binary classification model. Its basic model is defined as a linear classifier with the largest margin in the feature space. The largest margin distinguishes it from the perceptron. SVM also includes kernel techniques, which makes it a substantially nonlinear classifier. In a data set, a hyperplane is a decision boundary that can divide data into two categories. In classification problems, data points on the classification boundary are called support vectors. These points are crucial to defining the optimal hyperplane. The margin refers to the distance from the classification boundary to the nearest support vector. The learning strategy of SVM is to maximize the margin, which can be formalized as a process for solving a convex quadratic programming problem.
[0004] The workflow of SVM mainly includes: (1) Data preprocessing: Standardize the data to have zero mean and unit variance.
[0005] (2) Select kernel function: Linear kernel: Applicable when the data is linearly separable.
[0006] Polynomial kernel: Map data to a high-dimensional space through polynomial mapping.
[0007] Radial basis function kernel: suitable for nonlinear problems and can be mapped to infinite-dimensional space.
[0008] Sigmoid kernel: mimics the activation function of neurons.
[0009] (3) Optimization problem: SVM finds the optimal hyperplane by solving the following optimization problem: ; And meet ,in, is the normal vector, which determines the direction of the hyperplane. is the displacement term, which determines the distance between the hyperplane and the origin; is the category label; is the eigenvector.
[0010] (4) Solving the support vector: By solving the above optimization problem, we can find a set of support vectors, which are the only training samples that affect the optimal hyperplane.
[0011] (5) Decision function: After training, the decision function of SVM is: .
[0012] Thanks to the advantages of SVM, such as good effect and strong generalization ability; suitable for small and medium-sized data sets; can solve high-dimensional problems; can choose different kernel functions to adapt to data, SVM has applications in many fields, including text classification, image recognition, bioinformatics, etc. With the development of machine learning, although deep learning has surpassed traditional machine learning methods in many tasks, SVM is still an effective choice for some problems due to its unique theoretical advantages.
[0013] However, the current solution still has many shortcomings, including: when applied to high-dimensional data to be processed, the requirements for quantum devices will increase, and the calculation time will also increase with the increase in dimensions. The quantum support vector machine's solution representation for high-order kernel functions will lead to an increase in the scale of quantum circuits, and complex quantum gates need to be built to help achieve it. It has high requirements for computing devices and is not conducive to the implementation of the solution. Some drawbacks of machine learning itself are unavoidable. Due to its lack of reasonable mathematical theoretical support, it is impossible to grasp the accurate numerical adjustment direction in the parameter optimization part, the workload of parameter adjustment is large, and the optimal parameters for different data sets are often not fixed, resulting in poor flexibility of the machine, and human intervention is still required to maintain high accuracy. Summary of the invention
[0014] Purpose of the invention: To solve the problem that it is difficult for traditional machine learning algorithms to efficiently process high-dimensional data, and for quantum systems, the quantum state will show exponential growth according to the increase in dimension, and the existing solutions cannot effectively analyze such large-scale computing resources. The present invention proposes a quantum classifier based on a support vector machine, a text classification method based on a quantum classifier, and an image recognition method based on a quantum classifier, which involves the classification of classical and quantum data using quantum circuits, and can be used to solve the problem of high-dimensional data analysis and processing in machine learning. By combining traditional solutions with quantum algorithms, the advantages of quantum computing are brought into play, the training speed of support vector machines in processing complex problems is improved, and the calculation accuracy is guaranteed, thereby breaking through the bottleneck problem of traditional solutions.
[0015] Technical solution: A quantum classifier based on support vector machine, including: The quantum state is obtained according to the following formula: ; Among them, the quantum state The quantum state is obtained by solving the optimization problem of SVM using the quantum matrix inversion algorithm. By using quantum feature mapping, the data to be classified is stored in the quantum state Prepared in; The obtained quantum state is measured using the Hadamard gate, and data classification is achieved based on the measurement results: The quantum matrix inversion algorithm solves the optimization problem of SVM, including the following steps: The optimization problem of SVM is transformed into an equivalent linear algebra problem, and the least squares approximation of SVM is obtained, which is expressed as a matrix ; Select the kernel function; The matrix Expand to Dimension, represented as a matrix ; Define the unitary matrix , the unitary matrix A unitary operator in the storage matrix information; Prepare two quantum register systems, denoted as and , and initialized to the quantum state , ; Add an auxiliary bit and state; acting on the auxiliary bit with a series of single-bit rotating gates; Alternating controlled on a system of two quantum registers and an auxiliary bit and , Represents the inverse operator of the unitary matrix, and the quantum state is prepared .
[0016] Furthermore, the optimization problem of SVM is transformed into an equivalent linear algebra problem, and the least squares approximation of SVM is obtained, which is expressed as a matrix , the specific operations include: The optimization problem of SVM is expressed as: ; And the inequality constraints are satisfied: ,in, is the normal vector, which determines the direction of the hyperplane. is the displacement term, which determines the distance between the hyperplane and the origin; is the category label; is the eigenvector; By integrating the slack variables And use The property of converts the inequality constraint into an equivalent equality form. Corrected to equality constraint ; According to the corrected equality constraint, a penalty term is added to the Lagrangian function corresponding to the SVM optimization problem. ,in, Represents a scalar used to adjust the balance between the training error and the optimization problem of SVM; By calculating the penalty term The partial derivatives of the Lagrangian function eliminate and , we get the least squares approximation of SVM: ; in, , , is the kernel matrix, The dimension of the matrix is ; represents the number of data points, Indicates the label corresponding to the data point, represents the SVM parameters; SVM parameters Through the matrix equation Derived.
[0017] Furthermore, the matrix It is expressed as: .
[0018] Furthermore, the unitary matrix It is expressed as: .
[0019] Furthermore, the series of single-bit revolving doors include: and , expressed as: ; ; In the formula, , represents the intermediate variable, Represents a complex function.
[0020] The present invention also discloses a text classification method, comprising the following steps: Use quantum classifier to classify the text to be classified and obtain the text classification result; The quantum classifier is a quantum classifier based on a support vector machine disclosed above.
[0021] The present invention also discloses an image recognition method, comprising the following steps: A quantum classifier is used to classify the image to be identified, and an image classification result is obtained; The quantum classifier is a quantum classifier based on a support vector machine disclosed above.
[0022] Beneficial effects: Compared with the prior art, the present invention proposes a quantum classifier implementation scheme of a support vector machine with practical value, which can be used for most classification tasks. By integrating quantum feature mapping with quantum machine learning algorithms, it has mathematically provable validity and rich application scenarios. In general, the present invention has the following advantages: (1) High efficiency: Quantum circuits can be constructed with low consumption, and the classification efficiency of the two support vector machines is significantly improved compared to the training speed of traditional classification vector machines; (2) Stability: The quantum support vector machine can maintain a high classification accuracy even when the complexity of the input data increases; (3) Innovation: This invention provides a novel and efficient quantum circuit implementation integrated with machine learning, broadening the application scope of quantum computing in the field of data classification; (4) Practicality: The quantum circuit used in the present invention can be implemented on a quantum computer and is simple, effective, easy to operate, and has a wide range of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is the quantum circuit for matrix inversion proposed by the present invention. DETAILED DESCRIPTION
[0024] The technical solution of the present invention is now further described in conjunction with the accompanying drawings and embodiments.
[0025] Embodiment: This embodiment proposes a quantum classifier based on support vector machine, and its implementation mainly includes four parts: In the first part, the optimization problem of SVM is transformed into an equivalent linear algebra problem; The second part uses quantum feature maps to store data in quantum states, allowing quantum computers to process data analysis. The third part is the core technology of this embodiment, which proposes a quantum algorithm for solving linear algebra problems; Part 4, building a quantum classifier.
[0026] Now we will further explain the transformation of the problem in the first part.
[0027] The core of this embodiment is to solve the equivalent least squares problem of the optimization problem in SVM. Specifically, the SVM is adjusted by the least squares method, and the optimization problem is reinterpreted as a linear system of algebraic equations. By integrating the slack variables , also known as soft margin, and using The property of , converting the inequality constraint into an equivalent equation form, completes the simplification: the original inequality can be restated as the equation According to these revised constraints, a penalty term is added to the corresponding constructed Lagrangian function ,in, The scalar adjusts the balance between the training error and the SVM optimization goal.
[0028] By calculating the partial derivatives of the Lagrangian function, we then eliminate the variables and , we get the least squares approximation of SVM: ; in, , , is the kernel matrix, The dimension of the matrix is ; represents the number of data points, Indicates the label corresponding to the data point, represents the SVM parameters; in order to adapt , additional rows and columns need to be added due to the presence of non-trivial offsets Required. Lagrange multipliers as a measure of closeness to the optimal boundary. Therefore, the parameters of the SVM are given by the matrix equation Derived.
[0029] The second part is now further explained.
[0030] Choosing an appropriate quantum eigenmap , whose function is to map data into quantum states .accomplish There are many solutions, including but not limited to hybrid quantum-classical algorithms.
[0031] The kernel function selected in this embodiment is defined as follows: ; Represents the inverse operator.
[0032] Then the kernel matrix Can also be defined.
[0033] The third part is now further explained.
[0034] To solve SVM on a quantum computer, we transform the matrix Expand to Dimension, expressed as: ; Defines a block encoding that stores the matrix In this embodiment, the block code is a unitary matrix , such as: ; That is, a unitary operator is required to store the matrix , while the rest of the matrix is not restricted.
[0035] The quantum algorithm for solving linear algebra problems in this embodiment specifically includes the following operations: Prepare two quantum register systems, denoted as and , and initialized to the quantum state , ; Add an auxiliary bit and state; a series of single-bit rotating gates are applied to the auxiliary bits, including: and , expressed as: ; ; In the formula, , represents the intermediate variable, Represents a complex function.
[0036] Controlled block coding alternately applied on three systems and , see Figure 1 . Figure 1 Quantum circuit for matrix inversion. The rotation parameters can be classically calculated in advance based on trigonometric polynomials that approximate inverse proportional functions. The number of times it is used is consistent with the number of its inverse operations. The quantum circuit for matrix inversion prepares the quantum state: .
[0037] If you have the ability to generate many copies of the initial state, you can iterate Figure 1 The state preparation process in the above example is repeated many times until the desired result is obtained by measurement. Alternatively, amplitude amplification can be used to construct states with high probability.
[0038] The quantum classifier (Quantum SVM) in the fourth part is now further explained.
[0039] The quantum classifier (Quantum SVM) achieves data classification by preparing and calculating the following quantum states: ; Among them, the quantum state It can be obtained from the quantum circuit of matrix inversion in the third part, expressed as:
[0040] The quantum state here After the quantum state is obtained in the third part, a quantum register system is further supplemented and the unitary operator is applied to obtain it.
[0041] Among them, the quantum state By using quantum feature mapping, the data to be classified is stored in the quantum state Prepared in, expressed as: ; In the formula, Represents an integer from 0 to M.
[0042] It should be noted that the above quantum state is controlled by the first quantum bit when it is prepared. The Hadamard gate is applied to the first quantum bit and measured to estimate the probability of 1 appearing. If the estimated probability is less than 0.5, the data is classified as +1; conversely, if it exceeds 0.5, the data is classified as -1.
[0043] The quantum classifier based on support vector machine proposed in this embodiment can be applied to various scenarios such as text classification, image recognition, gene expression analysis, medical diagnosis, etc.
Claims
1. A quantum classifier based on support vector machine, characterized in that: include: The quantum state is obtained according to the following formula: ; Among them, the quantum state The quantum state is obtained by solving the optimization problem of SVM using the quantum matrix inversion algorithm. By using quantum feature mapping, the data to be classified is stored in the quantum state Prepared in; The obtained quantum state is measured using the Hadamard gate, and data classification is achieved based on the measurement results: The quantum matrix inversion algorithm solves the optimization problem of SVM, including the following steps: The optimization problem of SVM is transformed into an equivalent linear algebra problem, and the least squares approximation of SVM is obtained, which is expressed as a matrix ; Select the kernel function; The matrix Expand to Dimension, represented as a matrix ; Define the unitary matrix , the unitary matrix A unitary operator in the storage matrix information; Prepare two quantum register systems, denoted as and , and initialized to the quantum state , ; Add an auxiliary bit and state; acting on the auxiliary bit with a series of single-bit rotating gates; Alternating controlled on a system of two quantum registers and an auxiliary bit and , Represents the inverse operator of the unitary matrix, and the quantum state is prepared .
2. A quantum classifier based on a support vector machine according to claim 1, characterized in that: The optimization problem of SVM is transformed into an equivalent linear algebra problem, and the least squares approximation of SVM is obtained, which is expressed as a matrix , the specific operations include: The optimization problem of SVM is expressed as: ; And the inequality constraints are satisfied: ,in, is the normal vector, which determines the direction of the hyperplane. is the displacement term, which determines the distance between the hyperplane and the origin; is the category label; is the eigenvector; By integrating the slack variables And use The property of converts the inequality constraint into an equivalent equality form. Corrected to equality constraint ; According to the corrected equality constraint, a penalty term is added to the Lagrangian function corresponding to the SVM optimization problem. ,in, Represents a scalar used to adjust the balance between the training error and the optimization problem of SVM; By calculating the penalty term The partial derivatives of the Lagrangian function eliminate and , we get the least squares approximation of SVM: ; in, , , is the kernel matrix, The dimension of the matrix is ; represents the number of data points, Indicates the label corresponding to the data point, represents the SVM parameters; SVM parameters Through the matrix equation Derived.
3. A quantum classifier based on a support vector machine according to claim 2, characterized in that: The matrix It is expressed as: 。 4. A quantum classifier based on a support vector machine according to claim 3, characterized in that: The unitary matrix It is expressed as: 。 5. A quantum classifier based on a support vector machine according to claim 1, characterized in that: The series of single-bit turnstiles include: and , expressed as: ; ; In the formula, , represents the intermediate variable, Represents a complex function.
6. A text classification method, characterized in that: The following steps are involved: Use quantum classifier to classify the text to be classified and obtain the text classification result; The quantum classifier is a quantum classifier based on a support vector machine as described in any one of claims 1 to 5.
7. An image recognition method, characterized in that: The following steps are involved: A quantum classifier is used to classify the image to be identified, and an image classification result is obtained; The quantum classifier is a quantum classifier based on a support vector machine as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Image classification method based on quantum nearest-neighbor algorithm
CN106650808A
Text classification method, device and apparatus
CN111949791A
Image classification method, device, server and system based on quantum kernel method
CN115222948A
Quantum kernel method, classification method, data coding method and related systems and devices
CN117273157A
Method of classification of images among different classes
EP3674999A1
Cited By
Method for monitoring gas leakage based on spectral vector data processing
CN119961656A
A method for monitoring gas leakage based on spectral vector data processing
CN119961656B