CN115618232A - Data prediction method, device, storage medium and electronic equipment - Google Patents

Data prediction method, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115618232A
CN115618232A CN202211364330.XA CN202211364330A CN115618232A CN 115618232 A CN115618232 A CN 115618232A CN 202211364330 A CN202211364330 A CN 202211364330A CN 115618232 A CN115618232 A CN 115618232A
Authority
CN
China
Prior art keywords
quantum
training
regression model
predicted value
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211364330.XA
Other languages
Chinese (zh)
Inventor
孙祺淳
李小刚
徐华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Yiwei Quantum Technology Co ltd
Original Assignee
Hefei Yiwei Quantum Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Yiwei Quantum Technology Co ltd filed Critical Hefei Yiwei Quantum Technology Co ltd
Priority to CN202211364330.XA priority Critical patent/CN115618232A/en
Publication of CN115618232A publication Critical patent/CN115618232A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/60Quantum algorithms, e.g. based on quantum optimisation, quantum Fourier or Hadamard transforms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application discloses a data prediction method, a data prediction device, a storage medium and electronic equipment. The method comprises the following steps: the method comprises the steps of obtaining a sample set, carrying out normalization processing on sample labels in the sample set, extracting a training set and a test set from the sample set, training a quantum variational regression model based on the training set, inputting the test set into the trained quantum variational regression model to output a predicted value, and calculating a real predicted value according to the predicted value and the sample labels after the normalization processing. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.

Description

Data prediction method, device, storage medium and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data prediction method, an apparatus, a storage medium, and an electronic device.
Background
The regression task is an important component in the field of artificial intelligence, and the regression model plays an important role in various actual scenes. Regression models are predictive modeling techniques that study the relationship between dependent variables (targets) and independent variables (predictors). This technique is commonly used for predictive analysis, time series modeling, and discovery of causal relationships between variables.
The applicant finds that the existing classical machine learning algorithm has certain limitation on prediction accuracy, and particularly, the operation performance of the existing classical machine learning algorithm gradually reaches a bottleneck under a big data background. Although the quantum computing method has significant advantages over the classical computing method, many classical quantum algorithms have large errors or even cannot be implemented in the existing quantum computer at all due to the fact that many used qubits and quantum logic gates are provided from the current quantum computer hardware with medium qubit scale and noise, and thus the quantum algorithms have a large blank in the application of regression tasks.
Disclosure of Invention
The embodiment of the application provides a data prediction method, a data prediction device, a storage medium and an electronic device, which can improve the calculation precision of a regression task by using a quantum algorithm, so that the prediction precision of a regression model is improved.
The embodiment of the application provides a data prediction method, which comprises the following steps:
acquiring a sample set, and carrying out normalization processing on sample labels in the sample set;
extracting a training set and a test set from a sample set, and training a quantum variation regression model based on the training set;
inputting the test set into a trained quantum variational regression model to output a predicted value;
and calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
In one embodiment, the step of training the quantum variation regression model based on the training set comprises:
two quantum bits are created on a quantum register and are juxtaposed to be 0, then a training data characteristic value is converted into a probability amplitude value of a quantum superposition state through a classical-quantum conversion circuit, and the processing formula is as follows:
Figure BDA0003923279560000021
Figure BDA0003923279560000022
Figure BDA0003923279560000023
where α 1, α 2 and α 3 are the phase angles of the Ry logic gates, and a, b, c and d are the input classical data and real numbers.
In an embodiment, the method further comprises:
the quantum superposition state obtained by the classical-quantum conversion circuit is processed by a quantum prior circuit, and the processing formula is as follows:
Figure BDA0003923279560000024
wherein:
Figure BDA0003923279560000025
in an embodiment, the method further comprises:
combining the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model;
adjusting a parameter theta in the quantum prior circuit through a gradient descent algorithm, and calculating a minimum value of a loss function to complete the training of the quantum variation regression model, wherein a calculation formula of the loss function is as follows:
Figure BDA0003923279560000026
where n denotes the total number of input data, y true * Normalized value, y, representing true value pred And representing the predicted value output by the quantum variation regression model circuit.
In one embodiment, the step of inputting the test set into a trained quantum variational regression model to output a predicted value includes:
and extracting the characteristic value of the test data in the test set, and inputting the characteristic value into the trained quantum variational regression model to output a normalized predicted value.
In an embodiment, the step of calculating a true predicted value according to the predicted value and the normalized sample label includes:
performing reverse normalization on the normalized predicted value based on the sample label after the normalization processing to obtain a real predicted value, wherein a calculation formula is as follows:
y pred =norm*y pred *
wherein y is pred For true predictive value, y pred * Is a normalized predicted value.
An embodiment of the present application further provides a data prediction apparatus, including:
the acquisition module is used for acquiring a sample set and normalizing sample labels in the sample set;
the training module is used for extracting a training set and a test set from a sample set and training a quantum variation regression model based on the training set;
the processing module is used for inputting the test set into the trained quantum variation regression model so as to output a predicted value;
and the calculation module is used for calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
In one embodiment, the training module comprises:
the first processing submodule is used for creating two quantum bits on the quantum register and processing input data through 4 quantum logic gates to construct a quantum prior circuit;
the second processing submodule is used for extracting the training data characteristic value in the training set and converting the training data characteristic value into the probability amplitude value of a quantum superposition state through a classical-quantum conversion circuit;
and the training submodule is used for combining the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model, adjusting parameters in the quantum prior circuit through a gradient descent algorithm, and calculating the minimum value of a loss function to finish the training of the quantum variation regression model.
The present embodiment also provides a storage medium, where the storage medium stores a computer program, where the computer program is suitable for being loaded by a processor to perform the steps in the data prediction method according to any one of the above embodiments.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory stores a computer program, and the processor executes the steps in the data prediction method according to any of the above embodiments by calling the computer program stored in the memory.
The data prediction method, the data prediction device, the storage medium and the electronic equipment can obtain a sample set, normalize the sample labels in the sample set, extract a training set and a test set from the sample set, train a quantum variation regression model based on the training set, input the test set into the trained quantum variation regression model to output a predicted value, and calculate a real predicted value according to the predicted value and the sample labels after normalization processing. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a data prediction method according to an embodiment of the present disclosure.
Fig. 2 is another schematic flow chart of a data prediction method according to an embodiment of the present disclosure.
Fig. 3 is a schematic diagram of a classical-quantum conversion circuit according to an embodiment of the present application.
Fig. 4 is a schematic diagram of a quantum prior circuit provided in an embodiment of the present application.
Fig. 5 is a schematic circuit diagram of a quantum variation regressor according to an embodiment of the present disclosure.
Fig. 6 is a graph illustrating a loss function curve according to an embodiment of the present application.
Fig. 7 is a schematic diagram illustrating comparison between a predicted value and an actual value provided in an embodiment of the present application.
Fig. 8 is a schematic structural diagram of a data prediction apparatus according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of another data prediction apparatus according to an embodiment of the present disclosure.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a data prediction method, a data prediction device, a storage medium and electronic equipment. Specifically, the data prediction method of the embodiment of the present application may be executed by an electronic device, where the electronic device may be a terminal. The terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game console, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like, and the terminal may further include a client, which may be a media playing client or an instant messaging client, and the like.
Referring to fig. 1, the specific process of the method may be as follows:
step 101, a sample set is obtained, and sample labels in the sample set are normalized.
In an embodiment, the sample set may be P, where the sample set P may include a feature P feature And a label Ptrue . Specifically, in the gradient descent-based algorithm, the feature normalization method is used to unify the dimensions of the features, so that the convergence rate of the model and the final model precision can be improved, and therefore, the label P can be further labeled true And (6) carrying out normalization processing.
Wherein, for the above-mentioned label P true The formula for normalization is:
Figure BDA0003923279560000051
wherein, y ture Representing true values, based on which P is noted true The normalized value of (d) may be:
Figure BDA0003923279560000052
and 102, extracting a training set and a test set from the sample set, and training the quantum variation regression model based on the training set.
In an embodiment, the training set and the test set may be extracted according to a preset proportion of the sample set, for example, the sample set is divided into 70% of the training set and 30% of the test set, and the training set may be P train Expressed as P, the test set may be represented by test Specifically, the training set P can be used train Training the quantum variation regression model, and using a training set P after the training is finished test The trained model is processedAnd (6) testing.
In one embodiment, the training set P is train Can be expressed as: p train =[P trainX ,P trainY ];
Test set P test Can be expressed as: p is test =[P testX ,P testY ]。
Wherein, P trainX Representing a characteristic value, P, of the training data trainY Labels representing training data, P testX Representing a characteristic value, P, of the test data testY Labels representing training data.
Further, the training data feature value P may be transformed using classical-quantum conversion circuitry trainX The sample in the method is converted into the probability amplitude of a quantum superposition state, then a loss function of a quantum variation regression model is constructed, and parameters in a prior quantum prior circuit in the quantum variation regression model are continuously adjusted based on a gradient descent algorithm, so that the loss function is minimum. And storing the corresponding parameter when the loss function is minimum, thereby finishing the training of the quantum variation regression model. Among them, the Gradient descent method (Gradient device) is a first-order optimization algorithm. To find the local minimum of a function using the gradient descent method, an iterative search must be performed to a distance point of a predetermined step size corresponding to the opposite direction of the gradient (or approximate gradient) on the function from the current point.
And 103, inputting the test set into the trained quantum variational regression model to output a predicted value.
And 104, calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
In one embodiment, the test data characteristic value P may be testX Inputting the data into a trained quantum variational regression model to obtain a normalized predicted value, and then performing inverse normalization on the normalized predicted value to obtain a real predicted value, wherein a mathematical formula is as follows:
y pred =norm*y pred *
wherein y is pred Is a true predictor, y pred* For normalizing the predicted values, thereby completing regression predictionAnd (5) testing the task.
As can be seen from the above, the data prediction method provided in the embodiment of the present application may obtain a sample set, perform normalization processing on sample labels in the sample set, extract a training set and a test set from the sample set, train a quantum variation regression model based on the training set, input the test set into the trained quantum variation regression model to output a predicted value, and calculate a true predicted value according to the predicted value and the sample labels after the normalization processing. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.
Please refer to fig. 2, which is a schematic flowchart of a data prediction method according to an embodiment of the present disclosure. The specific process of the method can be as follows:
step 201, a sample set is obtained, and normalization processing is performed on sample labels in the sample set.
The normalization processing of the sample set may refer to the above processing procedure, which is not further described in this application.
Step 202, extracting a training set and a test set from the sample set, creating two quantum bits on the quantum register, juxtaposing to 0, extracting a training data characteristic value in the training set, and converting the training data characteristic value into a probability amplitude value in a quantum superposition state through a classical-quantum conversion circuit.
In an embodiment, the sample set may be divided into a training set of 70% and a testing set of 30%, and the present application further provides a classical-quantum conversion circuit, please refer to fig. 3, where fig. 3 is a schematic diagram of the classical-quantum conversion circuit provided in the embodiment of the present application, specifically, two qubits may be created on a quantum register, and the qubits are collocated to be 0, and then a training data feature value is converted into a probability amplitude value in a quantum superposition state by the classical-quantum conversion circuit. Wherein, the output of the classical-quantum conversion circuit is:
Figure BDA0003923279560000071
where α 1, α 2 and α 3 are the phase angles of the Ry logic gates, and a, b, c and d are the input classical data and real numbers. Calculated by the formula:
Figure BDA0003923279560000072
Figure BDA0003923279560000073
Figure BDA0003923279560000074
and step 203, processing the quantum superposition state obtained in the step 202 by using a quantum prior circuit. As shown in fig. 4, the calculation formula of the quantum prior circuit is:
Figure BDA0003923279560000075
wherein:
Figure BDA0003923279560000076
and 204, combining the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model.
The embodiment of the application further provides a loss function for calculating the quantum variation regressor, and the mathematical expression is as follows:
Figure BDA0003923279560000077
wherein n represents the total number of input data; y is true* Normalized value, y, representing true value pred Is a real prediction value. Normalized value y of the true value true* Meter (2)The calculation formula is as follows:
Figure BDA0003923279560000081
wherein, y pred The circuit represents the total circuit of the combination of the classical-quantum conversion circuit and the quantum prior circuit, namely the predicted value output by the quantum variation regressor circuit, and is shown in fig. 5.
And step 205, adjusting a parameter theta in the quantum prior circuit through a gradient descent algorithm, and calculating the minimum value of a loss function to complete the training of the quantum variation regression model.
In an embodiment, a gradient descent algorithm is used for adjusting theta 1, theta 2, theta 3 and theta 4 in the prior quantum prior circuit, so that a Loss function Loss in the third technical scheme is minimum, and training of the quantum variation regression circuit is completed.
And step 206, extracting characteristic values of the test data in the test set, and inputting the characteristic values into the trained quantum variational regression model to output a normalized predicted value.
And step 207, performing inverse normalization on the normalized predicted value based on the sample label after the normalization processing to obtain a real predicted value.
In one embodiment, the characteristic P of the test data is testX And inputting the data into a trained quantum variation regression circuit to obtain a normalized predicted value. And then carrying out reverse normalization on the prediction data to obtain a real prediction value, wherein the calculation formula is as follows:
y pred =norm*y pred *
wherein y is pred For true predictive value, y pred * Is a normalized predicted value.
For example, the public data set Real estimate evaluation dataset is taken as an example for explanation. The data set is recorded as P, and the influence of four factors, namely house age, distance between a house and a subway, the number of peripheral convenience stores and longitude and latitude, on the room price is counted in the data. The invention trains a prediction model by using a quantum variation regressor and then takes the house age and the house off the subwayThe four characteristics of the distance, the number of the peripheral convenience stores and the longitude and latitude are input into a trained quantum variation regressor model to obtain the predicted house selling price, and then the predicted house selling price is compared with the actual selling price to reflect the effectiveness of the invention. First obtaining a feature P of the data feature With a label P of data true . To P true And (3) carrying out normalization:
Figure BDA0003923279560000082
divide P into 70% training data P train And 30% of test data P test . Using P train The quantum variational regressor is trained, and parameters in the quantum prior circuit are adjusted by using gradient descent, so that the loss function value is continuously reduced, and the obtained loss function curve is shown in fig. 6.
Test data P test The characteristics of the data are input into a trained quantum variation regressor to obtain a normalized value of the predicted value, and then the normalized value is subjected to inverse normalization to obtain a real predicted value. The actual predicted value obtained by the quantum variation regressor is compared with the actual house selling price, as shown in fig. 7, the R2 score obtained by calculation in the graph is 0.887, which shows that the quantum variation linear regressor provided by the invention is feasible and obtains higher prediction precision.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
As can be seen from the above, the data prediction method provided in this embodiment of the application may obtain a sample set, perform normalization processing on sample labels in the sample set, extract a training set and a test set from the sample set, create two 0-state quantum bits on a quantum register, convert a training data feature value into a probability amplitude value of a quantum superposition state through a classical-quantum conversion circuit, process the obtained quantum superposition state through a quantum prior circuit, combine the classical-quantum conversion circuit and the quantum prior circuit to obtain a quantum variational regressor model, adjust a parameter θ in the quantum prior circuit through a gradient descent algorithm, calculate a minimum value of a loss function to complete training of the quantum variational regression model, extract a test data feature value in the test set, input the test data feature value into the trained quantum variational regression model to output a normalized predicted value, and perform inverse normalization on the normalized predicted value based on the sample labels after the normalization processing to obtain a true predicted value. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.
In order to better implement the data prediction method of the embodiment of the present application, the embodiment of the present application further provides a data prediction apparatus. Referring to fig. 8, fig. 8 is a schematic structural diagram of a data prediction apparatus according to an embodiment of the present disclosure. The data prediction apparatus may include:
an obtaining module 301, configured to obtain a sample set, and perform normalization processing on sample labels in the sample set;
a training module 302, configured to extract a training set and a test set from a sample set, and train a quantum variation regression model based on the training set;
the processing module 303 is configured to input the test set into the trained quantum variational regression model to output a predicted value;
and a calculating module 304, configured to calculate a true predicted value according to the predicted value and the sample label after the normalization processing.
In an embodiment, please further refer to fig. 9, and fig. 9 is a schematic structural diagram of a data prediction apparatus according to an embodiment of the present disclosure. Wherein the training module 302 comprises:
a first processing submodule 3021, configured to create two qubits in a quantum register, and process input data through 4 quantum logic gates to construct a quantum prior circuit;
the second processing submodule 3022 is configured to extract a training data feature value in the training set, and convert the training data feature value into a probability amplitude value in a quantum superposition state by using a classical-quantum conversion circuit;
a training submodule 3023, configured to combine the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model, adjust parameters in the quantum prior circuit through a gradient descent algorithm, and calculate a minimum value of a loss function, so as to complete training of the quantum variation regression model.
In an embodiment, the processing module 303 is specifically configured to extract feature values of the test data in the test set, and input the feature values into a trained quantum variational regression model to output a normalized predicted value.
In an embodiment, the calculating module 304 is specifically configured to perform inverse normalization on the normalized predicted value based on the sample label after the normalization processing, so as to obtain a true predicted value.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
As can be seen from the above, in the data prediction apparatus provided in this embodiment of the application, the obtaining module 301 obtains a sample set, and normalizes the sample labels in the sample set, the training module 302 extracts a training set and a test set from the sample set, trains the quantum variational regression model based on the training set, the processing module 303 inputs the test set into the trained quantum variational regression model to output a predicted value, and the calculating module 304 calculates a true predicted value according to the predicted value and the sample labels after the normalization processing. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.
Correspondingly, the embodiment of the present application further provides an electronic device, where the electronic device may be a terminal or a server, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 10, fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more storage media, and a computer program stored on the memory 402 and operable on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the electronic device configurations shown in the figures do not constitute limitations of the electronic device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The processor 401 is a control center of the electronic device 400, connects various parts of the whole electronic device 400 by using various interfaces and lines, performs various functions of the electronic device 400 and processes data by running or loading software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby performing overall monitoring of the electronic device 400.
In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 runs the application programs stored in the memory 402, so as to implement various functions:
acquiring a sample set, and carrying out normalization processing on sample labels in the sample set;
extracting a training set and a test set from a sample set, and training a quantum variation regression model based on the training set;
inputting the test set into a trained quantum variational regression model to output a predicted value;
and calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 10, the electronic device 400 further includes: a touch display 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch display 403, the rf circuit 404, the audio circuit 405, the input unit 406, and the power source 407 respectively. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 10 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The touch display screen 403 may be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. Among other things, the display panel may be used to display information input by or provided to a user as well as various graphical user interfaces of the electronic device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 401, and can receive and execute commands sent by the processor 401. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel may transmit the touch operation to the processor 401 to determine the type of the touch event, and then the processor 401 may provide a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 403 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 403 may also be used as a part of the input unit 406 to implement an input function.
In the embodiment of the present application, an application program is executed by the processor 401 to generate a graphical user interface on the touch display screen 403. The touch display screen 403 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The rf circuit 404 may be configured to transmit and receive rf signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals with the network device or other electronic devices.
The audio circuit 405 may be used to provide an audio interface between the user and the electronic device through a speaker, microphone. The audio circuit 405 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, which is then processed by the audio data output processor 401 and then transmitted to, for example, another electronic device via the rf circuit 404, or the audio data is output to the memory 402 for further processing. The audio circuit 405 may also include an earbud jack to provide communication of a peripheral headset with the electronic device.
The input unit 406 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 407 is used to power the various components of the electronic device 400. Optionally, the power source 407 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 407 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, or any other component.
Although not shown in fig. 10, the electronic device 400 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
As can be seen from the above, the electronic device provided in this embodiment may obtain a sample set, perform normalization processing on sample labels in the sample set, extract a training set and a test set from the sample set, train a quantum variational regression model based on the training set, input the test set into the trained quantum variational regression model to output a predicted value, and calculate a true predicted value according to the predicted value and the sample labels after the normalization processing. According to the embodiment of the application, the calculation precision of the regression task can be improved by using the quantum algorithm, the blank of the quantum algorithm in the machine learning regression task is filled, and the prediction precision of the regression model is improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a storage medium and loaded and executed by a processor.
To this end, the present application provides a storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute the steps in any one of the data prediction methods provided in the present application. For example, the computer program may perform the steps of:
acquiring a sample set, and carrying out normalization processing on sample labels in the sample set;
extracting a training set and a test set from a sample set, and training a quantum variation regression model based on the training set;
inputting the test set into a trained quantum variational regression model to output a predicted value;
and calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium can execute the steps in any data prediction method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data prediction method provided in the embodiments of the present application can be achieved, and detailed descriptions are omitted here for the foregoing embodiments.
The data prediction method, the data prediction device, the storage medium, and the electronic device provided in the embodiments of the present application are described in detail above, and specific examples are applied herein to explain the principles and embodiments of the present application, and the description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of data prediction, comprising:
acquiring a sample set, and carrying out normalization processing on sample labels in the sample set;
extracting a training set and a test set from the sample set, and training a quantum variation regression model based on the training set;
inputting the test set into a trained quantum variational regression model to output a predicted value;
and calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
2. The data prediction method of claim 1, wherein the step of training a quantum variational regression model based on the training set comprises:
two quantum bits are created on a quantum register and are juxtaposed to be 0, then a training data characteristic value is converted into a probability amplitude value of a quantum superposition state through a classical-quantum conversion circuit, and the processing formula is as follows:
Figure FDA0003923279550000011
Figure FDA0003923279550000012
Figure FDA0003923279550000013
where α 1, α 2 and α 3 are the phase angles of the Ry logic gates, and a, b, c and d are the input classical data and real numbers.
3. The data prediction method of claim 2, wherein the method further comprises:
the quantum superposition state obtained in the claim 2 is processed by a quantum prior circuit, and the processing formula is as follows:
Figure FDA0003923279550000014
wherein:
Figure FDA0003923279550000015
4. the data prediction method of claim 3, wherein the method further comprises:
combining the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model;
adjusting a parameter theta in the quantum prior circuit through a gradient descent algorithm, and calculating a minimum value of a loss function to complete the training of the quantum variation regression model, wherein a calculation formula of the loss function is as follows:
Figure FDA0003923279550000021
where n is the total number of input data, y true * Normalized to the true value, y pred The predicted value is output by the quantum variation regression model circuit.
5. The data prediction method of claim 1, wherein the step of inputting the test set into a trained quantum variational regression model to output a predicted value comprises:
and extracting the characteristic value of the test data in the test set, and inputting the characteristic value into the trained quantum variational regression model to output a normalized predicted value.
6. The data prediction method of claim 5, wherein the step of calculating a true prediction value based on the prediction value and the normalized sample label comprises:
performing inverse normalization on the normalized predicted value based on the sample label after the normalization processing to obtain a real predicted value, wherein a calculation formula is as follows:
y pred =norm*y pred *
wherein, y pred For true predictive value, y pred * Is a normalized predicted value.
7. A data prediction apparatus, comprising:
the acquisition module is used for acquiring a sample set and normalizing sample labels in the sample set;
the training module is used for extracting a training set and a testing set from the sample set and training a quantum variational regression model based on the training set;
the processing module is used for inputting the test set into the trained quantum variational regression model so as to output a predicted value;
and the calculation module is used for calculating a real predicted value according to the predicted value and the sample label after the normalization processing.
8. The data prediction apparatus of claim 7, wherein the training module comprises:
the first processing submodule is used for creating two quantum bits on the quantum register and processing input data through 4 quantum logic gates to construct a quantum prior circuit;
the second processing submodule is used for extracting the training data characteristic value in the training set and converting the training data characteristic value into the probability amplitude value of a quantum superposition state through a classical-quantum conversion circuit;
and the training submodule is used for combining the classical-quantum conversion circuit with the quantum prior circuit to obtain a quantum variation regression model, adjusting parameters in the quantum prior circuit through a gradient descent algorithm, and calculating the minimum value of a loss function to finish the training of the quantum variation regression model.
9. A storage medium storing a computer program adapted to be loaded by a processor for performing the steps of the data prediction method according to any one of claims 1-6.
10. An electronic device, characterized in that the electronic device comprises a memory in which a computer program is stored and a processor which performs the steps in the data prediction method according to any one of claims 1-6 by calling the computer program stored in the memory.
CN202211364330.XA 2022-11-02 2022-11-02 Data prediction method, device, storage medium and electronic equipment Pending CN115618232A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211364330.XA CN115618232A (en) 2022-11-02 2022-11-02 Data prediction method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211364330.XA CN115618232A (en) 2022-11-02 2022-11-02 Data prediction method, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115618232A true CN115618232A (en) 2023-01-17

Family

ID=84877226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211364330.XA Pending CN115618232A (en) 2022-11-02 2022-11-02 Data prediction method, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115618232A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117268252A (en) * 2023-11-23 2023-12-22 中控技术股份有限公司 Electrode embedding depth prediction method and device, storage medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117268252A (en) * 2023-11-23 2023-12-22 中控技术股份有限公司 Electrode embedding depth prediction method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
WO2021135577A9 (en) Audio signal processing method and apparatus, electronic device, and storage medium
US20200143231A1 (en) Probabilistic neural network architecture generation
WO2019062413A1 (en) Method and apparatus for managing and controlling application program, storage medium, and electronic device
CN112329740B (en) Image processing method, image processing apparatus, storage medium, and electronic device
CN110222649B (en) Video classification method and device, electronic equipment and storage medium
US10540977B2 (en) Proximity-based engagement with digital assistants
US20200218456A1 (en) Application Management Method, Storage Medium, and Electronic Apparatus
US20200057937A1 (en) Electronic apparatus and controlling method thereof
WO2019085749A1 (en) Application program control method and apparatus, medium, and electronic device
WO2019062317A1 (en) Application program control method and electronic device
CN110223687A (en) Instruction executing method, device, storage medium and electronic equipment
CN115083434A (en) Emotion recognition method and device, computer equipment and storage medium
CN113344184A (en) User portrait prediction method, device, terminal and computer readable storage medium
CN113807515A (en) Model training method and device, computer equipment and storage medium
CN112206541A (en) Game plug-in identification method and device, storage medium and computer equipment
CN115618232A (en) Data prediction method, device, storage medium and electronic equipment
CN116523064A (en) Quantum genetic algorithm-based searching method and device, storage medium and electronic equipment
CN115393251A (en) Defect detection method and device for printed circuit board, storage medium and electronic equipment
CN107729144B (en) Application control method and device, storage medium and electronic equipment
WO2023246558A1 (en) Semantic understanding method and apparatus, and medium and device
CN112508116A (en) Classifier generation method and device, storage medium and electronic equipment
KR102533084B1 (en) Apparatus and method for processing imbalance data
CN115171222A (en) Behavior detection method and device, computer equipment and storage medium
CN117056648A (en) Data classification method and device, storage medium and electronic equipment
CN114511779B (en) Training method of scene graph generation model, scene graph generation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination