A method to improve the generalization performance of quantum machine learning models
By optimizing generalized observable measurements and building a quantum machine learning model, the limitations of quantum machine learning models in observable measurement selection are solved, their generalization performance is improved, and better data distribution matching and generalization capabilities are achieved.
Patent Information
- Application Number
- CN202411245125.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-09-06
AI Technical Summary
Existing quantum machine learning models have limitations in observable measurement selection, resulting in the model that can only explore local Ermi space and cannot fully match the data distribution after encoding maps, affecting its generalization performance.
By optimizing a generalized observable measurement, using standard convex quadratic programming to solve the optimal solution, compute the optimal Ermit matrix and perform feature decomposition, and build a quantum machine learning model to improve generalization performance.
Effectively expand the range of observable measurements, allowing quantum machine learning models to better match data distribution, and improve performance on unknown data sets.
Smart Images

Figure CN118761478B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data classification, and specifically is a method for improving the generalization performance of a quantum machine learning model by optimizing observable quantities. Background Art
[0002] Machine learning is committed to developing technical means that can autonomously discover potential patterns in data. This discovery process is often figuratively referred to as learning or training. Its core is to achieve the best learning effect by continuously optimizing the loss function that is closely related to the data and the task. After such a training process, the machine learning model can achieve accurate predictions of unknown data. This ability is called generalization ability. In recent years, with the continuous development of quantum devices in the field of computing performance, the combination of quantum computing and machine learning has injected new impetus into the field of artificial intelligence. Compared with traditional machine learning, the parallelism and entanglement of quantum computing enable quantum machine learning, as an emerging field, to show more significant advantages. Therefore, how to cleverly design quantum machine learning models and improve their generalization ability has become a key problem that needs to be solved urgently, and it is also an important research direction in the current field of quantum machine learning.
[0003] In quantum machine learning, parameterized quantum circuits can be used to construct quantum classifiers that classify data using output expectation values. Most previous studies have focused on optimizing the parameters of quantum circuits by measuring with fixed Pauli operators. However, in the process of training variational quantum classifiers, one is actually looking for a locally optimal Hermitian measurement operator that conforms to the encoding mapping. The “local” here means that when an actual observable is fixed, the space of parameterized Hermitian measurement operators will be limited. After passing through the encoding circuit, the data exhibits certain distribution characteristics, and a good observable should match this data distribution. Therefore, choosing a suitable observable is crucial to the performance of the quantum model.
[0004] In view of the above-mentioned problems, the present invention proposes a method to improve the generalization performance of quantum machine learning models by optimizing observables. This method expands the limitations of using a single fixed Pauli operator as a measurement operator in the past, provides new ideas for the design of quantum machine learning models, and can promote the development of this field. Summary of the invention
[0005] Purpose of the invention: In response to the limitations of observable quantity selection in previous quantum machine learning models, the present invention provides a method for improving the generalization performance of quantum machine learning models. This method expands the limitations of observable quantity selection in previous quantum machine learning models, making them better match the data distribution after encoding mapping, and mainly improves the performance of the model on unknown data sets by optimizing a generalized observable quantity.
[0006] A method for improving the generalization performance of a quantum machine learning model comprises the following steps:
[0007] S1. Modify the binary classification data set containing two types of samples and their corresponding features and divide them into a training set and a test set in proportion. Randomly sample the training set data in a set proportion to obtain a small data set. At the same time, fix a coding mapping circuit to perform feature mapping on all sample points in the small data set.
[0008] S2, use the small data set sampled in S1 as sample information, solve its standard convex quadratic programming, and obtain the optimal solution ;
[0009] S3, get the optimal solution according to S2 Compute the optimal Hermitian matrix , and then perform eigendecomposition on it to obtain the matrix corresponding to its eigenvalues, and use the eigenvalue matrix as the actual observable quantity M of the quantum classifier;
[0010] S4. Constructing a quantum machine learning model, wherein the quantum machine learning model includes a coding mapping module, a trainable parameterized quantum circuit module, and an observable quantity module required for measurement;
[0011] S5, designing a loss function of the quantum machine learning model, and training the quantum machine learning model constructed in S4 by using the designed loss function until a set number of iterations is reached, thereby obtaining an optimized quantum machine learning model;
[0012] S6. Input the test set data to be classified into the optimized quantum machine learning model to obtain the classification result.
[0013] Furthermore, in S1, before feature mapping, the raw data in the data set can also be preprocessed; the preprocessing here generally uses classical linear or nonlinear functions to increase or reduce the dimension of the raw data in the data set. The processed data is then used for subsequent feature mapping. The feature mapping process is to map these data into quantum Hilbert space, that is, to load classical information into a quantum computer. Assuming there is classical data , the specific mapping process can be expressed as:
[0014]
[0015]
[0016] in, represents the number of quantum bits, Represents a unitary operation that depends on classical data being loaded.
[0017] 1) Randomly sample the training set according to the set ratio to obtain a small data set. Assume that the sampled small data set has data points. After preprocessing, each data point has k features, and its corresponding sample matrix is recorded as ,satisfy:
[0018]
[0019] Among them, each row represents a sample point, and each column corresponds to a feature.
[0020] 2) Use a fixed encoding circuit to perform feature mapping on all sample points in the sampled small data set. Assume that the fixed encoding mapping circuit is recorded as , then every sample point in A (Each row) passes through the quantum circuit The corresponding output quantum state is , the vector corresponding to this quantum state is simply written as , N represents the number of quantum bits.
[0021] Furthermore, in S2:
[0022] After the data encoding part is completed, the classical data will become quantum data, and present a data distribution in the quantum Hilbert space that depends on the encoding circuit and the original information of the sample; The quantum system acting on the encoding circuit is used to find the optimal parameters in the feature space. At this time, the parameterized quantum state can be expressed as:
[0023]
[0024] Finally, when acting on a certain observable After that, the final output of the quantum system can be expressed as follows:
[0025]
[0026] Finally, the output value is post-processed and then the parameters in the parameter-containing circuit are optimized using the classical parameter update method until the quantum model converges to the optimal solution. Substituting into the above formula, we can get:
[0027]
[0028] Merge here , and define: , since the observable It satisfies the Hermitian property, so It still has Hermitian properties. can be expressed as a generalized parameterized observable, so can be rewritten as:
[0029]
[0030] It can be observed from the above formula that the feature mapping is completed Finally, the process of training the quantum model is actually to find an optimal Hermitian observable However, in practice, the choice of observables is not completely free, which will lead to the quantum model can only explore the local Hermitian space. In particular, when a certain observable is fixed When the quantum model is trained, the process is equivalent to fixing the current observation quantity Find an optimal parameterized observable . And this process will produce a cluster of Hermitian matrices ,because is a unitary operation, so these matrices have a remarkable commonality, namely that they share the same diagonal eigenvalues. According to the spectral decomposition theorem, any Hermitian matrix can be written as: , here is a unitary operator, represents a real diagonal matrix. Therefore:
[0031]
[0032]
[0033] At the same time, it can be seen that The diagonal elements in The characteristic value of and have the same eigenvalues, and the two can be converted through corresponding unitary operations. Based on the above analysis, the generalized Hermitian operator The area to which they belong is divided, assuming that all The set of unitarily similar Hermitian matrices is , which can be expressed as:
[0034]
[0035] in, , , Based on the above analysis, in the case of a fixed encoding mapping, that is, through After preprocessing the classical data, the data will present a specific distribution in space. A good observable Should be applicable to the distribution of the encoded mapped data. For a quantum bit system, a generalized observable can be initially constructed as:
[0036]
[0037] in ,express The orthogonal Pauli basis matrix corresponding to the quantum bit system, This expression can cover the entire Hermitian space, giving complete freedom of choice of observables.
[0038] In order to be in a better collection Find the optimal observable and construct the generalized Hermitian observable In order to avoid excessive computational effort, the optimal coefficients of the generalized measurement operator can be solved by using the small data set constructed in S1 , which can lock the collection In classic machine learning, by Minimizing the norm and imposing a penalty (regularization) on complex functions is a common operation that can help improve the generalization performance of the model. In this paper, we extend this idea and generalize it accordingly, introducing the concept of the matrix F norm. Specifically, each sample point in the small data set obtained after sampling in S1 Encoded mapping circuit The vector corresponding to the quantum state obtained after mapping is , sample point Corresponding tags .assumed As the generalized Hermitian observable to be optimized, when the encoded mapped data is linearly separable, the following hard margin classifier can be preliminarily constructed:
[0039]
[0040]
[0041]
[0042]
[0043] Here , solving the above optimization problem is similar to the classical machine learning Minimize to help improve the generalization performance of the model. The above formula uses the Hermitian quadratic form To simulate the expected output value of the quantum circuit, the first constraint ensures the Hermitian property of the current matrix, and the second constraint is used to measure the ability of the classifier to classify correctly. ,when , it means the sample point is classified correctly.
[0044] because The Hermitian property of can be expanded in an orthogonal Pauli basis: ,in , which can replace the first constraint and substitute it into the second constraint, the left side of the inequality sign can be transformed into:
[0045]
[0046] Defining nonlinear mappings , which completes the following mapping:
[0047]
[0048] Therefore, the optimization problem can be transformed into the following form:
[0049]
[0050]
[0051]
[0052]
[0053] As can be seen from the previous text, The quantum bit system corresponds to yes Order Pauli basis matrix, so we know , so for Matrix of order , can be expressed by the following inequality:
[0054]
[0055] Relax the original optimization to:
[0056]
[0057]
[0058]
[0059] When the samples in the sampled small data set are After mapping, the linear points are inseparable, that is, some sample points after mapping still do not satisfy the constraints. In this case, the constraints need to have a certain fault tolerance. We introduce the slack variable At the same time, in order to reduce the complexity of the solution and improve the calculation speed, this paper transforms the above inequality constraints into the following form of equality constraints, so the above optimization problem can be rewritten as follows:
[0060]
[0061]
[0062]
[0063] At the same time, due to
[0064]
[0065] Here, express The sample set matrix after mapping, Indicates the length is A column vector of all ones, Indicates the length is , the label column vector, substituting the above formula into the optimization problem can be converted to:
[0066]
[0067] In this order , ,at this time:
[0068]
[0069] Substitute the above formula into the optimization problem and remove the constant term , we can get the following quadratic planning:
[0070]
[0071]
[0072]
[0073]
[0074] The parameters represent the following meanings:
[0075]
[0076]
[0077] because The matrix is a semi-positive matrix, so the quadratic programming is a convex programming. And because it can be seen from the KKT condition that the constraints in the above quadratic programming , is automatically satisfied at the optimal point. Therefore, solving the above quadratic programming is equivalent to solving the standard convex quadratic programming:
[0078]
[0079]
[0080]
[0081] in, The expression is as follows:
[0082]
[0083] In summary, the small dataset constructed in S1 is used as sample information to construct and , and then solve the standard convex quadratic programming to get the optimal solution ; Specifically, the standard convex quadratic programming formula solved on a small data set is as follows:
[0084]
[0085]
[0086]
[0087] in,
[0088]
[0089]
[0090]
[0091]
[0092] 1) The matrix is semi-positive definite, Indicates the length is n A column vector of all 1s;
[0093] 2) The method to obtain is as follows:
[0094] When the code mapping circuit in S1 is fixed, the code mapping circuit The Pauli basis group corresponding to the quantum bit system is determined. Assuming that d Pauli bases are selected, the mapping relationship can be described by the following formula:
[0095]
[0096] At this time, the sample matrix A of the small data set is passed through The corresponding matrix after mapping is recorded as , which can be specifically expressed as:
[0097]
[0098] , here represents the identity matrix, X represents the Pauli-X matrix, Y represents the Pauli-Y matrix, and Z represents the Pauli-Z matrix, and their expressions are as follows;
[0099]
[0100] 3) represents a vector in p, with a length of d and all elements being 1. It is independent of the sampled small data set and is a fixed vector. Due to the binary classification task, each sample point carries a label, +1 and -1 respectively. The ultimate goal is to separate these two types of data, so y represents a vector composed of the labels carried by all the data in the small data set. C represents a constant in p in the objective function of the quadratic programming, which represents the penalty parameter and needs to be set in advance. It also represents a constant in p, called the interval parameter, which also needs to be set in advance.
[0101] 4) represents the vector to be optimized in the standard convex quadratic programming formula, and After confirmation, and Will be uniquely determined, and the optimal solution can be obtained as ; b represents the vector to be optimized The last element in belongs to the variable to be optimized. , They represent vectors of length d, express The first d elements in express Elements from d+1 to 2d, , , These are all variables to be optimized.
[0102] Furthermore, in S3:
[0103] 1) Take The first d elements are recorded as ; then take All elements from d+1 to 2d are recorded as , at this time according to and The best ,in Each element of can be expressed as: , and Represents vectors and No. i elements; and then the optimal Hermitian matrix can be calculated by the following expression,
[0104]
[0105] Represents the elements in the d Pauli bases corresponding to the selected mapping;
[0106] 2) Yes Perform eigendecomposition , assuming ,get The eigenvalue matrix of is:
[0107]
[0108] At this time, calculate , which will be used as the loss function in subsequent steps The parameter used is N, which represents the number of quantum bits. The above statement The characteristic value of .
[0109] Furthermore, in S4:
[0110] (1) Encoding mapping module, selects the fixed And the preprocessing function that preprocesses the original data in the data set works together to complete the feature mapping.
[0111] (2) In the trainable parameterized quantum circuit module, the trainable gates in each quantum bit are Completed, quantum bits rely on The gates are entangled, and such a circuit structure usually has a large search space because it includes rotations in all directions. as well as The matrix forms of the gates are shown below:
[0112]
[0113]
[0114] in, represents the parameters of the trainable gate circuit, i is the imaginary factor; e represents the natural exponent.
[0115] (3) The observable quantity module required for measurement selects M obtained in S3 as the observable quantity.
[0116] Furthermore, in S5:
[0117] The process of executing S5 requires selecting a loss function suitable for the current task. Here, the minimum mean square error loss function is used to optimize the parameters of the quantum machine learning model:
[0118]
[0119] in, represents the normalization factor, which is calculated in S3; represents the number of samples in the training set, M is the eigenvalue matrix after decomposition in S3, Represents sample points The expected value of the output of the quantum circuit under the action of the measurement operator M; b and All represent variables to be optimized in the quantum machine learning model. Indicates the labels carried by the training set samples.
[0120] Combine the expected output value with the above adjusted loss function to complete the parameters of the trainable gate circuit on the training sample , and finally obtain the quantum machine learning model designed by the present invention.
[0121] Beneficial effects: The present invention proposes a design method for observables in quantum machine learning models, which expands the limitations of the selection of observables in previous quantum machine learning models. It improves the generalization performance of quantum machine learning models by optimizing a generalized observable. It mainly involves two steps of optimization. First, a set suitable for the small data set after sampling is found by solving quadratic programming. , and then collect The eigenvalues of are constructed as observables to optimize the gate circuit parameters on the training set, thereby further improving the performance of the model. The implementation of the present invention is expected to promote the development of the field of quantum machine learning and provide more efficient and powerful tools and methods for the design of quantum machine learning models for future quantum technology applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0122] Figure 1 It is a flow chart of a method for improving the generalization performance of a quantum machine learning model by optimizing observables provided by the present invention;
[0123] Figure 2 is a quantum circuit diagram for completing data encoding in an embodiment;
[0124] Figure 3 is a parameterized quantum circuit diagram for the trainable part in the embodiment;
[0125] Figure 4 In the embodiment, based on M, , , Four different measurement operators are respectively used on the Moons, Circles, Blobs, and PCA compressed Breast Cancer datasets. The corresponding quantum machine learning model training with the same structure of encoding circuits and training circuits is performed until convergence, and the corresponding accuracy graph on the test set;
[0126] Figure 5 This is a graph of average accuracy after the four models corresponding to the four different data sets in the embodiment are trained until convergence, and the test set data is run 10 times on an IBM real quantum computer. DETAILED DESCRIPTION
[0127] The technical solution of the present invention is described in detail below with reference to the accompanying drawings, but the protection scope of the present invention is not limited to the embodiments.
[0128] like Figure 1 As shown, the present invention discloses a method for improving the generalization performance of quantum machine learning models. The present invention improves the generalization performance of quantum machine learning models by optimizing observables. Based on the method of the present invention, four different two-dimensional data sets in Scikit-Learn are used for classification experiments. The test process and results are as follows:
[0129] Step 1) Four datasets in Scikit-Learn are used, namely the moons dataset, circles dataset, blobs dataset and breast cancer dataset (compressed into 2D using principal component analysis PCA).
[0130] Among these datasets, the moons dataset, circles dataset, and blobs dataset are artificially generated datasets. The moons dataset consists of two intertwined half-moon shapes, and the circles dataset consists of two concentric circles. Their main feature is that they are nonlinearly separable, that is, there is no straight line or simple hyperplane that can completely distinguish between the two categories of data points. This makes these two datasets very suitable for testing the performance of quantum machine learning models when dealing with complex, nonlinear decision boundaries. The blobs dataset simulates certain datasets in the real world (such as astronomical data and biological data) by generating data points with Gaussian distribution characteristics. In the binary classification scenario, by assigning a category label to the data point, the ability of the quantum machine learning model to distinguish different Gaussian distribution data can be evaluated. The breast cancer dataset originates from the real medical field and contains various characteristic information of breast cancer tumors, such as the size, shape, and texture of the tumor, as well as the corresponding diagnostic results (malignant or benign). By using this dataset for classification model training, the application potential and accuracy of quantum machine learning models in the field of medical diagnosis can be evaluated.
[0131] At the same time, the ratio of training set to test set is set to 4:1, the sampling ratio is set to 0.3, and sampling is performed from the training set, while fixing a coding mapping circuit ,like Figure 2 As shown, the quantum circuit is built using the pennylane quantum machine learning simulation platform. Before loading classical data into the quantum circuit, the raw data in the data set is preprocessed using classical linear or nonlinear functions. , , , represents the first feature of the data, Represents the second feature of the data. After the above preprocessing, it is used as The parameters in the revolving gate complete the feature mapping process from classical data to quantum data.
[0132] Step 2) Figure 2 After the corresponding coding and mapping circuit is constructed, the Pauli basis group corresponding to the quantum bit system of the coding and mapping circuit will be determined, and the Pauli basis group is used for mapping. Assuming that d Pauli bases are selected, the mapping relationship can be described by the following formula:
[0133]
[0134] All samples after sampling are The sample matrix after mapping is recorded as , which can be expressed as:
[0135]
[0136] At this point, constructing the semi-positive definite matrix H is as follows:
[0137]
[0138] in, Represents a column vector of all 1s of length n, and constructs vector p as follows:
[0139]
[0140] Here represents a full 1 column vector of length d, y represents a label column vector, C represents a penalty parameter, represents the interval parameter. Set C=1 and After that, H and p Will be uniquely determined, then solve the following standard convex quadratic programming to obtain the optimal solution .
[0141]
[0142]
[0143]
[0144] in, The expression is as follows:
[0145]
[0146] Step 3) Take The first d elements are recorded as ; then take All elements from d+1 to 2d are recorded as , at this time according to and The best ,in Each element of can be expressed as: , and then the optimal Hermitian matrix can be calculated by the following expression:
[0147]
[0148] right Perform eigendecomposition , assuming ,get The eigenvalue matrix of is:
[0149]
[0150] Calculate now , which will be used as the loss function in subsequent steps Parameters used.
[0151] Step 4) Build a quantum machine learning model: The construction of a quantum machine learning model mainly relies on three modules, including a coding mapping module, a trainable parameterized quantum circuit module, and an observable measurement module required for measurement.
[0152] (1) Encoding mapping module, select the fixed And preprocessing functions , , They work together to complete feature mapping.
[0153] (2) The trainable gates in each qubit in the trainable part are Completed, quantum bits rely on The gates are entangled and connected. Such a circuit structure usually has a large search space because it includes rotations in all directions, such as Figure 3 shown.
[0154] (3) Select the value obtained in step 3) as an observable quantity.
[0155] Step 5) Train the quantum machine learning model constructed in step 4) through the following loss function to optimize the parameters , here we use the following minimum mean square error loss function,
[0156]
[0157] in, represents the normalization factor, which is calculated in 3; represents the number of samples in the training set, M is the eigenvalue matrix solved in 3), Represents sample points The expected value of the output of the quantum circuit under the action of the measurement operator M;
[0158] Repeat this step until the set 300 iterations are reached to obtain the optimized quantum machine learning model.
[0159] Step 6) After the training of the quantum machine learning model is completed, the accuracy evaluation index is used to measure the performance of the model. At the same time, we compared the single Pauli operator used as the measurement operator in the past and selected three common Pauli operators, namely , as well as , and the observable designed by the present invention is denoted as M. The experimental accuracy of the test sets corresponding to the moons dataset, circles dataset, blobs dataset and breast cancer dataset is as follows: Figure 4 As shown, it can be seen that, under the same encoding circuit and trainable circuit, the difference in observables will have a significant impact on the performance of the model on unknown data sets. It can also be observed that the model designed by the present invention has good generalization performance on the four data sets, especially on the breast cancer data set.
[0160] Step 7) To verify the effectiveness of this solution on a real quantum computer, all trained models were tested 10 times on the IBM real quantum computer osaka for the pre-divided test set. Similarly, accuracy was used as the measurement indicator. Figure 5 It reflects the average value of the accuracy on a real quantum computer. It can be seen that the model trained by this scheme is still very effective after running on a real quantum computer, which further proves the feasibility of this scheme.
[0161] Through all the above analysis and corresponding experimental results, it can be seen that compared with the traditional single Pauli operator measurement, the method of improving the generalization performance of quantum machine learning models by optimizing observables is more reasonable. It draws on the idea of regularization in traditional machine learning and makes corresponding extensions to enhance the generalization performance of quantum machine learning models. It can further improve the performance of the model on unknown data sets and provide new ideas and contributions to the design of quantum machine learning models.
[0162] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes in form and details may be made without departing from the spirit and scope of the present invention.
Claims
1. A method for improving the generalization performance of a quantum machine learning model, characterized in that: The steps include: S1. Add a binary classification data set containing two types of samples and their corresponding features and divide it into a training set and a test set in proportion. Randomly sample the training set data in a set proportion to obtain a small data set. At the same time, fix a coding mapping circuit to perform feature mapping on all sample points in the small data set. The binary classification data set is a breast cancer data set, which originates from the real medical field and contains a variety of characteristic information of breast cancer tumors and corresponding diagnosis results; S2, the sample matrix A of the small data set obtained by S1 is passed through The corresponding quantum state after mapping Matrix As sample information, solve its standard convex quadratic programming and get the optimal solution ; S3, get the optimal solution according to S2 Compute the optimal Hermitian matrix , and then perform eigendecomposition on it to obtain the matrix corresponding to its eigenvalues, and use the eigenvalue matrix as the actual observable quantity M of the quantum classifier; S4. Constructing a quantum machine learning model, wherein the quantum machine learning model includes a coding mapping module, a trainable parameterized quantum circuit module, and an observable quantity module required for measurement; S5, designing a loss function of the quantum machine learning model, and training the quantum machine learning model constructed in S4 by using the designed loss function until a set number of iterations is reached, thereby obtaining an optimized quantum machine learning model; S6. Input the test set data to be classified into the optimized quantum machine learning model to obtain the classification result.
2. A method for improving the generalization performance of a quantum machine learning model according to claim 1, characterized in that: In S1: 1) Assume that the sampled small data set has data points. After preprocessing, each data point has k features, and its corresponding sample matrix is recorded as ,satisfy: ; Among them, each row represents a sample point, and each column corresponds to a feature; 2) Use a fixed encoding circuit to perform feature mapping on all sample points in the sampled small data set. Assume that the fixed encoding mapping circuit is recorded as , then every sample point in A Through the quantum circuit The corresponding output quantum state is , the vector corresponding to this quantum state is simply written as , N represents the number of quantum bits.
3. A method for improving the generalization performance of a quantum machine learning model according to claim 2, characterized in that: The standard convex quadratic programming formula solved in S2 on a small data set is as follows: ; ; ; in, ; ; ; ; 1) The matrix is semi-positive definite, Indicates the length n A column vector of all 1s; 2) The method to obtain is as follows: When the code mapping circuit in S1 is fixed, the code mapping circuit The Pauli basis group corresponding to the quantum bit system is determined. Assuming that d Pauli bases are selected, the mapping relationship can be described by the following formula: ; The sample matrix A of the small data set is passed through The corresponding matrix after mapping is recorded as , which can be specifically expressed as: ; in, , represents the identity matrix, X represents the Pauli-X matrix, Y represents the Pauli-Y matrix, and Z represents the Pauli-Z matrix, and their expressions are as follows; ; 3) represents a vector in p, whose length is d and all elements are 1; y represents a vector consisting of the labels carried by all data in the small data set; C represents a constant in p in the objective function of the quadratic programming, which represents the penalty parameter and needs to be set in advance; Represents a constant in p, which is an interval parameter and needs to be set in advance; 4) represents the vector to be optimized in the standard convex quadratic programming formula, and After confirmation, and Will be uniquely determined, and solving the above standard convex quadratic programming can obtain the optimal solution, which is recorded as ; b represents the vector to be optimized The last element in belongs to the variable to be optimized. , They represent vectors of length d, express The first d elements in express Elements from d+1 to 2d.
4. A method for improving the generalization performance of a quantum machine learning model according to claim 3, characterized in that: The specific operations of S3 are as follows: 3.1、Get The first d elements are recorded as ; then take All elements from d+1 to 2d are recorded as , at this time according to and The best ,in Each element of can be expressed as: , and Represents vectors and No. i elements; and then the optimal Hermitian matrix can be calculated by the following expression: ; 3.
2. Yes Perform eigendecomposition , assuming ,get The eigenvalue matrix of is: ; Calculate now , N represents the number of quantum bits, express The characteristic value of .
5. A method for improving the generalization performance of a quantum machine learning model according to claim 4, characterized in that: In S4: (1) Encoding mapping module, selects the fixed and a preprocessing function that preprocesses the raw data in the data set to work together to complete the feature mapping; (2) In the trainable parameterized quantum circuit module, the trainable gates in each quantum bit are Completed, quantum bits rely on The gate makes an entangled connection; as well as The matrix forms of the gates are shown below: ; ; in, represents the parameters of the trainable gate circuit, i is an imaginary factor; e represents the natural exponent; (3) The observable quantity module required for measurement selects M obtained in S3 as the observable quantity.
6. A method for improving the generalization performance of a quantum machine learning model according to claim 5, characterized in that: The formula of the loss function in S5 is as follows: ; in, represents the normalization factor, which is calculated in S3; represents the number of samples in the training set, M is the eigenvalue matrix after decomposition in S3, Represents sample points The expected value of the output of the quantum circuit under the action of the measurement operator M; b and represents the variable to be optimized in the quantum machine learning model, Indicates the labels carried by the training set samples.
Citation Information
Patent Citations
A reactive power optimization method for photovoltaic system based on quantum particle swarm optimization algorithm
CN109274136A
Image set classification method and system based on representation learning reconstruction residual analysis
CN113887661A
Electric power CPS abnormal intrusion detection method based on quantum machine learning
CN115987618A
Pipeline anti-corrosion layer defect classification and identification method and device and readable storage medium
CN117591946A
Rigging durability testing method and device based on artificial intelligence
CN117892182A
