Weather prediction method based on improved quantum long short-term memory network

By using an improved quantum long short-term memory network HAQLSTM-CGRU model, combined with convolutional gated recurrent units and attention mechanisms, the shortcomings of existing weather forecasting models in capturing nonlinearities and long-term dependencies are addressed, achieving more accurate weather forecasts and early warnings.

CN120671731APending Publication Date: 2025-09-19CHONGQING NORMAL UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510853237.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing weather forecast model networks are inefficient in capturing the complex nonlinear relationships and long-term dependencies in weather data, resulting in the inability to accurately predict extreme weather events and increasing the risk of disaster losses.

Method used

An improved quantum long short-term memory network (HAQLSTM-CGRU) model is adopted, combining the convolutional gated recurrent unit (CGRU) and the improved quantum long short-term memory network (HAQLSTM), introducing the attention mechanism and residual connection, optimizing the model hyperparameters by parameterizing the variational quantum circuit, and using the improved grey wolf optimization algorithm (IGWO) for hyperparameter optimization.

Benefits of technology

It improves the accuracy and stability of weather forecasts, enables earlier prediction of extreme weather events, reduces disaster risks, and enhances the robustness and computational efficiency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120671731A_ABST
    Figure CN120671731A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of weather prediction, and discloses a weather prediction method based on an improved quantum long short-term memory network, which comprises the steps of inputting weather data into a CGRU model to perform spatial feature extraction on the weather data, and then inputting an output hidden state sequence into an HAQLSTM model to perform prediction, the HAQLSTM model is an improvement of a quantum long short-term memory network model, and the quantum long short-term memory network model is an improved quantum long short-term memory network model. A parameterized variable component sub-circuit is adopted, an attention mechanism and residual connection are added, a quantum long-short-term memory network serves as a time modeler, the residual connection enhances information transmission, the attention mechanism dynamically balances the importance of different parts of input data, in the processing process, a self-attention mechanism is adopted to calculate the correlation weight of input sequence elements, and the correlation weight of the input sequence elements is calculated. Four parallel parameterized variable component sub-circuits are used for carrying out key calculation so as to improve the model performance; the problems that an existing weather prediction model network is insufficient in expression ability, and the efficiency of capturing the long-term dependency relationship in the sequence is low are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of weather forecasting, and in particular to a weather forecasting method based on an improved quantum long short-term memory network. Background Art

[0002] In recent years, with the rapid development of big data and artificial intelligence technology, deep learning technology has shown great potential in the field of weather forecasting due to its powerful data processing, nonlinear mapping and pattern recognition capabilities.

[0003] Existing weather forecasting model networks are often limited by model complexity and computational resources, resulting in an inability to fully capture the complex nonlinear relationships and characteristics in weather data. This lack of expressiveness means that when faced with complex and changing weather scenarios, the models may be unable to accurately learn and simulate the patterns of weather changes in these scenarios.

[0004] Weather data exhibits significant time series characteristics, with long-term dependencies between weather conditions at different points in time. However, existing forecasting models are inefficient at capturing these long-term dependencies and may fail to fully tap into the deep insights within time series data. Consequently, when faced with extreme weather events, if the models cannot accurately predict the timing and intensity of these events, relevant departments will be unable to take timely and effective preventive measures, thereby increasing the risk of disaster losses. Summary of the Invention

[0005] The present invention aims to provide a weather forecasting method based on an improved quantum long short-term memory network to solve the problems of insufficient expression ability and low efficiency in capturing long-term dependencies in sequences in existing weather forecasting model networks.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: a weather forecasting method based on an improved quantum long short-term memory network, comprising the following steps: Collect historical weather data, use the CGRU model to extract spatial features from the weather data, and input the output hidden state sequence into the HAQLSTM model used to predict the target variable. The HAQLSTM model outputs a prediction for the target variable at the next time step. The target variable is one or more weather data items. The CGRU model replaces matrix multiplication in the gated operation with local convolution. The CGRU model network includes a convolutional layer for extracting spatial features of weather data and a gated recurrent unit layer for processing time series data and capturing long-term dependencies. The HAQLSTM model is an improvement on the quantum long short-term memory network model, using parameterized variational quantum circuits and incorporating an attention mechanism and residuals. The HAQLSTM model includes a quantum long short-term memory network, an attention mechanism, and residual connections. The quantum long short-term memory network serves as a temporal modeler, the residual connections add the original input to the final output, and the attention mechanism is used to dynamically weigh the importance of different parts of the input data. The HAQLSTM model sends the input data and the hidden state of the previous time step to the attention mechanism layer. The attention mechanism layer uses a self-attention mechanism to calculate the association weights between the elements of the input sequence. After the attention mechanism processing, four parallel parameterized variational quantum circuits are used to replace the linear transformation layer used to calculate the forget gate, input gate, candidate cell state and output gate in the traditional long short-term memory network; the four parameterized variational quantum circuits all include angle coding and strong entanglement layers, and the angle coding and strong entanglement layers are connected in series.

[0007] The principle and advantages of this solution are that weather patterns often exhibit spatial correlation. When forecasting long sequences of weather data, it is necessary to capture both spatial correlation and temporal dependency. This solution proposes an innovative hybrid deep learning model, HAQLSTM-CGRU, to improve weather forecast accuracy. This model creatively combines the powerful spatial feature extraction capabilities of the convolutional gated recurrent unit (CGRU) with the precise temporal dependency modeling advantages of the improved quantum long short-term memory (HAQLSTM) network. The CGRU extracts spatial features from the input weather data, such as the spatial correlation of temperature and precipitation, while the HAQLSTM further models the temporal dynamics of these spatial features, resulting in more accurate weather forecasts.

[0008] CGRU replaces matrix multiplication in gating operations with local convolution, while retaining the long-term memory capability of GRU, it introduces the modeling advantage of CNN in spatial structure, thus achieving a balance between computational efficiency and parameter size.

[0009] By combining the strengths of quantum computing with classical LSTM and introducing an attention mechanism and residual connections, the HAQLSTM model can more effectively learn and simulate the complex nonlinear relationships and features in weather data, improving the network's expressive power. This enables the model to more accurately predict weather changes in complex and changing weather scenarios.

[0010] The introduction of the attention mechanism and the application of parameterized variational quantum circuits enable the HAQLSTM model to more efficiently capture long-term dependencies in time series data. This helps the model more accurately predict weather trends, especially in the face of extreme weather events, and can issue early warnings, providing strong support for relevant departments to take preventive measures.

[0011] The addition of residual connections helps alleviate the vanishing gradient problem in deep neural networks and improves the robustness and stability of the model. This makes it easier for the model to converge to the optimal solution during training and exhibit better performance in practical applications.

[0012] Preferably, as an improvement, The convolutional layer applies filters to the input data. Multiple convolutional layers with different filter sizes are used. During the forward propagation phase, each convolutional layer uses an activation function and performs a convolution operation on the output of the previous layer. After each convolutional layer, maximum pooling is used to reduce the spatial dimension of the feature map. The output of the convolutional layer is input into the gated recurrent unit layer. The gated recurrent unit layer structure includes an update gate and a reset gate. The update gate replaces the input gate and forget gate of the long short-term memory network, and the reset gate is used to directly process the previous hidden state.

[0013] The benefits of this improvement are as follows: the convolutional layers use filters of varying sizes to extract spatial features from the input data at multiple scales. The forward propagation phase employs activation functions and convolution operations, enhancing the model's nonlinear expressiveness. Max pooling is applied after each convolutional layer to reduce the spatial dimensionality of the feature map, helping to reduce computational overhead and making the model more robust to small changes in the input. The GRU structure is simpler than the LSTM, trains faster, and effectively accounts for long-term dependencies. By feeding the spatial features extracted by the CGRU into the HAQLSTM, the model can more comprehensively process the spatiotemporal information in weather data, improving the accuracy of weather forecasts.

[0014] Preferably, as an improvement, the improved Grey Wolf Optimization Algorithm is used to optimize the hyperparameters of the hybrid model of the CGRU model and the HAQLSTM model; The improved grey wolf optimizer adopts a hybrid initialization strategy, which divides the population initialization into two parts, one half is randomly generated within a given parameter range, and the other half is generated using a learning strategy based on elite confrontation; In elite adversarial learning, the fitness of randomly initialized solutions is first evaluated, and a subset of elite solutions is selected. For the solution to be initialized, an elite solution is randomly selected and its opposite solution is calculated. The generation of the opposite solution combines the calculation of the opposite value of the upper and lower limits and the addition of small random perturbations.

[0015] The beneficial effect of this improvement is that the performance of the hybrid model depends heavily on the choice of hyperparameters. The improved Gray Wolf Optimizer uses a hybrid initialization strategy, with half of the initial population randomly generated within a given parameter range and the other half generated using an elite adversarial learning strategy. This enhances the diversity of the initial population, avoids being trapped in local optima, and enables the optimization process to search for the optimal solution from a wider range. In elite adversarial learning, a subset of elite solutions is selected by evaluating the fitness of randomly initialized solutions, and the opposite solution is calculated for the solution to be initialized. This, combined with calculating the opposite values ​​of the upper and lower limits and adding small random perturbations, further enriches the diversity of the population, helps find more optimal hyperparameter combinations, and improves the predictive performance of the hybrid model.

[0016] Preferably, as an improvement, the improved grey wolf optimization algorithm adopts an adaptive weight and leadership mechanism, uses an objective function to evaluate the fitness of each solution, sorts the solutions according to the fitness, and designates the best three solutions as α wolf, β wolf and δ wolf respectively; A dynamic parameter a is introduced, and parameter a decreases linearly from 2 to 0 during the iteration process. When updating the position, the distance between each wolf and α, β, and δ wolves is calculated. Based on these distances, the candidate positions X1, X2, and X3 are calculated. The position of each wolf is updated to the weighted average of X1, X2, and X3, and adaptive weights are assigned to α, β, and δ wolves.

[0017] The beneficial effects of this improvement are: adaptive weights and a leadership mechanism achieve a balance between exploration and exploitation, guiding the population to converge toward the optimal solution. An objective function is used to evaluate the fitness of each solution, and solutions are ranked according to fitness. The three best solutions are designated as α-wolf, β-wolf, and δ-wolf, representing the leaders of the pack. A dynamic parameter a is introduced, which decreases linearly from 2 to 0 during the iteration process. Larger values ​​of a in the early stages promote exploration, while smaller values ​​in the later stages promote exploitation, enabling the algorithm to conduct targeted searches at different stages. During position updates, the distance between each wolf and α, β, and δ wolves is calculated. Based on these distances, candidate positions are calculated and updated. Adaptive weights are assigned to α, β, and δ wolves, emphasizing the influence of α's optimal solution while also considering the contributions of β and δ wolves. This improves the algorithm's search efficiency and convergence speed, enabling it to more quickly find the optimal hyperparameter combination.

[0018] Preferably, as an improvement, the improved grey wolf optimization algorithm adopts an adversarial jump mechanism, and in the iterative process, the adversarial jump mechanism is applied with decreasing probability; A subset of the population is randomly selected, and for each selected wolf, each parameter is updated with a 50% probability using either true adversarial or elite-guided adversarial methods; true adversarial methods calculate the opposite value of the parameter, while elite-guided adversarial methods move closer to the parameter value corresponding to the α wolf and add a small random perturbation.

[0019] The beneficial effect of this improvement is that during the iteration process, an adversarial jump mechanism is applied with decreasing probability, randomly selecting a subset of the population. For each selected wolf, each parameter is updated with a 50% probability using either true adversarial or elite-guided adversarial methods. True adversarial methods calculate the opposite value of the parameter, while elite-guided adversarial methods move the parameter value corresponding to the alpha wolf toward the target and add small random perturbations. This mechanism enhances the algorithm's exploration capabilities, enabling it to escape local optima and search a wider solution space, increasing the likelihood of finding the globally optimal hyperparameter combination, thereby improving the performance of the hybrid model.

[0020] Preferably, as an improvement, the adaptive weights allocated to the α wolf, β wolf and δ wolf are 50%, 30% and 20% respectively.

[0021] The beneficial effect of this improvement is that this weight distribution method can reasonably reflect the importance of wolves of different ranks in guiding the population search process. The α wolf, as the representative of the optimal solution, is given a larger weight, making its guiding role in the population more obvious. At the same time, the weights of the β and δ wolves are also appropriately reflected, ensuring that the population can comprehensively consider information from multiple optimal solutions during the search process. This helps to balance exploration and exploitation, improve the algorithm's search efficiency and convergence accuracy, and thus optimize the hyperparameters of the hybrid model.

[0022] Preferably, as an improvement, the HAQLSTM model calculates the hidden state through a quantum circuit, inputs the element-wise product of the current cell state and the output gate into another variational quantum circuit to obtain the hidden state of the current time step.

[0023] This improvement has the following benefits: quantum computing offers powerful parallel computing capabilities and nonlinear mapping advantages. By using quantum circuits to calculate hidden states, the HAQLSTM model can further benefit from the nonlinear mapping advantages of quantum computing during hidden state generation, enabling more efficient processing of complex weather data features. The element-wise product of the current cell state and the output gate is fed into another variational quantum circuit, enabling the model to utilize quantum circuits to perform deeper transformations and processing on the data, unlocking potential information within the data and thus improving its predictive capabilities for weather data.

[0024] Preferably, as an improvement, the historical weather data includes but is not limited to average, minimum and maximum temperatures, daily total precipitation, wind direction and speed, mean sea level pressure, wind speed, temperature, visibility, solar radiation and ultraviolet rays.

[0025] The beneficial effect of this improvement is that weather changes are a complex system, influenced by a combination of factors. The inclusion of multiple data points, including average, minimum, and maximum temperatures, daily precipitation, wind direction and speed, mean sea level pressure, visibility, solar radiation, and ultraviolet light, more comprehensively reflects the state and changing patterns of the weather system. This rich historical weather data provides the model with more information, enabling it to learn more accurate weather patterns and characteristics, thereby improving the accuracy and reliability of weather forecasts.

[0026] Preferably, as an improvement, the angle encoding is used to map each component of the classical data to the rotation angle of the rotating gate acting on the corresponding quantum bit; the strong entanglement layer includes a series of single-qubit rotating gates and multi-qubit entanglement gates, which are arranged alternately to introduce quantum entanglement and perform complex quantum operations.

[0027] The beneficial effects of this improvement are: angle encoding is an effective method for loading classical data into quantum systems. By mapping each component of the classical data to the rotation angle of a rotating gate, it can accurately convert classical information into quantum states, providing a foundation for subsequent quantum computation. The strongly entangled layer, composed of alternating single-qubit rotating gates and multi-qubit entangled gates, can introduce quantum entanglement and perform complex quantum operations. Quantum entanglement is a key resource in quantum computing, enhancing the model's expressiveness and computational power, enabling it to handle more complex weather data features and improving its modeling and prediction capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 2 is an overall structural diagram of an embodiment of the present invention.

[0029] Figure 2 4 is a structural diagram of the GRU of an embodiment of the present invention.

[0030] Figure 3 4 is a structural diagram of HAQLSTM according to an embodiment of the present invention.

[0031] Figure 4 This is a flowchart of the improved Grey Wolf optimizer according to an embodiment of the present invention.

[0032] Figure 5 Parameter table of each model using dataset 1 in Experiment 2.

[0033] Figure 6 This is the parameter table of each model using dataset 2 in Experiment 2.

[0034] Figure 7 This is a table showing the evaluation index results of each model using dataset 1 in Experiment 2.

[0035] Figure 8This is the table and graph of the evaluation index results of each model using dataset 2 in Experiment 2. DETAILED DESCRIPTION

[0036] The following is further described in detail through specific implementation methods: Example As attached Figure 1 As shown, a weather prediction method based on an improved quantum long short-term memory network includes the following steps: Collect historical weather data, including but not limited to average, minimum, and maximum temperatures (in degrees Celsius), daily precipitation (in millimeters), wind direction and speed (in kilometers per hour), mean sea level pressure (in hectopascals), wind speed, temperature, visibility, solar radiation, and ultraviolet light. Perform pre-processing operations such as cleaning and normalization on the historical weather data.

[0037] The CGRU model is used to extract spatial features from the preprocessed weather data. The model can capture the spatial patterns in weather data and their changes over time, and then generate a series of hidden state sequences that represent the compressed representation of the spatial patterns and their temporal evolution.

[0038] The HAQLSTM model is used to obtain the hidden state sequence output by the CGRU and model the temporal dependency of these features to output a prediction of the target variable for the next time step. The target variable is one or more weather data.

[0039] Among them, during the training process of the hybrid model of the CGRU model and the HAQLSTM model, the improved grey wolf optimization algorithm (IGWO) is used to optimize the hyperparameters of the hybrid model to find the optimal hyperparameter combination. Through the optimal hyperparameter combination, the prediction performance of the hybrid model is improved, so that it can perform well on different data sets.

[0040] The CGRU model replaces matrix multiplication in the gating operation with local convolution. While retaining the long-term memory capability of GRU (Gated Recurrent Unit), it introduces the modeling advantages of CNN (Convolutional Neural Network) in spatial structure, thus achieving a balance between computational efficiency and parameter scale.

[0041] In the CGRU model network, it includes convolutional layers and GRU layers; the convolutional layers are used to capture deep features, while the GRU layers are used to obtain the temporal dependencies of the target variables, thereby predicting the target variables.

[0042] The CGRU begins with a convolutional layer, which applies filters to the input data to identify patterns such as edges, textures, and other spatial structures. Multiple convolutional layers with varying filter sizes are used to capture a variety of spatial scales. Within a convolutional layer, neurons are not connected, and weights can be shared. During the forward propagation phase, each convolutional layer applies an activation function and convolves the output of the previous layer. This property of CNNs helps extract hidden information about individual families, regardless of their uncertainty.

[0043] After each convolutional layer, max pooling reduces the spatial dimensions of the feature map. This helps reduce computational load and makes the model more robust to small changes in the input. The output of the convolutional layer is then fed into the GRU network.

[0044] As attached Figure 2 The following diagram shows the structure of the GRU, a recurrent neural network (RNN) well-suited for processing sequential data. In this case, the sequence consists of spatial features extracted over time by the convolutional layers. The GRU captures how these spatial patterns change over time. Compared to the LSTM, the GRU has a simpler structure and can effectively account for long-term dependencies, making it an improved version of the LSTM. The GRU improves on the LSTM's three gates, leaving only two: an update gate and a reset gate. The GRU uses the update gate to replace the LSTM's input and forget gates, while the reset gate directly processes the previous hidden state. This makes the GRU faster to train than the LSTM.

[0045] The CGRU network uses convolutional layers to capture spatial correlations in the input meteorological data. The convolutional layers are followed by batch normalization layers to improve training stability and convergence speed. The ReLU activation function introduces nonlinearity, while the max pooling layer reduces the dimensionality of the feature map, reducing computational effort.

[0046] Attachment Figure 2 In the mathematical expression of CGRU structure, the following is the mathematical expression of CGRU structure: ; ; ; ; Among them, is the input feature tensor for this time step, is the hidden state at the previous time step, The update gate determines how much old memory to keep, The reset gate determines how much old memory to discard, Candidate hidden states, Output hidden state, Input-gate convolution weights, State-gate convolution weights, It is the sigmoid function, tanh hyperbolic tangent function, * two-dimensional convolution, Bitwise multiplication.

[0047] The HAQLSTM model improves the QLSTM (quantum long short-term memory network) model by adopting a new parameterized quantum circuit while also adding an attention mechanism and residuals, leveraging the spatial and temporal dependencies of weather data to improve the prediction of target variables.

[0048] The HAQLSTM model includes QLSTM, attention mechanism, and residual connection. QLSTM acts as a temporal modeler, responsible for learning how data patterns change over time, thereby achieving weather forecasts. Residual connection adds the original input to the final output, helping to improve the information flow in the network and enhance model performance. The attention mechanism enables the model to dynamically weigh the importance of different parts of the input sequence when making predictions.

[0049] As attached Figure 3 As shown, the HAQLSTM model first receives time series data features as input , compare the input data with the hidden state of the previous time step The attention mechanism layer uses a self-attention mechanism to highlight the key features of the prediction task by calculating the correlation weights between the elements of the input sequence. Specifically, it first calculates the query, key, and value vectors, then obtains the attention score by taking the dot product of the query and the key, and normalizes it using the Softmax function to generate a weight distribution. Finally, these weights are used to perform a weighted summation on the value vector to obtain a rich context vector. The introduction of the self-attention mechanism enables the model to more effectively capture long-term dependency information in the sequence.

[0050] After the attention mechanism, the model replaces the linear transformation layers used in traditional LSTMs to compute the forget gate, input gate, candidate cell state, and output gate with four parallel variational quantum circuits (VQCs). These quantum circuits correspond to the four gating functions in the classic LSTM architecture. The parameterized quantum circuits employed by QLSTM use the PennyLane library to define quantum circuits corresponding to each gate. Each circuit includes angle embedding and strongly entangled layers to achieve efficient quantum encoding of the input data. After the quantum circuits are processed, classical activation functions (such as sigmoid and tanh) are still used to generate the gate values.

[0051] Four parallel variational quantum circuits (VQCs) from left to right, representing the forget gate, input gate, candidate cell state, and output gate, respectively.

[0052] The forget gate receives the current input and the hidden state at the previous moment , a forgetting factor vector between 0 and 1 is generated through the sigmoid activation function This vector is consistent with the cell state at the previous moment Multiply each element to determine which historical information needs to be retained and which should be forgotten.

[0053] The input gate also receives the current input and the hidden state at the previous moment , which consists of two key components. The first part generates a control signal for the update gate through the sigmoid activation function , determines which new information will be added to the cell state; the second part uses the tanh activation function to create a new candidate cell state The cell state is updated by the weighted addition of the forget gate to the cell state at the previous moment and the weighted addition of the input gate.

[0054] The output gate uses the sigmoid function to determine which parts of the cell state are related to the current output and obtain the control signal of the output gate At the same time, the current cell state It will be transformed by the tanh function to get The two results are multiplied element by element again to finally get the hidden state at the current moment .

[0055] The current cell state The element product with the output gate is input into another variational quantum circuit to obtain the hidden state of the current time step Further processing results This allows QLSTM to further benefit from the nonlinear mapping advantages brought by quantum computing in the process of generating hidden states. In addition, the model also has a quantum readout circuit specifically for generating sequence outputs. The quantum circuit is used to read the compressed representation of the current cell state (after processing by the tanh activation function) to obtain the output value of the sequence. In order to improve the stability of the network and the accuracy of the output, a residual connection structure is designed to connect the output of the quantum readout to the output of the quantum readout. Directly add it to the external residual as the final network output, that is, output = +residual, helps alleviate the vanishing gradient problem and improve information flow.

[0056] The mathematical expression of the HAQLSTM structure is as follows: ; ; ; ; ; ; in, The forget gate vector determines how much old memory to keep. Forget gate weight matrix, Forget gate bias; Input gate vector, which determines how much new information to write, , The weight matrix and bias of the input gate; Candidate cell states, , Generate the weight matrix and bias of the candidate memory; Forget the old memories. Writing new information into memory; Output gate vector, , Weights and biases of the output gate; * element-wise multiplication.

[0057] The parameterized quantum circuit corresponding to each gate includes angle encoding and strong entanglement layers, which are connected in series. Angle encoding is a method for encoding classical data into qubit states. In this module, each component of the input classical data (usually an eigenvector) is mapped to the rotation angle of a rotation gate (e.g., Rx, Ry, Rz gates) acting on the corresponding qubit. The strong entanglement layer is the core component of the VQC, responsible for introducing quantum entanglement and performing complex quantum operations. It typically consists of a series of alternating single-qubit rotation gates and multi-qubit entanglement gates (e.g., CNOT gates).

[0058] In the data processing flow of a parameterized quantum circuit, the classical data to be processed is input into the VQC. Through the angle encoding module, the classical data is converted into the initial quantum state of each qubit, where each data feature controls the rotation angle of the corresponding qubit. The encoded quantum state enters the strongly entangled layer. In this layer, through the interaction of parameterized single-qubit rotation gates and fixed multi-qubit entangled gates, the quantum state is further evolved into a complex quantum feature space. This process introduces quantum entanglement, which is controlled by trainable parameters and enables the model to learn complex patterns in the data. After evolution in the strongly entangled layer, the qubits are measured, and the measurement results are classical bit strings. Typically, these measurement results require some post-processing to obtain the final output, such as classification results or predictions.

[0059] This parameterized quantum circuit architecture uses angle encoding to load classical data into a quantum system. It then uses a strongly entangled layer with trainable parameters to extract and transform complex quantum features. Finally, measurements are taken to obtain classical information for classification. The goal of VQC training is to adjust the parameters in the strongly entangled layer so that, for different input data, the measurement results correctly correspond to the corresponding category.

[0060] Compared with manual circuits, this parameterized variational quantum circuit provides rich learnable entanglement patterns through multiple layers of strong entanglement layers, and can explore more complex decision boundary expression capabilities in Hilbert space.

[0061] All gate angle parameters participate in backpropagation, avoiding the gradient sparsity caused by "angle fixing" in manual circuits. Shallow design also effectively mitigates the barren-plateau phenomenon. The number of qubits no longer corresponds one-to-one to the classical feature dimension, reducing hardware requirements while maintaining model capacity. Inputs are compressed using classical projections before being encoded with angles, reducing circuit depth. The unified VQC framework facilitates horizontal migration to other quantum-classical hybrid networks and switching between different hardware backends. It also eliminates the tedious process of manually arranging gate sequences and adjusting parameters; automatic optimization is achieved by simply setting the circuit depth and number of bits.

[0062] As attached Figure 4As shown in Figure 1, the improved Grey Wolf Optimizer (IGWO) uses a hybrid initialization strategy to enhance the diversity of the initial population and avoid being trapped in local optima. Initialization strategies include random initialization and elitist adversarial initialization. The population initialization is divided into two parts: one half is randomly generated within a given parameter range, and the other half is generated using an elitist adversarial learning strategy. In elitist adversarial learning, the fitness of the randomly initialized solutions is first evaluated, and a subset of elite solutions is selected. For each solution to be initialized, an elite solution is randomly selected and its "opposite" solution is calculated. This "opposite" solution is generated by combining the calculation of the opposite values ​​of the upper and lower limits (70% probability) and the addition of small random perturbations (30% probability).

[0063] Adaptive weighting and leadership mechanisms are then employed to strike a balance between exploration and exploitation, guiding the population toward the optimal solution. The objective function is used to evaluate the fitness of each solution, which is then ranked according to fitness. The three best solutions are designated as α-wolf, β-wolf, and δ-wolf, representing the leaders of the wolf pack. A dynamic parameter a is introduced, which decreases linearly from 2 to 0 during the iteration process, promoting exploration early in the process and exploitation later in the process.

[0064] When updating the position, calculate the distance between each wolf and wolves α, β, and δ. Based on these distances, calculate candidate positions X1, X2, and X3. Update the position of each wolf to the weighted average of X1, X2, and X3.

[0065] Assign adaptive weights to alpha wolf (50%), beta wolf (30%), and delta wolf (20%), emphasizing the influence of the best solution from alpha wolf while also considering the contributions from beta and delta wolves. Check the updated position to ensure that the parameter values ​​are within the defined range and adjust the parameter values ​​to match their defined types.

[0066] In addition, an adversarial jump mechanism is employed to enhance exploration and escape local optima. This mechanism is applied with decreasing probability (controlled by the jump_prob parameter) during the iterations. A subset of the population (30%) is randomly selected, and for each selected wolf, each parameter is updated with 50% probability using either true adversarial (calculating the opposite value of the parameter) or elite-guided adversarial (moving closer to the parameter value corresponding to the α wolf with a small random perturbation).

[0067] The fitness of the updated solution is evaluated. If a better solution is found, αwolf, βwolf, and δwolf are updated. The algorithm terminates when a stopping criterion is met (e.g., reaching the maximum number of iterations). The final αwolf represents the best solution found, corresponding to the optimized hyperparameters.

[0068] Improvements to IGWO, especially the elite adversarial learning and adaptive weighting strategies, aim to achieve a better balance between exploration and exploitation, leading to more efficient and robust hyperparameter optimization.

[0069] In order to verify the performance of the HAQLSTM-CGRU hybrid model for weather data prediction and the impact of the improved grey wolf optimization algorithm (IGWO) on the hyperparameter optimization performance of the hybrid model; this scheme sets up two experiments to verify them in turn.

[0070] Two datasets are used. Dataset 1 contains daily weather data for Boston, spanning 10 years, from March 1, 2013, to March 1, 2023. Each row in the dataset represents a single day and provides information such as mean, minimum, and maximum temperatures (in degrees Celsius), daily precipitation (in millimeters), wind direction and speed (in kilometers per hour), and mean sea level pressure (in hectopascals). This provides a comprehensive view of Boston's climate trends over the past decade.

[0071] Dataset 2 contains the most complete data on the evolution of the number of different features relevant to the Portuguese weather forecast for each day between 2022 and 2023. These features include 32 features, including wind speed, temperature, visibility, solar radiation, and UV index. Precipitation was used as a label for the experiments. The model was evaluated using metrics such as MAE (mean absolute error), RMSE (root mean square error), and SMAPE (symmetric mean absolute percentage error).

[0072] Experiment 1 The impact of the HAQLSTM-CGRU hybrid model on weather forecasting performance was tested. The hybrid model was compared with QLSTM, CGRU, and LSTM. The batch_size was set to 32, and the experiment was repeated six times with 100 iterations for each. MAE, RMSE, and SMAPE were used as evaluation indicators to verify the performance of the model.

[0073] The experimental results using dataset 1 are as follows: In terms of mean absolute error (MAE), HAQLSTM-CGRU achieved the lowest MAE values ​​in most experiments, indicating that it was generally more accurate in predictions than the other models. QLSTM's performance was relatively stable, but generally higher than HAQLSTM-CGRU. In several experiments, QLSTM's performance was close to or even slightly better than LSTM. LSTM's performance fluctuated across experiments, but overall, LSTM achieved higher MAE values ​​than HAQLSTM-CGRU. CGRU's MAE values ​​were relatively high in all experiments, indicating that its prediction errors were generally larger than those of the other three models.

[0074] In terms of RMSE (root mean square error) performance, HAQLSTM-CGRU achieved the lowest RMSE values ​​across all six experiments, indicating that its prediction results generally have the smallest square root of error and the highest prediction accuracy. The RMSE value of QLSTM was lower than that of LSTM and CGRU in most experiments, but higher than that of HAQLSTM-CGRU. QLSTM performance was relatively stable, but showed a significant decline in a few experiments. The RMSE value of LSTM was relatively low in the first two experiments, but increased in subsequent experiments, peaking in the fourth experiment before declining again, indicating significant performance volatility. CGRU maintained relatively high RMSE values ​​across all experiments, indicating that its prediction results generally have the largest square root of error and the lowest prediction accuracy.

[0075] In terms of SMAPE (Symmetric Mean Absolute Percentage Error) performance, a metric that measures prediction accuracy, it compares the magnitude of the error to the average of the actual and predicted values, presenting the result as a percentage. HAQLSTM-CGRU achieved the lowest SMAPE values ​​across all six experiments, indicating the lowest average percentage error in its predictions and the highest and most stable prediction accuracy. The CGRU's SMAPE values ​​remained relatively stable and at a moderate level across all six experiments, slightly higher than those of HAQLSTM-CGRU and QLSTM, but significantly lower than those of LSTM. The QLSTM's SMAPE values ​​were close to those of the CGRU in most experiments, but increased slightly in the fourth experiment and decreased slightly in the sixth, resulting in overall superior performance to the LSTM. The LSTM's SMAPE values ​​fluctuated significantly across experiments and were significantly higher overall than the other three models, reaching particularly high peaks in the second and sixth experiments, indicating a large average percentage error in its predictions and relatively low and unstable prediction accuracy.

[0076] In summary, according to the MAE, RMSE, and SMAPE indicators of each model in the six repeated experiments in Dataset 1, the HAQLSTM-CGRU model showed the best prediction accuracy and stability in these six repeated experiments.

[0077] The experimental results using dataset 2 are as follows: In terms of MAE performance, HAQLSTM-CGRU achieved the lowest MAE values ​​across all six experiments, demonstrating that it consistently maintained the highest prediction accuracy. Its MAE values ​​were relatively stable, with minimal fluctuation. QLSTM's MAE values ​​were lower than those of LSTM and CGRU in most experiments, but higher than those of HAQLSTM-CGRU. Its performance was also relatively stable, but it saw a slight increase in the third experiment, falling short of the hybrid model, before recovering again later, ultimately failing to outperform HAQLSTM-CGRU. LSTM's MAE values ​​fluctuated across experiments, but overall showed a gradual upward trend, reaching the highest MAE value in the sixth experiment, indicating that its prediction error increased in later experiments. CGRU's MAE values ​​were relatively high across all six experiments, with significant fluctuations, indicating that its prediction error was generally larger than the other three models, resulting in relatively low prediction accuracy.

[0078] In terms of RMSE performance, HAQLSTM-CGRU achieved the lowest RMSE values ​​across all six experiments, indicating that its prediction results had the smallest square root error (RMSE) and relatively high and stable prediction accuracy. The RMSE values ​​of QLSTM were lower than those of LSTM and CGRU in most experiments, but higher than those of HAQLSTM-CGRU. QLSTM's performance fluctuated slightly in the fourth and fifth experiments, but remained relatively low overall. The RMSE values ​​of LSTM fluctuated significantly across experiments, reaching their lowest point in the fourth, but increased significantly in the sixth, indicating that the square root of its prediction error increased in later experiments. The RMSE values ​​of CGRU were relatively high across all six experiments, with minimal fluctuations, indicating that its square root of prediction error was generally larger than that of the other three models, resulting in relatively low prediction accuracy.

[0079] In terms of SMAPE performance, HAQLSTM-CGRU achieved the lowest SMAPE values ​​across all six experiments, indicating the lowest average percentage error (APE) and the highest and most stable prediction accuracy. The SMAPE value of QLSTM was lower than that of LSTM and CGRU in most experiments, but higher than that of HAQLSTM-CGRU. Its performance improved in the fifth and sixth experiments, but remained relatively low overall. The SMAPE value of CGRU was relatively stable across all six experiments, remaining at a moderate level, slightly higher than that of HAQLSTM-CGRU and QLSTM, but significantly lower than that of LSTM. The SMAPE value of LSTM fluctuated significantly across experiments, but was significantly higher overall than the other three models, reaching the highest SMAPE value in the fifth experiment. This indicates a large APE and relatively low and unstable prediction accuracy.

[0080] Overall, according to the MAE, RMSE, and SMAPE indicators of the six repeated experiments in Dataset 2, the HAQLSTM-CGRU model showed the best prediction accuracy and stability in these six repeated experiments, significantly outperforming other models.

[0081] Comparative experiments using Datasets 1 and 2 show that the HAQLSTM-CGRU model performs better than other baseline models in processing time series data. The MAE, RMSE, and SMAPE decreases by 24%, 16.95%, and 4.89%, effectively reducing prediction error and improving the model's predictive performance.

[0082] Experiment 2 To explore the impact of the improved grey wolf optimization algorithm (IGWO) on the performance of hybrid model hyperparameter optimization, an ablation experiment was conducted. The goal was to analyze the contribution of each mechanism to the final hybrid model performance, evaluate its importance by removing or replacing it, and observing the changes in the optimization results.

[0083] HAQLSTM-CGRU is selected as the target model, and the experiment is conducted on two datasets, as shown in the attached Figure 5 and attached Figure 6 The following table shows the hyperparameters of the two models on the two datasets: one is the hyperparameter of the baseline model, and the other is the hyperparameter optimized using the IGWO optimization algorithm. MAE, RMSE, and SMAPE are used as the main indicators to evaluate the performance of hyperparameter optimization, and the maximum number of iterations is set to 100.

[0084] As attached Figure 7 and attached Figure 8 As shown in the figure, the evaluation index results of the two models on the two data sets are respectively. It can be seen that the hyperparameters optimized by the IGWO optimization algorithm can enable the hybrid model HAQLSTM-CGRU of this study to perform better when processing weather forecast data, thereby improving the prediction performance of the model and improving the prediction accuracy of the model.

[0085] The above is only an embodiment of the present invention, and the common knowledge such as the specific technical solutions and / or characteristics in the solution are not described in detail here. It should be pointed out that for those skilled in the art, without departing from the technical solution of the present invention, several variations and improvements can be made, which should also be regarded as the scope of protection of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the description can be used to interpret the content of the claims.

Claims

1. A weather forecasting method based on an improved quantum long short-term memory network, characterized in that: The following steps are involved: Collect historical weather data, use the CGRU model to extract spatial features from the weather data, and input the output hidden state sequence into the HAQLSTM model used to predict the target variable. The HAQLSTM model outputs a prediction for the target variable at the next time step. The target variable is one or more weather data items. The CGRU model replaces matrix multiplication in the gated operation with local convolution. The CGRU model network includes a convolutional layer for extracting spatial features of weather data and a gated recurrent unit layer for processing time series data and capturing long-term dependencies. The HAQLSTM model is an improvement on the quantum long short-term memory network model, using parameterized variational quantum circuits and incorporating an attention mechanism and residuals. The HAQLSTM model includes a quantum long short-term memory network, an attention mechanism, and residual connections. The quantum long short-term memory network serves as a temporal modeler, the residual connections add the original input to the final output, and the attention mechanism is used to dynamically weigh the importance of different parts of the input data. The HAQLSTM model sends the input data and the hidden state of the previous time step to the attention mechanism layer. The attention mechanism layer uses a self-attention mechanism to calculate the association weights between the elements of the input sequence. After the attention mechanism processing, four parallel parameterized variational quantum circuits are used to replace the linear transformation layer used to calculate the forget gate, input gate, candidate cell state and output gate in the traditional long short-term memory network; the four parameterized variational quantum circuits all include angle coding and strong entanglement layers, and the angle coding and strong entanglement layers are connected in series.

2. The weather forecasting method based on the improved quantum long short-term memory network according to claim 1 is characterized in that: The convolutional layer applies filters to the input data. Multiple convolutional layers with different filter sizes are used. During the forward propagation phase, each convolutional layer uses an activation function and performs a convolution operation on the output of the previous layer. After each convolutional layer, maximum pooling is used to reduce the spatial dimension of the feature map. The output of the convolutional layer is input into the gated recurrent unit layer. The gated recurrent unit layer structure includes an update gate and a reset gate. The update gate replaces the input gate and forget gate of the long short-term memory network, and the reset gate is used to directly process the previous hidden state.

3. The weather forecasting method based on the improved quantum long short-term memory network according to claim 2 is characterized in that: Use the improved Grey Wolf Optimization algorithm to optimize the hyperparameters of the hybrid model of the CGRU model and the HAQLSTM model; The improved grey wolf optimizer adopts a hybrid initialization strategy, which divides the population initialization into two parts, one half is randomly generated within a given parameter range, and the other half is generated using a learning strategy based on elite confrontation; In elite adversarial learning, the fitness of randomly initialized solutions is first evaluated, and a subset of elite solutions is selected. For the solution to be initialized, an elite solution is randomly selected and its opposite solution is calculated. The generation of the opposite solution combines the calculation of the opposite value of the upper and lower limits and the addition of small random perturbations.

4. The weather forecasting method based on the improved quantum long short-term memory network according to claim 3 is characterized in that: The improved grey wolf optimization algorithm adopts an adaptive weight and leadership mechanism, uses an objective function to evaluate the fitness of each solution, sorts the solutions according to the fitness, and designates the three best solutions as α wolf, β wolf and δ wolf respectively; A dynamic parameter a is introduced, and parameter a decreases linearly from 2 to 0 during the iteration process. When updating the position, the distance between each wolf and α, β, and δ wolves is calculated. Based on these distances, the candidate positions X1, X2, and X3 are calculated. The position of each wolf is updated to the weighted average of X1, X2, and X3, and adaptive weights are assigned to α, β, and δ wolves.

5. The weather forecasting method based on the improved quantum long short-term memory network according to claim 4 is characterized in that: The improved grey wolf optimization algorithm adopts an adversarial jump mechanism, and in the iterative process, the adversarial jump mechanism is applied with decreasing probability; A subset of the population is randomly selected, and for each selected wolf, each parameter is updated with a 50% probability using either true adversarial or elite-guided adversarial methods; true adversarial methods calculate the opposite value of the parameter, while elite-guided adversarial methods move closer to the parameter value corresponding to the α wolf and add a small random perturbation.

6. The weather forecasting method based on the improved quantum long short-term memory network according to claim 5 is characterized in that: The adaptive weights assigned to the α wolf, β wolf and δ wolf are 50%, 30% and 20% respectively.

7. The weather forecasting method based on the improved quantum long short-term memory network according to claim 1 is characterized in that: The HAQLSTM model calculates the hidden state through a quantum circuit, inputs the element-wise product of the current cell state and the output gate into another variational quantum circuit, and obtains the hidden state of the current time step.

8. The weather forecasting method based on the improved quantum long short-term memory network according to claim 1, characterized in that: The historical weather data includes, but is not limited to, average, minimum and maximum temperatures, daily total precipitation, wind direction and speed, mean sea level pressure, wind speed, temperature, visibility, solar radiation, and ultraviolet light.

9. The weather forecasting method based on the improved quantum long short-term memory network according to claim 1, characterized in that: The angle encoding is used to map each component of the classical data into the rotation angle of the rotating gate acting on the corresponding quantum bit; the strong entanglement layer includes a series of single-qubit rotating gates and multi-qubit entanglement gates, which are arranged alternately to introduce quantum entanglement and perform complex quantum operations.

Citation Information

Cited By

  • Ground source heat pump air conditioner load prediction method based on hybrid optimization and deep learning

    CN121389391A

  • Hybrid classical-quantum extreme weather identification method, system and equipment for power system

    CN122262929A