CN116400430A - Meteorological data prediction method and device, storage medium and electronic device - Google Patents

Meteorological data prediction method and device, storage medium and electronic device Download PDF

Info

Publication number
CN116400430A
CN116400430A CN202310296539.5A CN202310296539A CN116400430A CN 116400430 A CN116400430 A CN 116400430A CN 202310296539 A CN202310296539 A CN 202310296539A CN 116400430 A CN116400430 A CN 116400430A
Authority
CN
China
Prior art keywords
quantum
moment
weather data
convolution
predicted
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.)
Granted
Application number
CN202310296539.5A
Other languages
Chinese (zh)
Other versions
CN116400430B (en
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.)
Benyuan Quantum Computing Technology Hefei Co ltd
Original Assignee
Benyuan Quantum Computing Technology Hefei 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 Benyuan Quantum Computing Technology Hefei Co ltd filed Critical Benyuan Quantum Computing Technology Hefei Co ltd
Priority to CN202310296539.5A priority Critical patent/CN116400430B/en
Publication of CN116400430A publication Critical patent/CN116400430A/en
Application granted granted Critical
Publication of CN116400430B publication Critical patent/CN116400430B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01WMETEOROLOGY
    • G01W1/00Meteorology
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01WMETEOROLOGY
    • G01W1/00Meteorology
    • G01W1/02Instruments for indicating weather conditions by measuring two or more variables, e.g. humidity, pressure, temperature, cloud cover or wind speed
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01WMETEOROLOGY
    • G01W1/00Meteorology
    • G01W1/10Devices for predicting weather conditions
    • 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/20Models of quantum computing, e.g. quantum circuits or universal quantum computers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • G06N3/0442Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/10Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Molecular Biology (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Atmospheric Sciences (AREA)
  • Environmental Sciences (AREA)
  • Ecology (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a meteorological data prediction method, a device, a storage medium and an electronic device, and relates to the technical field of quantum computing, wherein the method comprises the following steps: acquiring weather data graphs of a plurality of moments before a moment to be predicted, wherein the weather data graph of each moment comprises weather data of all subareas in a region to be predicted; carrying out attention operation on the meteorological data graph at each moment in sequence based on a quantum attention network to obtain a characteristic graph of the meteorological data graph at each moment; and sequentially inputting the feature images of the meteorological data images at each moment into a convolution long-short time memory network ConvLSTM to obtain a predicted meteorological data image at the moment to be predicted. Short-term weather prediction can be achieved.

Description

Meteorological data prediction method and device, storage medium and electronic device
Technical Field
The application belongs to the technical field of quantum computing, and particularly relates to a meteorological data prediction method, a device, a storage medium and an electronic device.
Background
The quantum computer is a kind of physical device which performs high-speed mathematical and logical operation, stores and processes quantum information according to the law of quantum mechanics. When a device processes and calculates quantum information and operates on a quantum algorithm, the device is a quantum computer. Quantum computers are a key technology under investigation because of their ability to handle mathematical problems more efficiently than ordinary computers, for example, to accelerate the time to crack RSA keys from hundreds of years to hours.
Weather prediction can guide daily production and life of human beings, and avoid loss caused by extreme weather, such as daily activities in basic fields of agriculture, transportation, international business and the like. It can be seen that the rapid and accurate weather prediction has important significance.
Traditional weather forecast methods rely on priors such as thermodynamic properties of the atmosphere, statistical distribution of data, and ensemble learning involving multiple models with different initial conditions. The model belongs to a numerical weather forecast method, the complexity of weather data is high, even if the weather data depends on the processing capacity of a super computer, the prediction result can be provided in a plurality of hours, and under the environment of rapid weather change, the traditional weather forecast method can not realize short-time weather prediction.
Disclosure of Invention
The purpose of the application is to provide a meteorological data prediction method, a device, a storage medium and an electronic device, and aims to realize short-time meteorological data prediction.
To achieve the above object, according to a first aspect of embodiments of the present application, there is provided a weather data prediction method, including:
acquiring weather data graphs of a plurality of moments before a moment to be predicted, wherein the weather data graph of each moment comprises weather data of all subareas in a region to be predicted;
carrying out attention operation on the meteorological data graph at each moment in sequence based on a quantum attention network to obtain a characteristic graph of the meteorological data graph at each moment;
and sequentially inputting the feature images of the meteorological data images at each moment into a convolution long-short time memory network ConvLSTM to obtain a predicted meteorological data image at the moment to be predicted.
Optionally, the quantum convolution attention network includes a first quantum convolution line for performing quantum convolution on a hidden state of ConvLSTM at a previous time at a current time, a second quantum convolution line for performing quantum convolution on a meteorological data graph at the current time, and a third quantum convolution line for performing quantum convolution on a result obtained by splicing and activating quantum convolution results of the first quantum convolution line and the second quantum convolution line.
Optionally, the quantum attention network performs attention operation on the weather data graph at each moment specifically through the following formula to obtain a feature graph of the weather data graph at each moment:
Figure BDA0004143340990000021
Figure BDA0004143340990000022
Figure BDA0004143340990000023
wherein W is E For the weight matrix of the first quantum convolution circuit, U E For the weight matrix of the second quantum convolution circuit, V E For the weight matrix of the third quantum convolution circuit,
Figure BDA0004143340990000031
is a hidden state at the time t-1, E i For the convolution result of the third quantum convolution circuit,m and N are spatial dimensions, k and l are sum coefficients, tanh () is an activation function, +.>
Figure BDA0004143340990000032
For attention coefficient, +.>
Figure BDA0004143340990000033
Representing the Hadamard product, A is the attention matrix, X t For the weather data diagram at time t +.>
Figure BDA0004143340990000034
And the characteristic diagram is a weather data diagram at the time t.
Optionally, the second quantum convolution circuit comprises a coding layer, a parameter-containing layer and a measuring layer;
the encoding layer is used for encoding each meteorological data graph to a preset number of quantum bits;
the parameter-containing layering is used for carrying out quantum state evolution on the coded quantum bits;
the measuring layer is used for carrying out quantum state measurement on the evolved quantum bit, calculating an expected value and obtaining a quantum convolution result of each meteorological data graph.
Optionally, the coding layer includes RY gates, and the parameter-containing layer includes a first RZ gate, a CNOT gate, and a second RZ gate.
Optionally, the structures of the first quantum convolution circuit, the second quantum convolution circuit, and the third quantum convolution circuit are the same.
Optionally, the weather data in the weather data map at each moment is normalized by the following formula:
Figure BDA0004143340990000035
X k ={X 1 k ,...,X T k };k∈1,....,d;T=T in +T out
wherein X is k Representing meteorological numbersAccording to meteorological data of the kth sub-area in the graph, d represents the space dimension of the area to be predicted, T represents a plurality of moments before the moment to be predicted, T in Representing an input time window, T out Representing an output time window.
In a second aspect of embodiments of the present application, there is provided a weather data prediction apparatus, the apparatus including:
the acquisition module is used for acquiring weather data graphs of a plurality of moments before the moment to be predicted, wherein the weather data graph of each moment comprises weather data of all subareas in the area to be predicted;
the attention module is used for carrying out attention operation on the weather data graph at each moment in sequence based on the quantum attention network to obtain a characteristic graph of the weather data graph at each moment;
the prediction module is used for sequentially inputting the feature images of the weather data images at each moment into the convolution long-short time memory network ConvLSTM to obtain a predicted weather data image at the moment to be predicted.
In a third aspect of embodiments of the present application, there is provided a storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of the method of any of the first aspects described above when run.
In a fourth aspect of embodiments of the present application, there is provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of the method according to any of the first aspects above.
According to the technical scheme, the weather data graphs at a plurality of moments before the moment to be predicted are obtained, quantum attention operation is carried out on the weather data graphs at each moment based on the quantum attention network, the characteristic graph of each weather data graph is obtained, the characteristic graph of the weather data graph at each moment is sequentially input into the convolution long-short time memory network ConvLSTM, the predicted weather data graph at the moment to be predicted is obtained, the quantum attention network can effectively reduce the number of model parameters, reduce the complexity of calculation and speed up calculation, in addition, the quantum parallel calculation can also speed up the processing speed of the weather data graph, improve the weather prediction speed and realize short-time weather prediction.
Drawings
FIG. 1 is a block diagram of the hardware architecture of a computer terminal showing a method of weather data prediction according to an exemplary embodiment;
FIG. 2 is a flowchart illustrating a method of weather data prediction, according to an example embodiment;
FIG. 3 is a schematic diagram of a quantum attention network and ConvLSTM predicted meteorological data, shown in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram of a quantum dot attention net shown according to an exemplary embodiment;
FIG. 5 is a schematic diagram of a second quantum convolution circuit shown according to an example embodiment;
FIG. 6 is a block diagram illustrating a weather data prediction device, according to an example embodiment.
Detailed Description
The embodiments described below by referring to the drawings are exemplary only for the purpose of illustrating the present application and are not to be construed as limiting the present application.
The embodiment of the application firstly provides a weather data prediction method which can be applied to electronic equipment such as a computer terminal, in particular to a common computer, a quantum computer and the like.
The following describes the operation of the computer terminal in detail by taking it as an example. FIG. 1 is a block diagram of the hardware architecture of a computer terminal showing a method of weather data prediction according to an exemplary embodiment. As shown in fig. 1, the computer terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing quantum-wire-based weather data prediction methods, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the weather data prediction method in the embodiment of the present application, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., implement the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
It should be noted that a real quantum computer is a hybrid structure, which includes two major parts: part of the computers are classical computers and are responsible for performing classical computation and control; the other part is quantum equipment, which is responsible for running quantum programs so as to realize quantum computation. The quantum program is a series of instruction sequences written by a quantum language such as the qlunes language and capable of running on a quantum computer, so that the support of quantum logic gate operation is realized, and finally, quantum computing is realized. Specifically, the quantum program is a series of instruction sequences for operating the quantum logic gate according to a certain time sequence.
In practical applications, quantum computing simulations are often required to verify quantum algorithms, quantum applications, etc., due to the development of quantum device hardware. Quantum computing simulation is a process of realizing simulated operation of a quantum program corresponding to a specific problem by means of a virtual architecture (namely a quantum virtual machine) built by resources of a common computer. In general, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program referred to in the embodiments of the present application is a program written in a classical language to characterize a qubit and its evolution, where the qubit, a quantum logic gate, etc. related to quantum computation are all represented by corresponding classical codes.
Quantum circuits, which are one embodiment of quantum programs and weigh sub-logic circuits as well, are the most commonly used general quantum computing models, representing circuits that operate on qubits under an abstract concept, and their composition includes qubits, circuits (timelines), and various quantum logic gates, and finally the result often needs to be read out through quantum measurement operations.
Unlike conventional circuits, which are connected by metal lines to carry voltage or current signals, in a quantum circuit, the circuit can be seen as being connected by time, i.e., the state of the qubit naturally evolves over time, as indicated by the hamiltonian operator, during which it is operated until a logic gate is encountered.
A quantum program is generally corresponding to a total quantum circuit, where the quantum program refers to the total quantum circuit, and the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. It can be understood that: one quantum program may consist of a quantum circuit, a measurement operation for the quantum bits in the quantum circuit, a register to hold the measurement results, and a control flow node (jump instruction), and one quantum circuit may contain several tens of hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process of executing all quantum logic gates according to a certain time sequence. Note that the timing is the time sequence in which a single quantum logic gate is executed.
It should be noted that, in the classical calculation,the most basic unit is a bit, the most basic control mode is a logic gate, and the purpose of the control circuit can be achieved through the combination of the logic gates. Similarly, the way in which the qubits are handled is a quantum logic gate. Quantum logic gates are used, which are the basis for forming quantum lines, and include single-bit quantum logic gates, such as Hadamard gates (H gates, ada Ma Men), brix gates (X gates, brix gates), brix-Y gates (Y gates, briy gates), brix-Z gates (Z gates, brix Z gates), RX gates (RX gates), RY gates (RY gates), RZ gates (RZ gates), and the like; multi-bit quantum logic gates such as CNOT gates, CR gates, iSWAP gates, toffoli gates, and the like. Quantum logic gates are typically represented using unitary matrices, which are not only in matrix form, but also an operation and transformation. The general function of a quantum logic gate on a quantum state is to calculate by multiplying the unitary matrix by a vector corresponding to the right vector of the quantum state. For example, the quantum state right vector |0>The corresponding vector may be
Figure BDA0004143340990000071
Quantum state right vector |1>The corresponding vector may be +.>
Figure BDA0004143340990000072
Referring to FIG. 2, FIG. 2 is a flow chart illustrating a method of weather data prediction according to an exemplary embodiment. The embodiment provides a weather data prediction method, which comprises the following steps:
s201, acquiring meteorological data graphs of a plurality of moments before a moment to be predicted.
The weather data map at each moment comprises weather data of all subareas in the area to be predicted.
In the embodiment of the application, the meteorological data may be data such as air pressure, temperature, wind speed and humidity.
The time to be predicted is the time when weather prediction is needed, the previous multiple times can be 10 times, the specific time selection can be set according to practical application, and the number and the selection mode of the previous multiple times are not particularly limited in the embodiment of the application.
For example, when the time to be predicted is 6 times of 2023.2.2, the previous times of the time to be predicted may be 10 times such as 0, 3, 6, 9, 12, 5, 18, 21, and 2022.2.2 of 2023.2.1.
The area to be predicted is a geographical area needing weather prediction, in the embodiment of the present application, the area to be predicted may be divided into a plurality of sub-areas according to longitude and latitude, real-time weather data of each sub-area at each moment is recorded, and a weather data map of the area to be predicted at each moment may be obtained.
The weather data map may be expressed mathematically as { X ] 1 ,...,X k ...,X d X is meteorological data, d is the number of spatial sequences, representing spatial dimensions; the time dimension is represented by T, the step length of the weather data graph sequence is represented by T, the area to be predicted can be represented as a space grid with the area of xy, each grid in the space grid has weather data X, and then X i k Representing the meteorological data values in the kth grid at the i moment, i epsilon { t-Tin }, t-tin+j, t }, t representing the first time dimension before the point in time to be predicted, j representing the time step, and Tin representing the time window sizes corresponding to the multiple moments before the point in time to be predicted.
And S202, sequentially carrying out attention operation on the weather data graph at each moment based on the quantum attention network to obtain a characteristic graph of the weather data graph at each moment.
And S203, sequentially inputting the characteristic images of the meteorological data images at each moment into a convolution long-short time memory network (Convolutional long-term short-term memory network, convLSTM) to obtain a predicted meteorological data image at the moment to be predicted.
In the embodiment of the present application, the output of the quantum attention network is connected to the input of ConvLSTM, and the hidden state of the output of ConvLSTM at each moment will be used as the input of ConvLSTM and the attention network at the next moment.
FIG. 3 is a schematic diagram of a quantum attention network and ConvLSTM predicted meteorological data graph, FIG. 3 shows a T-T to be used in accordance with an embodiment of the present application in 、t-T in Meteorological data graph X of continuous time such as +1..t is input into quantum attention network, and T-T of ConvLSTM output is output in -1、t-T in .. the hidden state H at the moment of T-1 is input into the quantum attention network to obtain T-T in 、t-T in +1. T isochronously time weather feature map of data map
Figure BDA0004143340990000091
And then the obtained T-T in 、t-T in Time points of +1..t.etc feature map of->
Figure BDA0004143340990000092
Inputting ConvLSTM to obtain T-T in 、t-T in A hidden state H at a time point of +1..t and the like, and based on the finally obtained hidden state H t The weather data prediction result at time t+1 can be determined.
The initial hidden state at the first moment in the network may be set to a matrix with all elements being 0.
In one implementation manner, after S203, the first weather data map of the predicted weather data map of the plurality of times may be deleted, the weather data map of the predicted time to be predicted is taken as the weather data map of the last time of the plurality of times, the updated predicted weather data map of the plurality of times is obtained, S202 to S203 are executed back to obtain the predicted weather data map of the next time of the time to be predicted, and the steps are repeated to obtain the predicted weather data map of the plurality of times after the time to be predicted.
According to the embodiment of the application, the weather data graphs at a plurality of moments before the moment to be predicted are obtained, the quantum attention operation is carried out on the weather data graphs at each moment based on the quantum attention network, the characteristic graph of each weather data graph is obtained, the characteristic graph of the weather data graph at each moment is sequentially input into ConvLSTM, the predicted weather data graph at the moment to be predicted is obtained, the quantum attention network can effectively reduce the model parameters, reduce the calculation complexity and speed up the calculation, in addition, the quantum parallel calculation can also speed up the processing speed of the weather data graph, the weather prediction speed is improved, and the short-time weather prediction is realized.
In another embodiment of the present application, in order to avoid the influence of the unit and scale difference of the meteorological data on the final prediction result, the normalization processing may be performed on the meteorological data in each meteorological data map, specifically, the normalization processing may be performed by the following formula:
Figure BDA0004143340990000101
the sequence of weather data maps may be defined as D; { X i 1 ,...,X i d } t i=t-Tin ,{Y j } j=t+1 t+Tout } t=Tin L-Tout
X k ={X 1 k ,...,X T k };k∈1,....,d;T=T in +T out
Wherein L is the total time step, X k Meteorological data representing the kth sub-region in the meteorological data map, d representing the spatial dimension of the region to be predicted, T representing a plurality of times before the time to be predicted, T in Representing an input time window, T out Representing an output time window.
Therefore, the weather data in each weather data graph is normalized through the normalization formula, so that the weather data graph of the time to be predicted, which is finally predicted, can be more accurate.
In another embodiment of the present application, the quantum convolution attention network includes a first quantum convolution line for performing quantum convolution on a hidden state of ConvLSTM at a previous time at a current time, a second quantum convolution line for performing quantum convolution on a weather data graph at the current time, and a third quantum convolution line for performing quantum convolution on a result obtained by splicing and activating quantum convolution results of the first quantum convolution line and the second quantum convolution line.
As shown in fig. 4, fig. 4 is a structural illustration of a quantum convolution attention network provided in an embodiment of the present applicationIntent. In the quantum attention network shown in fig. 4, the current time is time t, and the hidden state H of the first quantum convolution circuit to time t-1 1 t-1 Carrying out quantum convolution, wherein a second quantum convolution circuit is used for carrying out quantum convolution on the meteorological data graph X at the moment t,
Figure BDA0004143340990000102
and (3) vector splicing is represented, after the convolution results of the first quantum convolution circuit and the second quantum convolution circuit are spliced, the activation function tanh is used for activating, the activation result is input into the third quantum convolution circuit for quantum convolution, and the convolution result is normalized by using a softmax function.
Specifically, the quantum attention network can perform attention operation on the meteorological data graph at each moment through the following formula to obtain a characteristic graph of the meteorological data graph at each moment:
Figure BDA0004143340990000111
Figure BDA0004143340990000112
Figure BDA0004143340990000113
wherein W is E For the weight matrix of the first quantum convolution circuit, U E For the weight matrix of the second quantum convolution circuit, V E For the weight matrix of the third quantum convolution line,
Figure BDA0004143340990000114
is a hidden state at the time t-1, E i For the convolution result of the third quantum convolution circuit, M and N are space dimensions, k and l are sum coefficients, tanh () is an activation function, +.>
Figure BDA0004143340990000115
For the attention factor, A is the attention matrix, < ->
Figure BDA0004143340990000116
Represents the Hadamard product, X t For the weather data diagram at time t +.>
Figure BDA0004143340990000117
And the characteristic diagram is a weather data diagram at the time t.
ConvLSTM may be denoted as f (), then the hidden state at time t
Figure BDA0004143340990000118
According to the embodiment of the application, the quantum attention network comprises the first quantum convolution circuit, the second quantum convolution circuit and the third quantum convolution circuit to perform quantum attention operation on the meteorological data graph at a plurality of moments, the characteristics of the meteorological data graph can be extracted more accurately by means of the entanglement characteristics of the quantum convolution circuit, accuracy of meteorological data prediction is improved, the quantum convolution circuit has parallel computing characteristics, processing speed of complex meteorological data can be improved, and short-time meteorological data prediction is achieved.
In another embodiment of the present application, the second quantum convolution circuit includes a coding layer, a parametric layer, and a measurement layer;
the encoding layer is used for encoding each meteorological data graph to a preset number of quantum bits; the parameter-containing layering is used for carrying out quantum state evolution on the coded quantum bits; the measuring layer is used for carrying out quantum state measurement on the evolved quantum bit, calculating an expected value and obtaining a quantum convolution result of each meteorological data graph.
The preset number may be set according to an actual application scenario, for example, may be set to 4, and then 4 quantum bits may be used to form a second quantum convolution line, so as to obtain a filter with a size of 2×2.
The coding layer can select 4 pieces of weather data from the weather data map each time, the 4 pieces of weather data are coded to 4 quantum bits in a one-to-one correspondence mode by adopting an angle coding mode, the weather data map is traversed, and quantum convolution is carried out on the weather data map.
The parameter-containing layering will evolve the quantum states of the encoded 4 qubits.
The measurement layer measures quantum states of a preset number of quantum bits, and a series of classical expected values can be obtained. Similar to classical convolution layers, each measured expected value will be mapped to a different channel of a single output pixel.
The process of the coding layer, the parameter-containing layer and the measuring layer is iterated on different areas in the meteorological data graph, the fully input meteorological data graph can be scanned, an output object is generated, the output object is constructed into a multi-channel image, and then a quantum convolution result of the meteorological data graph can be obtained.
The coding layer of the second quantum convolution circuit comprises an RY gate, and the parameter-containing layer comprises a first RZ gate, a CNOT gate and a second RZ gate.
As shown in fig. 5, fig. 5 is a schematic diagram of a second quantum convolution circuit provided in an embodiment of the present application, where the second quantum convolution circuit shown in fig. 5 includes four qubits q0 to q3, and the coding layer includes RY gates acting on each qubit; the parametrization hierarchy includes a first RZ gate for each qubit, a CONT gate for adjacent and first and last qubits, and a second RZ gate for each qubit; the measurement layer may make a desired value measurement of the quantum state of each qubit.
In this embodiment of the present application, the structures of the first quantum convolution line, the second quantum convolution line, and the third quantum convolution line are the same.
By adopting the embodiment of the application, the meteorological data in the meteorological data graph is encoded to the preset number of quantum bits through the encoding layer of the second quantum convolution circuit, the parameter-containing layer performs quantum state evolution on the encoded quantum bits, and the quantum states are measured through the measuring layer to obtain the quantum convolution result.
The final predicted meteorological data graph obtained according to the embodiment of the application can be expressed as Y i ,Y i And the predicted weather feature map corresponding to the ith predicted time point is represented and comprises the predicted weather features corresponding to the ith time point of each sub-region. The dimension of the output tensor can be defined as Y ε R M*N For any target value at time t, it can be defined as Y t ∈R M*N M x N defines the spatial dimension.
The quantum attention network and ConvLSTM in the above embodiments can be trained by the following loss functions:
Figure BDA0004143340990000131
wherein T is outMN Represents the output time window, M and N represent the spatial dimensions of the region to be predicted, t, k, l represent the summation index, y t,k,l Representing the actual meteorological data at time t,
Figure BDA0004143340990000132
the predicted weather data at time t is indicated.
During the training process, the experimental data set is divided into training set D trina Test set D test And verification set D validation Respectively for training, testing and verification.
Based on the same inventive concept, the embodiment of the present application further provides a weather data prediction apparatus, as shown in fig. 6, including:
the acquiring module 601 is configured to acquire weather data maps at a plurality of times before a time to be predicted, where the weather data map at each time includes weather data of each sub-region in the area to be predicted;
the attention module 602 is configured to perform attention operation on the weather data map at each moment in sequence based on the quantum attention network, so as to obtain a feature map of the weather data map at each moment;
the prediction module 603 is configured to sequentially input feature maps of the weather data maps at each moment into the convolutional long-short time memory network ConvLSTM, and obtain a predicted weather data map at the moment to be predicted.
Optionally, the quantum convolution attention network includes a first quantum convolution line for performing quantum convolution on a hidden state of the ConvLSTM at a previous time at a current time, a second quantum convolution line for performing quantum convolution on a meteorological data graph at the current time, and a third quantum convolution line for performing quantum convolution on a result obtained by splicing and activating quantum convolution results of the first quantum convolution line and the second quantum convolution line.
Optionally, the quantum attention network performs attention operation on the weather data graph at each moment by the following formula to obtain a feature graph of the weather data graph at each moment:
Figure BDA0004143340990000141
Figure BDA0004143340990000142
Figure BDA0004143340990000143
wherein W is E For the weight matrix of the first quantum convolution circuit, U E For the weight matrix of the second quantum convolution circuit, V E For the weight matrix of the third quantum convolution line,
Figure BDA0004143340990000144
is a hidden state at the time t-1, E i For the convolution result of the third quantum convolution circuit, M and N are space dimensions, k and l are sum coefficients, tanh () is an activation function, +.>
Figure BDA0004143340990000145
For attention coefficient, +.>
Figure BDA0004143340990000146
Representing the Hadamard product, A is the attention matrix, X t For the weather data diagram at time t +.>
Figure BDA0004143340990000147
And the characteristic diagram is a weather data diagram at the time t.
Optionally, the second quantum convolution circuit comprises a coding layer, a parameter-containing layer and a measuring layer;
the encoding layer is used for encoding each meteorological data graph to a preset number of quantum bits;
the parameter-containing layering is used for carrying out quantum state evolution on the coded quantum bits;
the measuring layer is used for carrying out quantum state measurement on the evolved quantum bit, calculating an expected value and obtaining a quantum convolution result of each meteorological data graph.
Optionally, the coding layer comprises a RY gate, and the parameter-containing layer comprises a first RZ gate, a CNOT gate, and a second RZ gate.
Optionally, the first quantum convolution circuit, the second quantum convolution circuit, and the third quantum convolution circuit have the same structure.
Optionally, the weather data in the weather data map at each moment is normalized by the following formula:
Figure BDA0004143340990000151
X k ={X 1 k ,...,X T k };k∈1,....,d;T=T in +T out
wherein X is k Meteorological data representing the kth sub-region in the meteorological data map, d representing the spatial dimension of the region to be predicted, T representing a plurality of times before the time to be predicted, T in Representing an input time window, T out Representing an output time window.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Still another embodiment of the present application further provides a storage medium having a computer program stored therein, wherein the computer program is configured to perform the steps of the above-described weather data prediction method embodiment when run.
Specifically, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Yet another embodiment of the present application provides an electronic device comprising a memory having a computer program stored therein and a processor configured to run the computer program to perform the steps of the weather data prediction method embodiments described above.
Specifically, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Specifically, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
step one, acquiring meteorological data graphs of a plurality of moments before a moment to be predicted.
And secondly, carrying out attention operation on the meteorological data graph at each moment in sequence based on the quantum attention network to obtain a characteristic graph of the meteorological data graph at each moment.
And thirdly, sequentially inputting the feature images of the weather data images at each moment into a convolution long-short time memory network ConvLSTM to obtain a predicted weather data image at the moment to be predicted.
The foregoing detailed description of the construction, features and advantages of the present application will be presented in terms of embodiments illustrated in the drawings, wherein the foregoing description is merely illustrative of preferred embodiments of the application, and the scope of the application is not limited to the embodiments illustrated in the drawings.

Claims (10)

1. A method of weather data prediction, the method comprising:
acquiring weather data graphs of a plurality of moments before a moment to be predicted, wherein the weather data graph of each moment comprises weather data of all subareas in a region to be predicted;
carrying out attention operation on the meteorological data graph at each moment in sequence based on a quantum attention network to obtain a characteristic graph of the meteorological data graph at each moment;
and sequentially inputting the feature images of the meteorological data images at each moment into a convolution long-short time memory network ConvLSTM to obtain a predicted meteorological data image at the moment to be predicted.
2. The method of claim 1, wherein the quantum convolution attention network comprises a first quantum convolution line for quantum convolution of a hidden state of ConvLSTM at a previous time at a current time, a second quantum convolution line for quantum convolution of a meteorological data graph at the current time, and a third quantum convolution line for quantum convolution of a result of a splice activation of quantum convolution results of the first quantum convolution line and the second quantum convolution line.
3. The method according to claim 2, wherein the quantum attention network performs attention operation on the weather data map at each moment by specifically using the following formula to obtain a feature map of the weather data map at each moment:
Figure FDA0004143340980000011
Figure FDA0004143340980000012
Figure FDA0004143340980000013
wherein W is E For the weight matrix of the first quantum convolution circuit, U E For the weight matrix of the second quantum convolution circuit, V E For the weight matrix of the third quantum convolution circuit,
Figure FDA0004143340980000014
is a hidden state at the time t-1, E i For the convolution result of the third quantum convolution circuit, M and N are space dimensions, k and l are sum coefficients, tanh () is an activation function, +.>
Figure FDA0004143340980000021
For attention coefficient, +.>
Figure FDA0004143340980000022
Representing the Hadamard product, A is the attention matrix, X t For the weather data diagram at time t +.>
Figure FDA0004143340980000023
And the characteristic diagram is a weather data diagram at the time t.
4. The method of claim 2, wherein the second quantum convolution circuit comprises an encoding layer, a parametric layer, and a measurement layer;
the encoding layer is used for encoding each meteorological data graph to a preset number of quantum bits;
the parameter-containing layering is used for carrying out quantum state evolution on the coded quantum bits;
the measuring layer is used for carrying out quantum state measurement on the evolved quantum bit, calculating an expected value and obtaining a quantum convolution result of each meteorological data graph.
5. The method of claim 4, wherein the coding layer comprises a RY gate and the parameter-containing layer comprises a first RZ gate, a CNOT gate, and a second RZ gate.
6. The method of claim 4, wherein the first quantum convolution circuit, the second quantum convolution circuit, and the third quantum convolution circuit are identical in structure.
7. The method according to any one of claims 1 to 6, wherein the weather data in the weather data map at each time is normalized by the following formula:
Figure FDA0004143340980000024
X k ={X 1 k ,...,X T k };k∈1,....,d;T=T in +T out
wherein X is k Meteorological data representing the kth sub-region in the meteorological data map, d representing the spatial dimension of the region to be predicted, T representing a plurality of times before the time to be predicted, T in Representing an input time window, T out Representing an output time window.
8. A weather data prediction apparatus, the apparatus comprising:
the acquisition module is used for acquiring weather data graphs of a plurality of moments before the moment to be predicted, wherein the weather data graph of each moment comprises weather data of all subareas in the area to be predicted;
the attention module is used for carrying out attention operation on the weather data graph at each moment in sequence based on the quantum attention network to obtain a characteristic graph of the weather data graph at each moment;
the prediction module is used for sequentially inputting the feature images of the weather data images at each moment into the convolution long-short time memory network ConvLSTM to obtain a predicted weather data image at the moment to be predicted.
9. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when run.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 7.
CN202310296539.5A 2023-03-23 2023-03-23 Meteorological data prediction method and device, storage medium and electronic device Active CN116400430B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310296539.5A CN116400430B (en) 2023-03-23 2023-03-23 Meteorological data prediction method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310296539.5A CN116400430B (en) 2023-03-23 2023-03-23 Meteorological data prediction method and device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN116400430A true CN116400430A (en) 2023-07-07
CN116400430B CN116400430B (en) 2024-06-14

Family

ID=87006738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310296539.5A Active CN116400430B (en) 2023-03-23 2023-03-23 Meteorological data prediction method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN116400430B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109447305A (en) * 2018-06-23 2019-03-08 四川大学 A kind of trend forecasting method based on the long Memory Neural Networks in short-term of quantum weighting
CN112836864A (en) * 2021-01-18 2021-05-25 青岛理工大学 Weather prediction method, system, medium and electronic device
US20210256346A1 (en) * 2020-02-18 2021-08-19 Stmicroelectronics S.R.L. Vector quantization decoding hardware unit for real-time dynamic decompression for parameters of neural networks
CN114444665A (en) * 2022-02-02 2022-05-06 上海图灵智算量子科技有限公司 Itoxin solver based on graph convolution neural network and method for realizing Itoxin model
CN114461069A (en) * 2022-02-07 2022-05-10 上海图灵智算量子科技有限公司 Quantum CNN-LSTM-based emotion recognition method
CN114936691A (en) * 2022-05-06 2022-08-23 河北工业大学 Temperature forecasting method integrating relevance weighting and space-time attention
CN115144934A (en) * 2022-06-29 2022-10-04 合肥本源量子计算科技有限责任公司 Weather prediction method based on variational quantum line and related equipment
CN115759413A (en) * 2022-11-21 2023-03-07 合肥本源量子计算科技有限责任公司 Meteorological prediction method and device, storage medium and electronic equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109447305A (en) * 2018-06-23 2019-03-08 四川大学 A kind of trend forecasting method based on the long Memory Neural Networks in short-term of quantum weighting
US20210256346A1 (en) * 2020-02-18 2021-08-19 Stmicroelectronics S.R.L. Vector quantization decoding hardware unit for real-time dynamic decompression for parameters of neural networks
CN112836864A (en) * 2021-01-18 2021-05-25 青岛理工大学 Weather prediction method, system, medium and electronic device
CN114444665A (en) * 2022-02-02 2022-05-06 上海图灵智算量子科技有限公司 Itoxin solver based on graph convolution neural network and method for realizing Itoxin model
CN114461069A (en) * 2022-02-07 2022-05-10 上海图灵智算量子科技有限公司 Quantum CNN-LSTM-based emotion recognition method
CN114936691A (en) * 2022-05-06 2022-08-23 河北工业大学 Temperature forecasting method integrating relevance weighting and space-time attention
CN115144934A (en) * 2022-06-29 2022-10-04 合肥本源量子计算科技有限责任公司 Weather prediction method based on variational quantum line and related equipment
CN115759413A (en) * 2022-11-21 2023-03-07 合肥本源量子计算科技有限责任公司 Meteorological prediction method and device, storage medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SAMUEL YEN-CHI CHEN ET AL: "QUANTUM LONG SHORT-TERM MEMORY", 《ICASSP 2022 - 2022 IEEE INTERNATIONAL CONFERENCE ON ACOUSTICS, SPEECH AND SIGNAL PROCESSING (ICASSP)》, 27 April 2022 (2022-04-27) *
贾花萍;: "用量子优化算法预测小麦赤霉病", 江苏农业学报, no. 03, 30 June 2013 (2013-06-30) *

Also Published As

Publication number Publication date
CN116400430B (en) 2024-06-14

Similar Documents

Publication Publication Date Title
CN115144934B (en) Meteorological prediction method based on variable component sub-line and related equipment
CN115759413B (en) Meteorological prediction method and device, storage medium and electronic equipment
CN114792378B (en) Quantum image recognition method and device
CN114821217B (en) Image recognition method and device based on quantum classical hybrid neural network
CN116011682B (en) Meteorological data prediction method and device, storage medium and electronic device
CN114861542A (en) Method, device and equipment for evaluating loss of direct current transmission project and storage medium
CN116187548A (en) Photovoltaic power generation power prediction method and device, storage medium and electronic device
CN115809705A (en) Fluid dynamics computing system based on quantum computing and quantum computer
CN114764619B (en) Convolution operation method and device based on quantum circuit
CN116011681A (en) Meteorological data prediction method and device, storage medium and electronic device
CN116400430B (en) Meteorological data prediction method and device, storage medium and electronic device
CN116431807A (en) Text classification method and device, storage medium and electronic device
CN114372539B (en) Machine learning framework-based classification method and related equipment
CN116403657A (en) Drug response prediction method and device, storage medium and electronic device
CN115131120A (en) Quantum option estimation method based on least square method and related device
CN117151231A (en) Method, device and medium for solving linear system by using variable component sub-line
CN116306952B (en) Molecular property prediction method and device, storage medium and electronic device
CN118504721A (en) Meteorological data prediction method and device, storage medium and electronic device
CN115829037B (en) Quantum simulation method and device of Fermi subsystem, electronic equipment and medium
CN115829038B (en) Method for determining the transformation from a fermi subsystem to a qubit system and transformation framework
CN115829039B (en) Method, device, electronic equipment and medium for layering of Fermi subsystem
CN115775030B (en) Quantum program rewriting method and device based on pattern matching and electronic device
CN114821147B (en) Quantum image recognition display method and device
CN114819171B (en) Quantum convolution operation realization method and device
CN116499466B (en) Intelligent navigation method and device, storage medium and electronic 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
GR01 Patent grant
GR01 Patent grant