A method and apparatus for constructing a quantum classifier based on a neural operator
By combining neural operators with variable quantum circuits, a quantum classifier is constructed, which solves the problem of excessively deep mapping circuits under high-dimensional data and achieves more efficient and accurate quantum classification.
Patent Information
- Application Number
- CN202510638952.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-05-19
AI Technical Summary
When existing subclassifiers process high-dimensional data, excessively deep mapping paths lead to noise accumulation, affecting computational efficiency and accuracy.
By combining neural operators with variable quantum circuits, the mapping circuit is transformed into a linear combination of single-layer Pauli operators. The parameters are iteratively updated through neural networks and gradient descent algorithms to construct a quantum classifier.
The depth of quantum circuits is reduced, noise effects are minimized, and the computational efficiency and accuracy of quantum classifiers on noisy devices are improved.
Smart Images

Figure CN120542589B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] One or more embodiments of the present specification relate to the field of quantum technology, and in particular to a method and apparatus for constructing a quantum classifier based on a neural operator. BACKGROUND
[0002] A quantum classifier utilizes superposition states of qubits to represent data and utilizes quantum gate operations to process and classify data, and can process high-dimensional data to some extent, while traditional classical computing may consume a large amount of resources. In view of the characteristics of the quantum classifier, it can be used to classify users according to their characteristics. When the dimensionality of the user characteristics is high, the mapping of the feature vectors formed by the user characteristics to quantum data may make the quantum circuit too deep, resulting in excessive noise accumulation, thereby affecting the computing efficiency of the quantum classifier and the accuracy of classifying users according to their characteristics. SUMMARY
[0003] The present application describes a method and apparatus for constructing a quantum classifier based on a neural operator, which can solve the above technical problems.
[0004] According to a first aspect, a method for constructing a quantum classifier based on a neural operator is provided, the method comprising:
[0005] constructing a mapping circuit for a feature vector in a training sample set, wherein the training sample set includes a feature vector formed by user characteristics and a corresponding user classification label;
[0006] constructing a neural network operator, which is a linear superposition of a plurality of Pauli operators, and the superposition coefficients are determined by a neural network of parameters w, and by training the parameters w of the neural network, the neural network operator is made to approximate the mapping circuit;
[0007] constructing a quantum classifier using the neural network operator approximating the mapping circuit and the parameters of a variational quantum circuit;
[0008] According to the user classification label, the parameters of the variational quantum circuit are iteratively updated using a phase shift rule and a gradient descent algorithm, thereby obtaining a quantum classifier for classifying users.
[0009] In some embodiments, the neural network operator is made to approximate the mapping circuit by training the parameters w of the neural network, specifically comprising:
[0010] using the neural network operator and the mapping circuit constructing a first cost function, the first cost function reflecting the difference between the neural network operator and the mapping circuit .
[0011] determining the parameter by update iteration aiming at minimizing the function value of the first cost function .
[0012] In some more specific embodiments, the first cost function is converted into a first partial derivative function, which is a partial derivative function of the first cost function with respect to the parameter w;
[0013] Gradient information of the first partial derivative function is determined by using Markov Chain Monte Carlo random sampling method;
[0014] The parameter w is updated by gradient descent algorithm iteration using the gradient information of the first partial derivative function.
[0015] In some more specific embodiments, the method further comprises:
[0016] The parameter comprises a first parameter and a second parameter , the neural network , wherein, is a first neural network part for outputting quantum state probability amplitude according to inputted Pauli operator , and the parameter of the first neural network part is the first parameter ; is a second neural network part for outputting quantum state phase according to inputted Pauli operator , and the parameter of the second neural network part is the second parameter .
[0017] In some more specific embodiments, the parameter is determined by update iteration aiming at minimizing the function value of the first cost function , specifically comprising:
[0018] The first cost function is converted into a first partial derivative function, which comprises a partial derivative function of the first cost function with respect to the first parameter and a partial derivative function with respect to the second parameter ;
[0019] Gradient information of the first partial derivative function is determined by using Markov Chain Monte Carlo random sampling method;
[0020] The first parameter and the second parameter are updated by gradient descent algorithm iteration using the gradient information of the first partial derivative function;
[0021] The first parameter and the second parameter The first and second neural network parts are obtained after training, and then the neural network is obtained.
[0022] In some more specific embodiments, the step of iteratively updating the parameters of the variable quantum circuit using phase shift rules and gradient descent algorithm based on the user classification tags specifically includes:
[0023] The feature vector is input into the quantum classifier to obtain the pre-classification label;
[0024] A second cost function is constructed using the pre-classification labels and the user classification labels, wherein the second cost function reflects the error between the pre-classification labels and the user classification labels;
[0025] The second cost function is converted into a second partial derivative function, which is the partial derivative function of the second cost function with respect to the parameters of the variable quantum circuit;
[0026] With the goal of minimizing the function value of the second cost function, the gradient information of the second partial derivative function is obtained using the phase shift rule;
[0027] Based on the gradient information of the second partial derivative function, the parameters of the variable quantum circuit are iteratively updated using the gradient descent algorithm.
[0028] In some more specific embodiments, the quantum classifier
[0029] , No. Pauli arithmetic and the Pauli arithmetic All are single-layer Pauli operators. These are the parameters of a variable quantum circuit. The parameter is In quantum circuits, tr represents the trace operation. It is an observation operator. yes The conjugate transpose of . is the projection operator projecting onto the ground state |0>, and • is the matrix multiplication operator.
[0030] According to a second aspect, an apparatus for constructing a quantum classifier based on neural operators is provided, the apparatus comprising:
[0031] The first processing module is used to construct a mapping line for the feature vectors in the training sample set, wherein the training sample set contains feature vectors formed by user features and corresponding user classification labels.
[0032] The second processing module is configured to approximate the mapping circuit by using a neural network operator, wherein the neural network operator is composed of a Pauli operator and a neural network, and a quantum classifier is constructed by using the neural network operator approximating the mapping circuit and parameters of a variational quantum circuit.
[0033] The third processing module is configured to construct a quantum classifier by using the neural network operator approximating the mapping circuit and parameters of a variational quantum circuit.
[0034] The fourth processing module is configured to iteratively update the parameters of the variational quantum circuit according to the user classification label by using a phase shift rule and a gradient descent algorithm, so as to obtain a quantum classifier for classifying users.
[0035] In some embodiments, the second processing module is specifically configured to construct a first cost function by using the neural network operator and the mapping circuit , wherein the first cost function reflects a difference between the neural network operator and the mapping circuit .
[0036] The parameters are determined by iteration and updating so as to minimize a function value of the first cost function.
[0037] In some more specific embodiments, the second processing module is specifically configured to convert the first cost function into a first partial derivative function, wherein the first partial derivative function is a partial derivative function of the first cost function with respect to the parameters .
[0038] Gradient information of the first partial derivative function is determined by using a Markov chain Monte Carlo random sampling method.
[0039] The parameters are iteratively updated by using the gradient information of the first partial derivative function and a gradient descent algorithm.
[0040] In some more specific embodiments, the parameters include first parameters and second parameters , and the neural network , wherein is a first neural network part outputting a quantum state probability amplitude according to an input Pauli operator , and the parameters of the first neural network part are the first parameters . is a second neural network part outputting a quantum state phase according to an input Pauli operator , and the parameters of the second neural network part are the second parameters .
[0041] In some more specific embodiments, the second processing module is specifically used to convert the first cost function into a first partial derivative function, the first partial derivative function comprising the first cost function with respect to the first parameter. The partial derivative function and with respect to the second parameter The partial derivative function;
[0042] The gradient information of the first partial derivative function is determined using the Markov chain Monte Carlo random sampling method.
[0043] Using the gradient information of the first partial derivative function, the first parameter is iteratively updated using the gradient descent algorithm. Second parameter ;
[0044] Based on the first parameter after multiple iterations Second parameter The first and second neural network parts are obtained after training, and then the neural network is obtained.
[0045] In some more specific embodiments, the fourth processing module is specifically used to input the feature vector into the quantum classifier to obtain a pre-classification label;
[0046] A second cost function is constructed using the pre-classification labels and the user classification labels, wherein the second cost function reflects the error between the pre-classification labels and the user classification labels;
[0047] The second cost function is converted into a second partial derivative function, which is the partial derivative function of the second cost function with respect to the parameters of the variable quantum circuit;
[0048] With the goal of minimizing the function value of the second cost function, the gradient information of the second partial derivative function is obtained using the phase shift rule;
[0049] Based on the gradient information of the second partial derivative function, the parameters of the variable quantum circuit are iteratively updated using the gradient descent algorithm.
[0050] In some more specific embodiments, the quantum classifier
[0051] , among which, the Pauli arithmetic and the Pauli arithmetic All are single-layer Pauli operators. These are the parameters of a variable quantum circuit. The parameter is In quantum circuits, tr represents the trace operation. is an observable operator, is is the conjugate transpose of is a projection operator to the ground state |0>, and • is a matrix multiplication operator.
[0052] According to a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements the method for constructing a quantum classifier based on a neural operator as described in the above technical solutions when executing the program.
[0053] According to a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements the method for constructing a quantum classifier based on a neural operator as described in the above technical solutions when executing the program.
[0054] In the above system and method provided by the embodiments of the present specification, a quantum classifier for classifying users according to user features is proposed. In order to solve the problem that the mapping of quantum data caused by multiple user features may make the quantum circuit too deep, a method combining a neural operator and a shallow variational quantum circuit is used to convert the originally deep mapping circuit into a linear combination of a series of single-layer Pauli operators, thereby reducing the overhead of mapping and reducing the depth of the circuit, so that the quantum classifier is more easily implemented on the current noisy quantum device. BRIEF DESCRIPTION OF DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description are briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0056] Figure 1 is a flowchart of a method for constructing a quantum classifier based on a neural operator provided by the present application;
[0057] Figure 2 is a flowchart of a method for constructing a quantum classifier based on a neural operator provided by the present application;
[0058] Figure 3 is a structural schematic diagram of a construction device for a quantum classifier based on a neural operator provided by the present application. DETAILED DESCRIPTION
[0059] The schemes provided by the present specification will be described below in combination with the drawings.
[0060] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the drawings.
[0061] In the description of the embodiments of the present application, the words such as "exemplary", "for example", or "for instance" are used to represent examples, instances or illustrations. Any embodiment or design solution described as "exemplary", "for example" or "for instance" in the embodiments of the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design solutions. Rather, the words such as "exemplary", "for example", or "for instance" are used in the specific manner to present the relevant concept.
[0062] In the description of the embodiments of the present application, the term "and / or" is only used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, B alone, and A and B simultaneously. In addition, unless otherwise specified, the term "multiple" means two or more.
[0063] In addition, the terms "first", "second" are only used for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more features. The terms "include", "contain", "have" and their variants mean "include but are not limited to", unless otherwise specifically emphasized.
[0064] A quantum classifier is a type of machine learning model that uses quantum computing to improve the efficiency of data processing and classification. Quantum classifiers use quantum bits (qubits) to represent data and quantum gates to perform operations on the data. The use of superposition in quantum computing allows the quantum computer to process multiple inputs simultaneously, which can significantly improve the efficiency of data processing and classification. In addition, quantum computing can also handle high-dimensional data, which is difficult for classical computers to process. However, the current mapping of classical data to quantum data may result in a quantum circuit that is too deep, causing the model to accumulate too much noise on current medium-scale noisy quantum devices, thereby affecting the efficiency and accuracy of the computation.
[0065] The prior art scheme realizes the quantum classifier mainly through the following steps: first, preparing quantum bits, preparing a group of quantum bits, which will be used to represent input data and perform classification tasks. The number of quantum bits depends on the feature dimension of the input data and the complexity of the classification task; second, encoding classical data into the form of quantum bits. This may include mapping feature vectors to some representation in the quantum bit space. Common encoding methods include amplitude mapping or rotation angle mapping; third, designing a quantum circuit that contains a series of quantum gate operations for processing and operating quantum data. These quantum gate operations may include single-bit gates such as rotation gates, and double-bit gates such as CNOT gates for implementing feature transformations and data classification; fourth, executing a quantum algorithm on the constructed quantum circuit, inputting the encoded quantum data into the circuit, and processing and classifying it through quantum gate operations; fifth, measuring the output of the quantum circuit to determine the classification result of the input data. According to the measurement result, the input data is assigned to the corresponding category; sixth, training and optimizing the quantum classifier to improve its classification performance and generalization ability. Adjust the parameters of the quantum circuit isomorphic, optimize the classification cost function until convergence.
[0066] The quantum classifier constructed by the above method has defects in data encoding. In the face of data with large dimensions, a sufficient number of quantum bits and high-fidelity quantum gate operations are required for encoding, which also directly increases the depth of the quantum circuit. The deeper quantum circuit is more affected by noise, which directly affects the model performance.
[0067] Specifically, the problem to be solved by the present application can be described as follows. Given a training data set , a quantum classifier is constructed . The training sample data set here contains feature vectors formed by user features and corresponding user classification labels.
[0068] The optimization problem of minimizing the empirical error of the quantum classifier is established:
[0069]
[0070] is the parameter of the variational quantum circuit, is the cost function, and cross-entropy is selected as the cost function, then the cost function of this problem is , where the quantum classifier . From the above, since the mapping circuit will increase with the increase of the dimension of the feature vector , the previous method does not consider the precision reduction caused by the over-deep mapping circuit.
[0071] To solve the above problems, in the present application, the following is adopted Figure 1 The construction method of the quantum classifier based on the neural operator is shown. As shown in the figure Figure 1 According to the method of the present application, for each feature vector in the training data set The mapping route of each feature vector The mapping route of each feature vector is approximated using a neural operator . Wherein, the neural operator can be represented as a plurality of Pauli operators Through the linear superposition of superposition coefficients , the superposition coefficients are determined by the neural network of parameters . Through the approximation of the mapping route of each feature vector , the coefficients of the Pauli operator corresponding to each feature vector , that is, the neural network operator approximating the mapping route, are obtained. Then, the obtained neural operator and the parameters of the variational quantum circuit are used to construct a quantum classifier, and the parameters of the variational quantum circuit are updated iteratively through a cost function
[0072] , until the function value of the cost function converges to less than , or the iteration number t is greater than the preset iteration number M, to obtain the parameters of the variational quantum circuit , and finally obtain the quantum classifier for classifying users.
[0073] The unitary transformation form composed of the approximation is used to represent a series of Pauli operators in the quantum system, so as to convert the originally deep mapping route into a linear combination of a series of single-layer Pauli operators, thereby reducing the mapping overhead and reducing the circuit depth, solving the problem that the mapping route increases with the increase of the dimension of the feature vector, and the problem of reduced accuracy caused by the too deep mapping route.
[0074] The specific embodiments of the above inventive concept are described in detail below.
[0075] Figure 2 is a flowchart of a construction method of a quantum classifier based on a neural operator provided by the present application, comprising the following steps:
[0076] 110, constructing a mapping route for the feature vector in the training sample set, wherein the training sample set contains the feature vector formed by the user feature and the corresponding user classification label.
[0077] Specifically, the training sample is a set of N training samples. is a feature vector of a user, is a classification label of the user.
[0078] Specifically, the feature vector may be a vector formed based on user attribute features. In one embodiment, the training sample set is formed of user cases, where the feature vector is formed based on some physiological indicators or features of the user, and the corresponding user classification label is a labeled label of the disease. More specifically, in one specific example, the training sample may be the Cleveland Heart Disease Dataset dataset, which is derived from a real heart disease dataset, and contains various health indicators and features of heart disease and corresponding diagnosis results of whether the user is sick, where is a plurality of health indicators of heart disease, is a label for the corresponding diagnosis result of whether the user is sick.
[0079] For the feature vector of each sample, a quantum circuit encoding the same is constructed by using a conventional method, i.e., a mapping circuit .
[0080] 120, a neural network operator is constructed, which is a linear superposition of a plurality of Pauli operators, and the superposition coefficients are determined by a neural network of parameters w. By training the parameters w of the neural network, the neural network operator is made to approximate the mapping circuit.
[0081] Specifically, the neural network operator is constructed in the form of a unitary transformation , where is a Pauli operator or a Pauli string, i.e., It can be seen that the Pauli string contains some basic single-qubit gates in quantum computing, such as the Pauli X gate (corresponding to ), the Pauli Y gate (corresponding to ) and the Pauli Z gate (corresponding to ), which are the most basic single-qubit gates. is a neural network with parameters and input . It can be seen that the output of the neural network acts as a linear superposition factor of the Pauli operator. That is, the output of the neural network is used to linearly superimpose the Pauli operator to obtain the neural network operator .
[0082] In order to make the neural network operator constructed as above approximate the mapping circuit , a cost function can be constructed to reflect the difference between the neural network operator and the mapping circuit the difference between them. Specifically, in one example, the first cost function is the mean square error of the mapping circuit and the mapping circuit , specifically in the form of:
[0083]
[0084] To obtain the parameters of the neural network operator approximating the mapping circuit , the parameters can be updated iteratively to determine the final parameters , with the goal of minimizing the first cost function described above. The update iteration of the parameters can be performed using a gradient descent algorithm.
[0085] Specifically, the first cost function can be calculated with respect to the parameters , and the partial derivative equation is as follows:
[0086]
[0087] wherein, .
[0088] Thus, the neural network can be divided into two parts, and the network parameters can also be divided into two parts = . The first neural network part has parameters , which is used to output the probability amplitude or amplitude of the quantum state, and this part of the result determines the relative size of each component of the quantum state, affecting the probability distribution of the final measurement result. The second neural network part has parameters , which is used to output the phase of the quantum state, and this part of the result is responsible for adjusting the relative phase relationship between the internal quantum states. Accordingly, the output result of the neural network is the combination of the above amplitude part and phase part. In this case, the partial derivative function actually contains the partial derivative of the first cost function with respect to the parameters , and the partial derivative with respect to the parameters .
[0089] The specific neural network used above can be a transformer neural network, a recurrent neural network, or a convolutional neural network, etc. The neural network used can be determined according to the actual scene, and is not specifically limited here.
[0090] Next, the value of the partial derivative equation of the first cost function with respect to the parameters is estimated using the metropolis-hasting Markov chain Monte Carlo sampling algorithm.
[0091] According to the obtained gradient information, the parameters are iteratively updated by a gradient descent algorithm , specifically including respectively iteratively updating , the update formula , η is a learning rate, until the cost function converges, obtaining the parameters , so as to obtain the neural operator approximating .
[0092] As can be seen above, by expressing the neural network operator as a linear superposition of Pauli operators, a single layer of Pauli operators is obtained, and the depth of the original mapping circuit is reduced to 1.
[0093] 130, using the neural network operator approximating the mapping circuit and the parameters of the variational quantum circuit to construct a quantum classifier.
[0094] 140, according to the user classification label, using the phase shift rule and the gradient descent algorithm to iteratively update the parameters of the variational quantum circuit, so as to obtain a quantum classifier for classifying users.
[0095] Inputting the training sample into the quantum classifier to obtain a pre-classification label, and using the pre-classification label and the user classification label to construct a second cost function. The second cost function reflects the error between the pre-classification label and the user classification label, and is used to improve the classification accuracy of the quantum classifier. In one example, the second cost function adopts a cross-entropy form: .
[0096] On the other hand, the quantum classifier constructed based on the above neural network operator can be written as:
[0097] , wherein and are both single-layer Pauli operators, is the parameter of the variational quantum circuit, is a quantum circuit with parameters , tr is a trace operation, is an observation operator. and are both single-layer Pauli operators, and the depth of the original mapping circuit is reduced to 1. Here, considering that there may be cross terms in the Pauli string based on the Pauli basis, two single-layer Pauli operators are set.
[0098] The first Pauli operator and the second Pauli operator are single layer Pauli operators, are parameters of the variational quantum circuit, is a quantum circuit with parameters , tr is a trace operation, is an observable operator, is a conjugate transpose of , is a projection operator projecting to the ground state |0>, and • is a matrix multiplication operator.
[0099] The parameters are updated by a phase shift rule and a gradient descent algorithm, and the gradient information is as follows:
[0100]
[0101]
[0102] The above steps are repeated until the second cost function converges, and the parameters of the variational quantum circuit are obtained, so that the quantum classifier for classifying users is obtained. .
[0103] In the above method provided by the embodiments of the present specification, a quantum classifier for classifying users according to user features is proposed, and in view of the problem of too deep quantum circuit caused by the dimension of user features, a method combining neural operators and shallow variational quantum circuits is used to convert the originally deep mapping circuit into a linear combination of a series of single layer Pauli operators, thereby reducing the mapping overhead, reducing the circuit depth, and making the quantum classifier more easily implemented on the current noisy quantum device.
[0104] Figure 3 is a structural schematic diagram of a construction device of a quantum classifier based on a neural operator provided by the present application, and the device comprises:
[0105] A first processing module is configured to construct a mapping circuit for a feature vector in a training sample set, wherein the training sample set comprises a feature vector formed by user features and a corresponding user classification label.
[0106] A second processing module is configured to approximate the mapping circuit by using a neural network operator, wherein the neural network operator is composed of a Pauli operator and a neural network, and a quantum classifier is constructed by using the neural network operator approximating the mapping circuit and parameters of a variational quantum circuit.
[0107] A third processing module is configured to construct a quantum classifier by using the neural network operator approximating the mapping circuit and the parameters of the variational quantum circuit.
[0108] The fourth processing module is configured to update parameters of the variational quantum circuit according to the user classification label, using a phase shift rule and a gradient descent algorithm to iteratively update the parameters, so as to obtain a quantum classifier for classifying the user.
[0109] In some embodiments, the second processing module is specifically configured to utilize a neural network operator and a mapping circuit to construct a first cost function, the first cost function reflecting a difference between the neural network operator and the mapping circuit .
[0110] The parameters are determined by updating iteration with a minimum value of a function value of the first cost function as a target .
[0111] In some more specific embodiments, the second processing module is specifically configured to convert the first cost function into a first partial derivative function, the first partial derivative function being a partial derivative function of the first cost function with respect to the parameters .
[0112] Gradient information of the first partial derivative function is determined by using a Markov Chain Monte Carlo random sampling method
[0113] The parameters are iteratively updated by using the gradient information of the first partial derivative function through a gradient descent algorithm .
[0114] In some more specific embodiments, the parameters include a first parameter and a second parameter . wherein, is a first neural network part outputting a quantum state probability amplitude according to an inputted Pauli operator , and a parameter of the first neural network part being the first parameter . is a second neural network part outputting a quantum state phase according to an inputted Pauli operator , and a parameter of the second neural network part being the second parameter .
[0115] In some more specific embodiments, the second processing module is specifically configured to convert the first cost function into a first partial derivative function, the first partial derivative function including a partial derivative function of the first cost function with respect to the first parameter and a partial derivative function of the first cost function with respect to the second parameter .
[0116] Gradient information of the first partial derivative function is determined by using a Markov Chain Monte Carlo random sampling method
[0117] The gradient information of the first partial derivative is used to iteratively update the first parameter by a gradient descent algorithm and the second parameter ;
[0118] According to the first parameter and the second parameter after multiple iterations, the trained first neural network part and the second neural network part are obtained, and then the neural network is obtained.
[0119] In some more specific embodiments, the fourth processing module is specifically configured to input the feature vector into the quantum classifier to obtain a pre-classification label;
[0120] The pre-classification label and the user classification label are used to construct a second cost function, wherein the second cost function reflects the error of the pre-classification label and the user classification label;
[0121] The second cost function is converted into a second partial derivative, and the second partial derivative is a partial derivative of the second cost function with respect to a parameter of the variational quantum circuit;
[0122] The gradient information of the second partial derivative is obtained by using a phase shift rule, with the goal of minimizing the function value of the second cost function;
[0123] According to the gradient information of the second partial derivative, the parameter of the variational quantum circuit is iteratively updated by using a gradient descent algorithm.
[0124] In some more specific embodiments, the quantum classifier
[0125] wherein and are single-layer Pauli operators, is a parameter of the variational quantum circuit, is a quantum circuit with the parameter , tr is a trace operation, is an observation operator.
[0126] According to another aspect, embodiments provide an electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements the construction method of the quantum classifier based on the neural algorithm as described in the above technical solutions when executing the program.
[0127] According to another aspect, embodiments also provide an electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements the construction method of the quantum classifier based on the neural algorithm as described in the above technical solutions when executing the program.
[0128] Those skilled in the art should be aware that, in the above one or more examples, the functions described in the present application can be implemented in hardware, software, firmware or any combination thereof. When implemented in software, the functions can be stored in a computer readable medium or transmitted as one or more instructions or codes on a computer readable medium.
[0129] The above detailed description has further explained the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific implementation of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application shall be included in the protection scope of the present application.
Claims
1. A method for constructing a quantum classifier based on a neural operator, characterized in that, The method comprises: constructing a mapping line for a feature vector in a training sample set, wherein the training sample set comprises a feature vector formed by user features and a corresponding user classification label; constructing a neural network operator which is a linear superposition of a plurality of Pauli operators, the superposition coefficients being determined by a neural network of parameters by training the parameters of the neural network such that the neural network operator approximates the mapping circuit; constructing a quantum classifier by using parameters of the neural network operator approximating the mapping line and a variational quantum line; updating the parameters of the variational quantum line according to the user classification label by using a phase shift rule and a gradient descent algorithm, so as to obtain a quantum classifier for classifying users; the parameters w of the neural network are trained so that the neural network operator approximates the mapping line, and specifically comprises: using the neural network operator and the mapping circuit constructing a first cost function reflecting a difference of neural network operators and the mapping circuit determining the parameters by updating iterations with the function value of the first cost function as the target ; The parameter is determined by updating iteration with the function value of the first cost function as the target , and specifically comprises: converting the first cost function to a first partial derivative function, the first partial derivative function being a partial derivative of the first cost function with respect to the parameter ; determining gradient information of the first partial derivative by using a Markov chain Monte Carlo random sampling method; using gradient information of the first partial derivative function, iteratively updating the parameters by a gradient descent algorithm ; the parameters comprising a first parameter and a second parameter , the neural network wherein, is a first neural network part outputting quantum state probability amplitudes from inputted Pauli operators, the parameters of which are the first parameters ; is a second neural network part outputting quantum state phases from inputted Pauli operators, the parameters of which are the second parameters ; ; the quantum classifier is represented as wherein the first Pauli operator and the second Pauli operator are single-layer Pauli operators, is a parameter of a variational quantum circuit, is a quantum circuit with parameters tr is a trace operation, is an observable operator, is a conjugate transpose of is a projection operator to the ground state |0>, is a matrix multiplication operator, is a feature vector of a user.
2. The method of claim 1, wherein, determining the parameters by updating iteration with the function value of the first cost function as the target , and specifically comprises: converting the first cost function to a first partial derivative function, the first partial derivative function comprising a partial derivative of the first cost function with respect to the first parameter and a partial derivative of the first cost function with respect to the second parameter determining gradient information of the first partial derivative by using a Markov chain Monte Carlo random sampling method; using gradient information of the first partial derivative function, iteratively updating the first parameter by a gradient descent algorithm and a second parameter ; According to the first parameter after multiple rounds of iteration and the second parameter , the trained first neural network part and second neural network part are obtained, and then the neural network is obtained.
3. The method of claim 1, wherein, the parameters of the variational quantum line are updated according to the user classification label by using a phase shift rule and a gradient descent algorithm, and specifically comprises: inputting the feature vector into the quantum classifier to obtain a pre-classification label; constructing a second cost function by using the pre-classification label and the user classification label, wherein the second cost function reflects errors of the pre-classification label and the user classification label; converting the second cost function into a second partial derivative, wherein the second partial derivative is a partial derivative of the second cost function with respect to the parameters of the variational quantum line; obtaining gradient information of the second partial derivative by using the phase shift rule, with the function value of the second cost function being minimized as a target; updating the parameters of the variational quantum line according to the gradient information of the second partial derivative by using a gradient descent algorithm.
4. An apparatus for constructing a quantum classifier based on a neural operator, characterized in that, The device comprises: a first processing module configured to construct a mapping line for a feature vector in a training sample set, wherein the training sample set comprises a feature vector formed by user features and a corresponding user classification label; a second processing module configured to construct a neural network operator that is a linear superposition of a plurality of Pauli operators, superposition coefficients being determined by a neural network of parameters through training of the parameters of the neural network such that the neural network operator approximates the mapping circuit. a third processing module configured to construct a quantum classifier by using parameters of the neural network operator approximating the mapping line and a variational quantum line; a fourth processing module configured to update the parameters of the variational quantum line according to the user classification label by using a phase shift rule and a gradient descent algorithm, so as to obtain a quantum classifier for classifying users; a second processing module configured to utilize the neural network operator and the mapping circuit to construct a first cost function reflecting a difference between the neural network operator and the mapping circuit ; and to determine the parameters by updating iterations with a minimum of a function value of the first cost function ; The second processing module is specifically configured to convert the first cost function into a first partial derivative function, the first partial derivative function being a partial derivative function of the first cost function with respect to the parameter ; determine gradient information of the first partial derivative function by using a Markov chain Monte Carlo random sampling method; and iteratively update the parameter by using the gradient information of the first partial derivative function through a gradient descent algorithm . the parameters comprising a first parameter and a second parameter , the neural network wherein, is a first neural network part outputting quantum state probability amplitudes from inputted Pauli operators , the parameters of which are the first parameters ; is a second neural network part outputting quantum state phases from inputted Pauli operators , the parameters of which are the second parameters ; the quantum classifier is represented as , among which, the Pauli arithmetic and the Pauli arithmetic All are single-layer Pauli operators. These are the parameters of a variable quantum circuit. The parameter is In quantum circuits, tr represents the trace operation. It is an observation operator. yes The conjugate transpose of . • is the projection operator that projects onto the ground state |0>, and • is the matrix multiplication operator. It is the user's feature vector.
5. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, the processor implements the construction method of the quantum classifier based on the neural operator according to any one of claims 1-3 when executing the program.
Citation Information
Patent Citations
Action recognition method, system and equipment based on skeleton coordinate points and medium
CN116343337A
Neural network-based eigenvalue solving method and equipment
CN116402154A