Quantum prediction method and terminal based on Gaussian process regression
The covariance quantum state of Gaussian process regression is directly calculated in the quantum system through quantum coherence encoding and quantum controlled rotation operations, which solves the computational efficiency problem under large-scale data sets and achieves the timeliness of the Gaussian process regression method.
Patent Information
- Application Number
- CN202411124461.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing quantum Gaussian regression process method cannot improve the timeliness of covariance function calculations under large-scale data sets, resulting in a large consumption of computing resources.
Standard covariance quantum states between training data points and predicted data points are created through quantum coherence encoding, quantum amplitude estimation, and first quantum controlled rotation operations, and matrix exponentialization operations and second quantum controlled by quantum principal component analysis The rotation operation determines the covariance matrix and the standard covariance quantum state, thereby directly calculating the mean and variance of the predicted data points.
Using quantum computing characteristics to directly determine the covariance vector between the training data points and the predicted data points, avoiding the problem of iterative training model solving hyperparameters, significantly accelerating the computational efficiency of the Gaussian process regression prediction method, and improving the face of large-scale data timeliness.
Smart Images

Figure CN118643908B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quantum system prediction, and in particular to a quantum prediction method and terminal based on Gaussian process regression. Background Art
[0002] As an interdisciplinary field of computer science and statistical applications, machine learning has advantages such as adaptability and learning from past experience. More and more researchers are attracted to machine learning and combine their own research with machine learning. However, with the development of information technology, the surge in data volume has become a problem and challenge for modern computer performance.
[0003] Quantum computing uses the principles of quantum mechanics and uses properties such as quantum entanglement and quantum superposition to achieve computing tasks. It has been proven to have an exponential acceleration effect on traditional computers in certain problems. For example, the quantum algorithm proposed by Shor for large integer factorization has an exponential acceleration over the classical algorithm. In recent years, quantum computing has been widely used in the field of machine learning, and various quantum machine learning algorithms have emerged. The research and exploration of quantum algorithms and the properties of quantum mechanics has taken the field of artificial intelligence a step further. Therefore, it is crucial to develop efficient quantum algorithms to achieve tasks in machine learning and data mining.
[0004] A popular direction in machine learning is to develop usable Bayesian methods to solve corresponding challenging problems. A representative example is Gaussian process regression (GPR). GPR has a wide range of applications, such as automatic control, image processing, and time series analysis. The main process of GPR is to train the output data given a number of sample data to predict the output of the new input data and calculate the variance and mean between the new input data and the output data. However, the computational cost of GPR is very high, especially when the size of the training set is large enough. In response to this, people began to look for ways to speed up the GPR process, and the development of quantum computing has given people new ideas. However, the existing quantum Gaussian regression process method still cannot improve the timeliness of covariance function calculation in the case of large-scale data sets. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a quantum prediction method and terminal based on Gaussian process regression, which can improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculation.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0007] Quantum prediction methods based on Gaussian process regression include:
[0008] Obtaining training data points and prediction data points, and calculating a covariance matrix between the training data points and the prediction data points;
[0009] Creating a standard covariance quantum state between the training data point and the prediction data point through quantum coherence encoding, quantum amplitude estimation, and a first quantum controlled rotation operation;
[0010] Determine a target quantum state including the covariance matrix and the standard covariance quantum state through a matrix indexation operation of quantum principal component analysis and a second quantum controlled rotation operation;
[0011] A quantum exchange test operation is performed on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0013] A quantum prediction terminal based on Gaussian process regression includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, each step of the above-mentioned quantum prediction method based on Gaussian process regression is implemented.
[0014] The beneficial effect of the present invention is that: by utilizing the characteristics of quantum computing, the standard covariance quantum state between the training data points and the prediction data points can be directly determined through quantum coherence coding, quantum amplitude estimation and the first quantum controlled rotation operation, thereby determining the mean and variance of the prediction value corresponding to the prediction data point. Compared with the traditional Gaussian process regression prediction method, the present invention does not need to iteratively train the model through the training data points to solve the hyperparameters in the covariance function, but directly determines the covariance vector between the training data points and the prediction data points based on quantum computing, which can accelerate the time efficiency of the Gaussian process regression prediction method in calculating the covariance function, avoid the problem of computing resource consumption, and effectively improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A flowchart of a quantum prediction method based on Gaussian process regression provided by an embodiment of the present invention;
[0016] Figure 2 A quantum circuit diagram for determining a standard covariance quantum state provided by an embodiment of the present invention;
[0017] Figure 3 A quantum circuit diagram for determining a target quantum state provided by an embodiment of the present invention;
[0018] Figure 4A quantum circuit diagram for calculating the mean and variance of a predicted value provided by an embodiment of the present invention;
[0019] Figure 5 A quantum circuit diagram for determining a prediction marker category provided by an embodiment of the present invention;
[0020] Figure 6 A schematic diagram of the structure of a quantum prediction terminal based on Gaussian process regression provided by an embodiment of the present invention;
[0021] Description of labels:
[0022] 100. Quantum prediction terminal based on Gaussian process regression; 101. Memory; 102. Processor. DETAILED DESCRIPTION
[0023] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in conjunction with the implementation modes and the accompanying drawings.
[0024] The embodiment of the present invention provides a quantum prediction method based on Gaussian process regression, including:
[0025] Obtaining training data points and prediction data points, and calculating a covariance matrix between the training data points and the prediction data points;
[0026] Creating a standard covariance quantum state between the training data point and the prediction data point through quantum coherence encoding, quantum amplitude estimation, and a first quantum controlled rotation operation;
[0027] Determine a target quantum state including the covariance matrix and the standard covariance quantum state through a matrix indexation operation of quantum principal component analysis and a second quantum controlled rotation operation;
[0028] A quantum exchange test operation is performed on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
[0029] From the above description, it can be seen that the beneficial effect of the present invention is that: by utilizing the characteristics of quantum computing, the standard covariance quantum state between the training data points and the prediction data points can be directly determined through quantum coherence coding, quantum amplitude estimation and the first quantum controlled rotation operation, thereby determining the mean and variance of the prediction value associated with the prediction data point. Compared with the traditional Gaussian process regression prediction method, the present invention does not need to iteratively train the model through training data points to solve the hyperparameters in the covariance function, but directly determines the covariance vector between the training data points and the prediction data points based on quantum computing, which can accelerate the time efficiency of the Gaussian process regression prediction method in calculating the covariance function, avoid the problem of computing resource consumption, and effectively improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculations.
[0030] Further, the step of creating a standard covariance quantum state between the training data point and the prediction data point through quantum coherence coding, quantum amplitude estimation, and a first quantum controlled rotation operation includes:
[0031] In the quantum system, a first register, a second register, a third register, and a fourth register are created respectively;
[0032] Based on the first register, the second register and the third register, the training data points and the predicted data points are quantum coherently encoded to obtain a coherent entangled quantum state;
[0033] Performing quantum amplitude estimation on the coherent entangled quantum state according to the fourth register to obtain a coherent inner product quantum state;
[0034] In the quantum system, a fifth register is created, and the fifth register is controlled according to the fourth register to perform a first quantum controlled rotation operation to obtain a standard covariance quantum state.
[0035] From the above description, it can be seen that the training data points and the predicted data points are encoded into the quantum state through quantum coherence coding, so as to utilize quantum superposition and quantum entanglement to achieve efficient parallel computing, thereby accelerating the calculation process of the standard covariance quantum state. At the same time, based on the first quantum controlled rotation operation, the covariance information between the training data points and the predicted data points can be converted to amplitude, so that accurate values can be obtained through subsequent quantum amplitude estimation.
[0036] Further, the creating the first register, the second register, the third register and the fourth register respectively comprises:
[0037] The initial quantum state is created according to the number of training data points: The first register of
[0038] The initial quantum state is created according to the preset precision of the quantum coherent coding: The second register of
[0039] Create the initial quantum state as The third register is used to create an initial quantum state according to the preset accuracy of the quantum amplitude estimate. The fourth register of
[0040] in, is the Dirac symbol, represents the jth register, Indicates that there are n quantum bits in the register, Indicates that the decimal n is rounded up. M represents the number of training data points,l represents the preset precision of quantum coherent coding, s Indicates the preset precision of the quantum amplitude estimate.
[0041] From the above description, it can be seen that registers are created according to the number of training data points, quantum coherence coding, and the accuracy required for quantum amplitude estimation to ensure the accuracy of subsequent standard covariance quantum states.
[0042] Further, the performing quantum coherent encoding on the training data points and the prediction data points based on the first register, the second register, and the third register to obtain a coherent entangled quantum state includes:
[0043] Performing Hadamard transformation on the first register and the third register respectively to obtain an index quantum state and a control quantum state;
[0044] Performing a corresponding type of coherent state unitary operation on the second register according to the index quantum state and the control quantum state to obtain a training coherent state of the training data point and a predicted coherent state of the predicted data point;
[0045] Generating a coherent superposition quantum state according to the index quantum state, the control quantum state, the training coherent state, and the predicted coherent state;
[0046] Based on the coherent superposition quantum state, the Hadamard transformation is performed again on the third register to obtain a coherent entangled quantum state.
[0047] As can be seen from the above description, the first register is subjected to a Hadamard transform to obtain an index for marking training data points, so as to facilitate the subsequent direct reading of data points in the register through the index. The third register is subjected to a Hadamard transform so that the third register is in a quantum superposition state, which is used to control the second register to perform corresponding types of coherent state unitary operations at different times. In the process of determining the training coherent state and the predicted coherent state, the first register is used to provide index information of the training data points and the predicted data points, and the third register is used to control the second register to generate the training coherent state and the predicted coherent state at different times, so that the training coherent state and the predicted coherent state are superimposed to obtain a coherent superposition quantum state. Finally, the third register is subjected to a Hadamard transform so that the training coherent state and the predicted coherent state are entangled, thereby utilizing quantum superposition and quantum entanglement to realize parallel computing and accelerate the calculation process of the covariance function of the training data points and the predicted data points.
[0048] Further, controlling the fifth register to perform a first quantum controlled rotation operation according to the fourth register to obtain a standard covariance quantum state includes:
[0049] Controlling the fifth register to perform a first quantum controlled rotation operation according to the fourth register to obtain a first covariance quantum state in an entangled state;
[0050] Based on the first covariance quantum state in the entangled state, an inverse operation is performed on the second register, the third register, and the fourth register, so that the second register, the third register, and the fourth register restore the initial quantum state to obtain a second covariance quantum state in a non-entangled state;
[0051] The fifth register in the second covariance quantum state is measured to obtain a standard covariance quantum state.
[0052] From the above description, it can be seen that the covariance function of the training data points and the predicted data points is converted to amplitude through the first quantum controlled rotation operation, so that the accurate covariance function can be obtained based on the quantum amplitude estimation later. At the same time, by performing inverse operations on the second register, the third register, and the fourth register, the entanglement state between the registers is released so that the registers can be discarded to release the quantum system space. Since the covariance quantum state is converted to amplitude, the standard covariance quantum state can be obtained by measuring the specified register.
[0053] Further, the matrix indexation operation of quantum principal component analysis and the second quantum controlled rotation operation determine the target quantum state including the covariance matrix and the standard covariance quantum state, including:
[0054] In the quantum system, creating a sixth register, initializing the sixth register to the standard covariance quantum state, and performing a matrix indexation operation on the standard covariance quantum state;
[0055] Converting the covariance matrix into the phase of the sixth register, and performing quantum phase estimation on the standard covariance quantum state to obtain a covariance characteristic quantum state;
[0056] In the quantum system, a seventh register is created, and according to the sixth register in the covariance characteristic quantum state, the seventh register is controlled to perform a second quantum controlled rotation operation to obtain a first characteristic quantum state in an entangled state;
[0057] Performing an inverse operation on the sixth register based on the first characteristic quantum state in the entangled state, so that the sixth register restores the initial quantum state to obtain a second characteristic quantum state in the non-entangled state;
[0058] The seventh register in the second characteristic quantum state is measured to obtain a target quantum state including the covariance matrix and the standard covariance quantum state.
[0059] From the above description, it can be seen that by creating a sixth register to store the standard covariance quantum state after the matrix indexation operation, and converting the covariance matrix into the phase of the sixth register, the eigenvalue can be extracted from the standard covariance quantum state by using quantum phase estimation, that is, the covariance characteristic quantum state, and the covariance characteristic quantum state is converted to the amplitude through the second quantum controlled rotation operation, thereby achieving accurate measurement of the eigenvalue.
[0060] Further, the step of performing a quantum exchange test operation on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point includes:
[0061] Determining a first inner product between the target quantum state and the standard covariance quantum state;
[0062] Determine a second inner product between the target quantum state and a label category quantum state preset for the predicted data point;
[0063] A quantum exchange test operation is performed on the first inner product and the second inner product to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
[0064] From the above description, it can be seen that the mean and variance of the predicted data points can be directly obtained by performing a quantum exchange test operation on the first inner product and the second inner product, without the need to solve the hyperparameters in the covariance function, which can effectively improve the timeliness of the Gaussian process regression prediction method.
[0065] Furthermore, it also includes:
[0066] In the quantum system, an eighth register is created, and a Hadamard transformation is performed on the eighth register;
[0067] If the quantum state of the eighth register is the first state, returning to execute the step of acquiring the training data points and the prediction data points to obtain the target quantum state;
[0068] If the quantum state of the eighth register is the second state, generating the label category quantum state according to the label category of the predicted data point;
[0069] Generate a predicted category quantum state according to the target quantum state and the labeled category quantum state;
[0070] A predicted label category of the predicted data point is determined according to the predicted category quantum state.
[0071] From the above description, it can be seen that the eighth register is used to control the quantum system to alternately generate the target quantum state and the label category quantum state, thereby accelerating the calculation efficiency. In addition, the present invention can accurately obtain the predicted label category of the predicted data point according to the target quantum state and the label category quantum state, thereby ensuring the prediction effect.
[0072] Further, determining the prediction label category of the prediction data point according to the prediction category quantum state includes:
[0073] Measuring the predicted category quantum state to determine the probability that the predicted category quantum state is the first state;
[0074] If the probability is greater than a preset probability value, setting the predicted label category of the predicted data point to a positive category;
[0075] If the probability is less than a preset probability value, the predicted label category of the predicted data point is set to a negative class.
[0076] From the above description, it can be seen that the predicted label category of the predicted data point can be directly determined based on the measured probability of the predicted category quantum state. If the probability is greater than the preset value, the predicted data point is characterized as positive class correlation, and if the probability is less than the preset value, the predicted data point is characterized as negative class correlation. In this way, the correlation between the predicted data point and the training data point is predicted.
[0077] Another embodiment of the present invention provides a quantum prediction terminal based on Gaussian process regression, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements each step of the above-mentioned quantum prediction method based on Gaussian process regression when executing the computer program.
[0078] From the above description, it can be seen that the beneficial effect of the present invention is that: by utilizing the characteristics of quantum computing, the standard covariance quantum state between the training data points and the prediction data points can be directly determined through quantum coherence coding, quantum amplitude estimation and the first quantum controlled rotation operation, thereby determining the mean and variance of the prediction value associated with the prediction data point. Compared with the traditional Gaussian process regression prediction method, the present invention does not need to iteratively train the model through training data points to solve the hyperparameters in the covariance function, but directly determines the covariance vector between the training data points and the prediction data points based on quantum computing, which can accelerate the time efficiency of the Gaussian process regression prediction method in calculating the covariance function, avoid the problem of computing resource consumption, and effectively improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculations.
[0079] The embodiments of the present invention provide a quantum prediction method and terminal based on Gaussian process regression, which can be applied to the scenario of predicting continuous value targets, and can improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculations. The following is an explanation through specific embodiments:
[0080] Please refer to Figures 1 to 4 , Embodiment 1 of the present invention is:
[0081] like Figure 1 As shown, the quantum prediction method based on Gaussian process regression includes the following steps:
[0082] S1. Obtain training data points and prediction data points, and calculate the covariance matrix between the training data points and the prediction data points.
[0083] In some embodiments, the training data points are defined as , the predicted data point is defined as , the covariance matrix between the training data points and the predicted data points is defined as K.
[0084] S2. Creating a standard covariance quantum state between the training data point and the prediction data point through quantum coherence coding, quantum amplitude estimation, and a first quantum controlled rotation operation.
[0085] like Figure 2 As shown, Figure 2 Each horizontal line in the table represents a register, / represents the presence of multiple quantum bits in a register, H represents Hadamard transformation, represents the training coherent state unitary operation, Denotes the predicted coherent state unitary operation, U G represents the quantum amplitude estimate, CR1 represents the first quantum controlled rotation operation, and U G + Denotes the quantum amplitude estimate U G The inverse operation of Hadamard transform is the same as the original operation, so both are represented by H. Represents the training coherent state unitary operation The inverse operation of Represents the predicted coherent state unitary operation The inverse operation of Indicates a measurement operation.
[0086] Specifically, the step S2 includes:
[0087] S21. In the quantum system, create a first register, a second register, a third register, and a fourth register respectively.
[0088] Specifically, Figure 2 As shown, the step S21 includes:
[0089] S211, creating an initial quantum state according to the number of training data points: The first register.
[0090] S212, creating an initial quantum state according to the preset precision of the quantum coherent coding: The second register.
[0091] S213, create the initial quantum state The third register is used to create an initial quantum state according to the preset accuracy of the quantum amplitude estimate. The fourth register.
[0092] in, is the Dirac symbol, represents the jth register, Indicates that there are n quantum bits in the register, Indicates that the decimal n is rounded up. M represents the number of training data points, l represents the preset precision of quantum coherent coding, s Indicates the preset precision of the quantum amplitude estimate.
[0093] Based on the first register, the second register, the third register and the fourth register of the above initial quantum state, the initial quantum state of the current quantum system can be characterized as It should be noted that and Indicates the right arrow. , ; and Indicates the left arrow. , .
[0094] S22. Perform quantum coherent encoding on the training data points and the predicted data points based on the first register, the second register, and the third register to obtain a coherent entangled quantum state.
[0095] Specifically, Figure 2 As shown, the step S22 includes:
[0096] S221. Perform Hadamard transformation on the first register and the third register respectively to obtain an index quantum state and a control quantum state.
[0097] In some embodiments, the first register is first subjected to Hadamard transformation H to obtain indexes marking all training data points, so as to facilitate the subsequent parallel reading of training data points. The index quantum state obtained by the first register is specifically: , where i represents the encoding of the index of the training data point. At this time, the quantum state of the quantum system can be represented as Then perform Hadamard transformation H on the third register, so that the third register is in a quantum superposition state, which is used to control other registers to perform different coherent state unitary operations at different times. The control quantum state obtained by the third register is specifically: At this point, the quantum state of the quantum system can be characterized as In some embodiments, the Hadamard transformation H in different quantum states is specifically: , .
[0098] S222. Perform a corresponding type of coherent state unitary operation on the second register according to the index quantum state and the control quantum state to obtain a training coherent state of the training data point and a predicted coherent state of the predicted data point.
[0099] In some embodiments, the corresponding type of coherent state unitary operation includes a training coherent state unitary operation and a prediction coherent state unitary operation. Specifically: , predicting the coherent state unitary operation Specifically: .
[0100] In some embodiments, when the control quantum state of the third register is When the second register is trained, the coherent state unitary operation is performed , to obtain the training coherent state When the control quantum state of the third register is When the second register is predicted to be coherent, the unitary operation is performed , to obtain the predicted coherent state .
[0101] S223, generating a coherent superposition quantum state according to the index quantum state, the control quantum state, the training coherent state and the predicted coherent state.
[0102] In some embodiments, at this time, the coherent superposition quantum state generated by the quantum system can be characterized as .
[0103] S224. Based on the coherent superposition quantum state, perform the Hadamard transformation on the third register again to obtain a coherent entangled quantum state.
[0104] In some embodiments, the third register is subjected to Hadamard transformation H based on the coherent superposition quantum state to obtain the coherent entangled quantum state specifically as follows: , where the quantum entangled state .
[0105] S23. Estimating the quantum amplitude of the coherent entangled quantum state according to the fourth register to obtain a coherent inner product quantum state.
[0106] In some embodiments, U is estimated by the quantum amplitude G Determine the above quantum entangled state of The square of the amplitude , then the inner product between the training coherent state and the predicted coherent state can be obtained in the fourth register At this point, the quantum state of the quantum system can be characterized as By performing quantum subtraction on the fourth register to remove the interference of the constant term in the quantum state, the coherent inner product quantum state is obtained. .
[0107] S24. In the quantum system, a fifth register is created, and the fifth register is controlled according to the fourth register to perform a first quantum controlled rotation operation to obtain a standard covariance quantum state.
[0108] Specifically, Figure 2 As shown, the step S24 includes:
[0109] S241. Control the fifth register to perform a first quantum controlled rotation operation according to the fourth register to obtain a first covariance quantum state in an entangled state.
[0110] In some embodiments, the initial quantum state of the fifth register is .
[0111] In some embodiments, since the training data points and predicted data points The covariance function vector between Based on mathematical definitions, it can be expressed in quantum systems as ,but Therefore, after controlling the fifth register to perform the first quantum controlled rotation operation CR1, Right now Converted to amplitude, we can get the covariance function vector At this time, the first covariance quantum state of the quantum system in the entangled state is specifically:
[0112] .
[0113] S242. Perform an inverse operation on the second register, the third register, and the fourth register based on the first covariance quantum state in the entangled state, so that the second register, the third register, and the fourth register restore the initial quantum state to obtain the second covariance quantum state in the non-entangled state.
[0114] In some embodiments, after the second register, the third register, and the fourth register are restored to their initial quantum states, the second register, the third register, and the fourth register are discarded. At this time, only the first register and the fifth register are retained in the quantum system, so the second covariance quantum state of the quantum system in the non-entangled state is specifically .
[0115] S243. Measure the fifth register in the second covariance quantum state to obtain a standard covariance quantum state.
[0116] In some embodiments, the fifth register is measured to obtain the quantum state The state at the time of Specifically = .
[0117] S3. Determine a target quantum state including the covariance matrix and the standard covariance quantum state through a matrix indexation operation of quantum principal component analysis and a second quantum controlled rotation operation.
[0118] like Figure 3 As shown, Figure 3 Each horizontal line in the table represents a register, / represents the presence of multiple quantum bits in a register, O represents the matrix indexation operation of quantum principal component analysis, QPE represents quantum phase estimation, CR2 represents the second quantum controlled rotation operation, QPE represents the second quantum controlled rotation operation, -1 represents the inverse operation of quantum phase estimation QPE, Indicates a measurement operation.
[0119] Specifically, Figure 3 As shown, step S3 includes:
[0120] S31. In the quantum system, create a sixth register, initialize the sixth register to the standard covariance quantum state, and perform a matrix indexation operation on the standard covariance quantum state.
[0121] In some embodiments, the initial quantum state of the sixth register is After the above step S243, the standard covariance quantum state Initialized to the preset register of the quantum system, so at this time there is a standard covariance quantum state stored in the quantum system The preset register and initial quantum state are In this case, a matrix exponential operation O is performed on the preset register and the sixth register.
[0122] S32, converting the covariance matrix into the phase of the sixth register, and performing quantum phase estimation on the standard covariance quantum state to obtain a covariance characteristic quantum state.
[0123] In some embodiments, the covariance matrix K is converted to the phase of the sixth register, and the standard covariance quantum state is subjected to quantum phase estimation QPE to obtain the eigenvalue of the covariance matrix K, and the eigenvalue of the covariance matrix K is stored in the sixth register to obtain the covariance characteristic quantum state Specifically ; where j represents the index used to traverse the feature space, represents the eigenvector of the covariance matrix K, represents the eigenvalue of the covariance matrix K, represents the standard covariance quantum state In the feature vector The projection coefficient on .
[0124] S33. In the quantum system, a seventh register is created, and according to the sixth register in the covariance characteristic quantum state, the seventh register is controlled to perform a second quantum controlled rotation operation to obtain a first characteristic quantum state in an entangled state.
[0125] In some embodiments, the initial quantum state of the seventh register is The seventh register is controlled based on the sixth register to perform a second quantum controlled rotation operation CR2 to obtain a first characteristic quantum state in an entangled state, wherein the first characteristic quantum state includes eigenvalue information of a covariance matrix and a standard covariance quantum state.
[0126] S34. Perform an inverse operation on the sixth register based on the first characteristic quantum state in the entangled state, so that the sixth register recovers the initial quantum state to obtain the second characteristic quantum state in the non-entangled state.
[0127] In some embodiments, by performing an inverse quantum phase estimation operation QPE on the sixth register -1 , so that the sixth register is released from the entanglement state, and the sixth register is discarded to obtain the second characteristic quantum state in the non-entangled state Specifically .in, represents a fixed noise variance, c represents a hyperparameter, which enables the quantum system to obtain the quantum state of the second state with a higher probability .
[0128] S35. Measure the seventh register in the second characteristic quantum state to obtain a target quantum state including the covariance matrix and the standard covariance quantum state.
[0129] In some embodiments, the seventh register is measured to obtain the quantum state The state at the time of , we get the eigenvalues of the covariance matrix and the standard covariance quantum state The target quantum state Specifically .
[0130] S4. Performing a quantum exchange test operation on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
[0131] like Figure 4 As shown, Figure 4 Each horizontal line in the equation represents a register, × represents the inner product between two quantum states, and H represents the Hadamard transform.
[0132] Specifically, step S4 includes:
[0133] S41. Determine a first inner product between the target quantum state and the standard covariance quantum state.
[0134] S42: Determine a second inner product between the target quantum state and a label category quantum state preset for the predicted data point.
[0135] In some embodiments, the preset label category of the prediction data point is While obtaining the predicted data points, the preset label category is obtained synchronously and input into the quantum system to obtain the corresponding label category quantum state. .
[0136] In some embodiments, the target quantum state Initialize to the preset register of the quantum system, and generate the standard covariance quantum state alternately by other registers With the label category quantum state , thereby determining the target quantum state based on two registers With the standard covariance quantum state The first inner product between and the target quantum state With the label category quantum state The second inner product between .
[0137] S43. Perform a quantum exchange test operation on the first inner product and the second inner product to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
[0138] In some embodiments, an initial quantum state is created in a quantum system as After the ninth register is subjected to Hadamard transformation H, the first inner product and the second inner product are controlled by the ninth register to perform a quantum exchange test operation, and Hadamard transformation H is performed again after the quantum exchange test operation to obtain the predicted data point The corresponding predicted value is the mean and variance , mean Specifically ,variance Specifically .in, Represents the labeled class quantum state In the feature vector The projection coefficient on .
[0139] In some embodiments, the quantum prediction method based on Gaussian process regression of the present invention is used to predict continuous value targets, and the data distribution probability of the predicted value is determined by the obtained mean and variance. In some embodiments, the training data points may be factors affecting the temperature such as humidity, wind speed and air pressure in a certain area in a historical time period, and the predicted data points may be factors affecting the temperature such as humidity, wind speed and air pressure in a certain area in a future time period. The prediction method based on the present invention can capture the complex relationship and periodic changes of temperature data under different temperature factors, thereby obtaining the mean and variance of the predicted temperature in a certain area in a future time period.
[0140] Please refer to Figure 5 , Embodiment 2 of the present invention is:
[0141] The quantum prediction method based on Gaussian process regression is different from the first embodiment in that it also includes:
[0142] S5. In the quantum system, create an eighth register, and perform Hadamard transformation on the eighth register.
[0143] In some embodiments, the initial quantum state of the eighth register is , perform Hadamard transform H on the eighth register.
[0144] S6. If the quantum state of the eighth register is the first state, return to execute the step of acquiring the training data points and the prediction data points to obtain the target quantum state.
[0145] S7. If the quantum state of the eighth register is the second state, generating the label category quantum state according to the label category of the predicted data point.
[0146] like Figure 5 As shown, Figure 5 H stands for Hadamard transform, U Represents the generation of the target quantum state Operation, U Represents the generation of labeled category quantum states Operation, Indicates a measurement operation.
[0147] In some embodiments, if the quantum state of the eighth register is , then the preset register in the quantum system is controlled to return to execute step S1 to generate the target quantum state , that is, execute U Operation. If the quantum state of the eighth register is , then the preset register in the quantum system is controlled to generate a labeled class quantum state , that is, execute U Operation. At this point, the quantum state of the quantum system can be characterized as .
[0148] S8. Generate a predicted category quantum state according to the target quantum state and the marked category quantum state.
[0149] In some embodiments, the eighth register is subjected to Hadamard transformation H again to obtain the predicted category quantum state: .
[0150] S9. Determine the prediction label category of the prediction data point according to the prediction category quantum state.
[0151] The step S9 comprises:
[0152] S91. Measure the predicted category quantum state to determine the probability that the predicted category quantum state is the first state.
[0153] In some embodiments, the preset register is measured to obtain a first state The probability of ,in, Represents the target quantum state and label class quantum states The inner product of .
[0154] S92: If the probability is greater than a preset probability value, the predicted label category of the predicted data point is set to a positive category.
[0155] S93: If the probability is less than a preset probability value, the predicted label category of the predicted data point is set to a negative category.
[0156] In some embodiments, the preset probability value is 1 / 2. If the probability P is greater than 1 / 2, the predicted label category of the predicted data point is set to the positive category. If the probability P is less than 1 / 2, the predicted label category of the predicted data point is set to the negative category.
[0157] Please refer to Figure 6 , Embodiment 3 of the present invention is:
[0158] The quantum prediction terminal 100 based on Gaussian process regression includes a memory 101, a processor 102, and a computer program stored in the memory 101 and running on the processor 102. When the processor 102 executes the computer program, each step of the quantum prediction method based on Gaussian process regression in the above-mentioned embodiment 1 and embodiment 2 is implemented.
[0159] In summary, the quantum prediction method and terminal based on Gaussian process regression provided by the present invention generate training coherent states corresponding to training data points and predicted coherent states corresponding to predicted data points through quantum coherent coding in the quantum system, and obtain the coherent superposition quantum state and coherent entangled quantum state between the two by operating the register, thereby utilizing quantum superposition and quantum entanglement to realize parallel computing and accelerate the covariance function calculation process of training data points and predicted data points. Then, the covariance information between the training data points and the predicted data points is converted to amplitude through the first quantum controlled rotation operation, so that the standard covariance quantum state can be obtained through quantum amplitude estimation later. At the same time, the standard covariance quantum state is subjected to matrix indexation operation to determine the eigenvalues of the covariance matrix, thereby obtaining a target quantum state containing the eigenvalues of the covariance matrix and the standard covariance quantum state. Finally, the target quantum state is subjected to a quantum exchange test to determine the mean and variance of the predicted value associated with the predicted data point. In addition, the present invention can also accurately obtain the predicted tag category of the predicted data point according to the target quantum state and the tag category quantum state to ensure the prediction effect. Compared with the traditional Gaussian process regression prediction method, the present invention does not need to iteratively train the model through training data points to solve the hyperparameters in the covariance function, but directly determines the covariance vector between the training data points and the prediction data points based on quantum computing. It can accelerate the time efficiency of the Gaussian process regression prediction method in calculating the covariance function, avoid the problem of computing resource consumption, and effectively improve the timeliness of the Gaussian process regression prediction method when facing large-scale data calculations.
[0160] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. Quantum prediction method based on Gaussian process regression, It is characterized in that include: Obtaining training data points and prediction data points, and calculating a covariance matrix between the training data points and the prediction data points; Creating a standard covariance quantum state between the training data point and the prediction data point through quantum coherence encoding, quantum amplitude estimation, and a first quantum controlled rotation operation; Determine a target quantum state including the covariance matrix and the standard covariance quantum state through a matrix indexation operation of quantum principal component analysis and a second quantum controlled rotation operation; Performing a quantum exchange test operation on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point; The step of creating a standard covariance quantum state between the training data point and the prediction data point by quantum coherence encoding, quantum amplitude estimation, and a first quantum controlled rotation operation comprises: In the quantum system, a first register, a second register, a third register, and a fourth register are created respectively; Based on the first register, the second register and the third register, the training data points and the predicted data points are quantum coherently encoded to obtain a coherent entangled quantum state; Performing quantum amplitude estimation on the coherent entangled quantum state according to the fourth register to obtain a coherent inner product quantum state; In the quantum system, a fifth register is created, and the fifth register is controlled according to the fourth register to perform a first quantum controlled rotation operation to obtain a standard covariance quantum state; The step of performing quantum coherent encoding on the training data points and the prediction data points based on the first register, the second register, and the third register to obtain a coherent entangled quantum state includes: Performing Hadamard transformation on the first register and the third register respectively to obtain an index quantum state and a control quantum state; Performing a corresponding type of coherent state unitary operation on the second register according to the index quantum state and the control quantum state to obtain a training coherent state of the training data point and a predicted coherent state of the predicted data point; Generating a coherent superposition quantum state according to the index quantum state, the control quantum state, the training coherent state, and the predicted coherent state; Based on the coherent superposition quantum state, the third register is subjected to the Hadamard transformation again to obtain a coherent entangled quantum state; The step of controlling the fifth register to perform a first quantum controlled rotation operation according to the fourth register to obtain a standard covariance quantum state includes: Controlling the fifth register to perform a first quantum controlled rotation operation according to the fourth register to obtain a first covariance quantum state in an entangled state; Based on the first covariance quantum state in the entangled state, an inverse operation is performed on the second register, the third register, and the fourth register, so that the second register, the third register, and the fourth register restore the initial quantum state to obtain a second covariance quantum state in a non-entangled state; Measuring the fifth register in the second covariance quantum state to obtain a standard covariance quantum state; The matrix indexation operation of quantum principal component analysis and the second quantum controlled rotation operation are used to determine the target quantum state including the covariance matrix and the standard covariance quantum state, including: In the quantum system, creating a sixth register, initializing the sixth register to the standard covariance quantum state, and performing a matrix indexation operation on the standard covariance quantum state; Converting the covariance matrix into the phase of the sixth register, and performing quantum phase estimation on the standard covariance quantum state to obtain a covariance characteristic quantum state; In the quantum system, a seventh register is created, and according to the sixth register in the covariance characteristic quantum state, the seventh register is controlled to perform a second quantum controlled rotation operation to obtain a first characteristic quantum state in an entangled state; Performing an inverse operation on the sixth register based on the first characteristic quantum state in the entangled state, so that the sixth register restores the initial quantum state to obtain a second characteristic quantum state in the non-entangled state; The seventh register in the second characteristic quantum state is measured to obtain a target quantum state including the covariance matrix and the standard covariance quantum state.
2. The method according to claim 1, It is characterized in that The creating of the first register, the second register, the third register and the fourth register respectively comprises: The initial quantum state is created according to the number of training data points: The first register of The initial quantum state is created according to the preset precision of the quantum coherent coding: The second register of Create the initial quantum state as The third register is used to create an initial quantum state according to the preset accuracy of the quantum amplitude estimate. The fourth register of in, is the Dirac symbol, represents the jth register, Indicates that there are n quantum bits in the register, Indicates that the decimal n is rounded up. M represents the number of training data points, l represents the preset precision of quantum coherent coding, s Indicates the preset precision of the quantum amplitude estimate.
3. The method according to claim 1, It is characterized in that The step of performing a quantum exchange test operation on the target quantum state and the standard covariance quantum state to obtain a mean and a variance of a predicted value corresponding to the predicted data point comprises: Determining a first inner product between the target quantum state and the standard covariance quantum state; Determine a second inner product between the target quantum state and a label category quantum state preset for the predicted data point; A quantum exchange test operation is performed on the first inner product and the second inner product to obtain a mean and a variance of a predicted value corresponding to the predicted data point.
4. The method according to claim 3, It is characterized in that Also includes: In the quantum system, an eighth register is created, and a Hadamard transformation is performed on the eighth register; If the quantum state of the eighth register is the first state, returning to execute the step of acquiring the training data points and the prediction data points to obtain the target quantum state; If the quantum state of the eighth register is the second state, generating the label category quantum state according to the label category of the predicted data point; Generate a predicted category quantum state according to the target quantum state and the labeled category quantum state; A predicted label category of the predicted data point is determined according to the predicted category quantum state.
5. The method according to claim 4, It is characterized in that Determining the prediction label category of the prediction data point according to the prediction category quantum state includes: Measuring the predicted category quantum state to determine the probability that the predicted category quantum state is the first state; If the probability is greater than a preset probability value, setting the predicted label category of the predicted data point to a positive category; If the probability is less than a preset probability value, the predicted label category of the predicted data point is set to a negative class.
6. A quantum prediction terminal based on Gaussian process regression, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, It is characterized in that When the processor executes the computer program, the various steps of the quantum prediction method based on Gaussian process regression as described in any one of claims 1 to 5 are implemented.
