CNN-BiLSTM-MATT time sequence prediction method

Through the optimization of the CNN-BiLSTM-MATT model and IHO algorithm, combined with the multi-head attention mechanism, the problem of insufficient prediction capabilities of complex nonlinear time series by the existing technology is solved, and more efficient and more accurate time series prediction is achieved.

CN119293418APending Publication Date: 2025-01-10FOURTH RES INST OF TELECOMM TECH

Patent Information

Application Number
CN202410699341.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

Existing time series prediction methods have weak predictive capabilities for complex nonlinear data, and machine learning models require manual adjustment of parameters, resulting in strong randomness and large prediction errors.

Method used

The CNN-BiLSTM-MATT model is adopted, combined with the IHO algorithm to optimize hyperparameters, introduce a multi-head attention mechanism, extract features through convolutional neural networks and bidirectional long and short-term memory networks, and use the chaotic adaptive hippo optimization algorithm to reduce randomness and improve the model's Prediction accuracy.

Benefits of technology

It significantly improves the prediction accuracy of complex nonlinear time series data, reduces the number of iterations and loss values, improves the stability and efficiency of the model, and can more effectively extract the intrinsic features of time series data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293418A_ABST
    Figure CN119293418A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a CNN-BiLSTM-MATT time sequence prediction method, which comprises a plurality of feature value inputs and a feature value output. Carrying out data normalization processing; performing normalization processing on the input data, mapping a normalized data set between [-1, 1], and performing reverse normalization processing on the output data after prediction; the hyper-parameters in CNN-BiLSTM-MATT are optimized, the hyper-parameters in CNN-BiLSTM are initialized according to an IHO algorithm, the hyper-parameters comprise the learning rate, the L2 regularization coefficient and the hidden layer number, and the optimal hyper-parameter value is obtained in the iteration process; performing feature extraction: performing convolutional feature extraction by using a convolutional neural network CNN, and taking obtained data features as input of subsequent BiLSTM; and carrying out time sequence analysis. The method overcomes the defects of a current time sequence prediction method. The method can be widely applied to the parameter optimization problem, the convergence degree is improved, and the optimal solution is efficiently found.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a CNN-BiLSTM-MATT time series prediction method. Background Art

[0002] Time series forecasting is an important data analysis technology that helps us predict future values ​​or development trends by analyzing historical data. The main methods include quantitative forecasting methods and machine learning-based forecasting methods. Among them, quantitative forecasting methods include autoregressive integrated moving average (ARIMA) and seasonal time series model (SARIMA). However, there are some conditional restrictions when processing time series in quantitative models, that is, the time series must be stationary. For nonlinear and non-stationary data, the processing effect of quantitative models is poor. Machine learning models have the ability to automatically learn data features and update parameters, and can effectively extract non-stationary nonlinear features in data sets. Common machine learning methods include BP neural network (BPNN), convolutional neural network (CNN), long short-term memory network (LSTM), etc. These models have more advantages and have been widely used because they do not need to provide specific conditions when processing complex nonlinear and non-stationary data. In specific applications for nonlinear time series data, machine learning models can often extract data information more finely and effectively improve the prediction accuracy.

[0003] At present, there are many optimization methods for the application of neural networks in time series prediction, involving various computational optimization and structural optimization methods: the combination of neural networks and fuzzy theory, the combination of CNN and LSTM, the combination of swarm intelligence optimization algorithm and neural networks, etc. The hybrid prediction model is more effective than a single prediction model, and it can better learn the characteristics of time series, thereby achieving the purpose of improving the prediction accuracy. The current research on time series prediction is very rich, including quantitative prediction methods, machine learning-based prediction methods, and hybrid prediction methods. There are still some shortcomings in these methods: first, the quantitative-based prediction model has relatively weak prediction ability for complex nonlinear time series; second, the parameters of most prediction models need to be set manually, and the optimization of network parameters cannot be achieved; finally, time series data has its inherent characteristics, which require more in-depth mining.

[0004] For example, the application with application number 202311513617.9, due to the lack of data dimensionality reduction, may have an adverse effect on the efficiency of the model and the prediction results when the original data has many features. This technology uses BiLSTM and attention mechanism to predict time series data, but does not use relevant technology to optimize the various hyperparameters involved. Manually set hyperparameters will affect the prediction accuracy.

[0005] For example, the application number 202311611340.3 adopts the linear regression method. The particle swarm algorithm in the swarm intelligence optimization algorithm is used to optimize the various weights in the linear regression, thereby improving the prediction performance. It is a quantitative time series prediction model and is suitable for linear time series prediction data. For complex and nonlinear time series data, its prediction accuracy will be greatly reduced.

[0006] In view of the defects and needs of the above-mentioned traditional methods, such as high complexity and low efficiency, a CNN-BiLSTM-MATT time series prediction method is needed. Summary of the invention

[0007] The purpose of the present invention is to provide a CNN-BiLSTM-MATT time series prediction method. The present invention overcomes the shortcomings of current time series prediction methods, especially the weak prediction performance of the prediction model based on measurement for complex nonlinear time series; the machine learning neural network method requires manual adjustment of parameter settings and has strong randomness; and solves the problems of insufficient extraction of intrinsic features of time series data leading to large prediction errors. It can be widely used in parameter optimization problems, improve the degree of convergence, and efficiently find the optimal solution.

[0008] The present invention is implemented in this way. The present invention provides a CNN-BiLSTM-MATT time series prediction method, which is specifically performed in the following steps:

[0009] S1: Input the time series data to be predicted, including multiple feature value inputs and one feature value output;

[0010] S 1.1 : Perform data normalization processing; normalize the input data according to formula (I), map the normalized data set between [-1,1], and denormalize the output data after prediction;

[0011]

[0012] S2: Optimize hyperparameters in CNN-BiLSTM-MATT: Initialize hyperparameters in CNN-BiLSTM according to the IHO algorithm, including learning rate, L2 regularization coefficient, and number of hidden layers, and obtain the optimal hyperparameter values ​​in the iterative process;

[0013] S 2.1 : Set the initial number of iterations according to the number of data features;

[0014] S 2.2: Population initialization, using Logistics-Tent chaotic mapping to initialize the population of the Hippo optimization algorithm HO to enhance the diversity of the initial population and the global search ability of the algorithm;

[0015] S 2.3 : Optimize the Hippo iteration process, introduce adaptive weight coefficient to optimize the random multiplier in the Hippo iteration process, and propose a chaotic adaptive Hippo optimization algorithm (IHO);

[0016] The Logistics-Tent chaotic mapping is used for initialization, and the one-dimensional Logistic system and the Tent chaotic system are integrated into the Logistics-Tent composite chaotic system, as shown in formula (1);

[0017]

[0018] Among them, x n is the nth chaotic number, n is the number of iterations, r is a real number, mod means remainder, when r = 4, the formula is transformed into a Logistic mapping;

[0019] The chaotic sequence generated by equation (1) is transformed into the solution space of the hippo population. The initial position of the hippo population and the position of the predator in the search space are shown in equations (2)-(3);

[0020] x i :x i,j =lb j +x n (ub j -lb j ), i = 1, 2, ..., N; j = 1, 2, ..., m Formula (2)

[0021] Predator: Predator j =lb j +x n (ub j -lb j ), j = 1, 2, ..., m Formula (3)

[0022] Among them, the population matrix is ​​generated by formula (2), as shown in formula (4)-formula (6), where x i represents the position of the i-th candidate solution; r is a random number in the range [0,1]; lb j andub j They represent the lower and upper bounds of the j-th decision variable, respectively; N represents the population size of hippos in the group; m represents the number of decision variables in the problem;

[0023]

[0024] Among them, formula (5) represents the position update of male hippopotamus members in the population in lakes or ponds, represents the position of the male hippopotamus; DH represents the position of the hippopotamus leader, that is, the hippopotamus with the best target value in the current iteration; α represents a random number between [0,1], and the five expressions in the vector h represent five scenarios to enhance the global search capability;

[0025]

[0026] in, is a random vector between [0,1]; r5 is a random number between [0,1]; I1 and I2 are integer random numbers with values ​​of {1,2}; Q1 and Q2 are integer random numbers with values ​​of {0,1}. As shown in equations (7) to (9);

[0027]

[0028] in, describes the position of female or immature hippopotamuses in the population, t represents the current iteration, T represents the maximum number of iterations, and if θ>0.6, it indicates that the immature hippopotamus has become alienated from its mother. i represents the average value of some randomly selected hippos; r6 and r7 are random numbers in the range of [0,1]; if r6>0.5, it means that the young hippo has kept a distance from its mother but is still near the hippo herd, otherwise it has been separated from the hippo herd; h1 and h2 are numbers or vectors randomly selected from formula (6).

[0029] As formula (10)-formula (11);

[0030]

[0031] Among them, equations (10) and (11) describe the male hippopotamus in the population Female hippopotamus or juvenile hippopotamus Location update; F i is the objective function value.

[0032] The second stage is to carry out target defense, as shown in formula (12);

[0033] Predator j represents the position of the predator in the search space (generated by equation (3)); represents the distance from the i-th hippopotamus to the predator; as shown in formula (13);

[0034]

[0035] Hippopotamus according to factor Perform defensive behaviors to protect itself from predators. In formula (13), if This means that the predator is very close to the hippopotamus. In this case, the hippopotamus quickly turns to the predator and moves towards it, causing it to retreat. If the distance is larger, it means that the predator or intruder is greater than the hippo's territory. At this point, the hippo turns towards the predator, but the range of movement is more limited. The intention is to make the predator or intruder aware of its presence within its territory. is the position of the hippopotamus facing the predator; f is a random number that follows a uniform distribution [2,4]; c is a random number that follows a uniform distribution [1,1.5]; d is a random number that follows a uniform distribution [2,3]; g is a random number that follows a uniform distribution [-1,1]; is a 1×m-dimensional random vector, is a random vector with Levy distribution, which is used to account for the sudden change in the predator's position when attacking the hippopotamus. The mathematical model of Levy motion is calculated as shown in equations (14) to (16);

[0036]

[0037] Among them, w and v are random numbers between 0 and 1; i is a constant (i=1.5), Γ is the abbreviation of Gamma function, σ w It is obtained by formula (15);

[0038] According to formula (16), if If the predator escapes, the hippopotamus will return to the group. Significant enhancement was observed in the global search process of the second stage. The first and second stages complement each other and effectively mitigate the risk of falling into local minima.

[0039] Entering the third stage, escape, when the hippo encounters a group of predators or cannot use its defensive behavior to drive away the predator, it tries to move away from the area. Usually, the hippo tries to run to the nearest lake or pond to avoid the harm of the predator. This allows the hippo to find a safe location near the current location. Generate a random location near the current location of the hippo; as shown in formula (17);

[0040]

[0041] The adaptive weight coefficient is introduced to search for the safe position in this stage. The specific expression is as follows:

[0042]

[0043] in, represents the hippopotamus closest to the current hippopotamus, and d represents the adaptive weight coefficient. Based on this, the closest safe position is searched to the hippopotamus position. It is formula (19)-formula (21);

[0044]

[0045]

[0046] When the new position improves the cost function value, it indicates that the hippopotamus has found a safer position near its current position and has changed its position accordingly; in formula (19), is the hippopotamus position searched to find the closest safe position, λ1 is a random vector or number randomly selected from the three scenarios λ in formula (20), represents a random vector of [0,1]; r 13 Represents a random number generated in the range [0,1]; r 12 is a random number that satisfies Gaussian distribution;

[0047] After each iteration of the IHO algorithm, the population is updated according to formula (5-21), and all population members are updated based on stages 1 to 3. During the execution of the algorithm, the best solution of each iteration is continuously tracked and stored. After the entire algorithm is completed, the best candidate is determined as the final solution to the problem.

[0048] According to the above process, the hyperparameters learning rate, L2 regularization coefficient and number of hidden layers in the hybrid neural network model CNN-BiLSTM-MATT are initialized and iteratively optimized. By setting the value range of the solution value and iterating the IHO algorithm, the corresponding RMSE and a set of solutions with the smallest loss value are calculated as the optimal solution, which is used as the hyperparameter setting of the model.

[0049] Further, S3: feature extraction: convolutional feature extraction is performed using a convolutional neural network CNN, and the obtained data features are used as input for subsequent BiLSTM; specifically, the following steps are performed:

[0050] S 3.1 : Perform convolution operation, assuming that the length of the input sequence X is T, the feature dimension is m, the convolution kernel size is k×m, the number of convolution kernels is n, for each convolution kernel i, its weight matrix is ​​wi, and the bias is bi, as shown in formula (22);

[0051] [c i [t] = f i (W i *x t:t+k-1 +b i )] Formula (22)

[0052] Among them, x t:t+k-1 represents the subsequence from t to t+k-1 in the input sequence X, * represents the convolution operation, f i is the activation function. The present invention adopts the ReLU function, c i [t] represents the convolution result of convolution kernel i at position t;

[0053] S 3.2 : Perform pooling operation; as shown in formula (23);

[0054] p i =max(c i ) Formula (23)

[0055] Among them, p i Represents the pooling result of convolution kernel i. These operations are performed independently for each convolution kernel and generate corresponding feature maps;

[0056] S 3.3 : Perform a flattening operation to convert the two-dimensional or multi-dimensional feature map into a one-dimensional vector, so that the output of the convolutional layer can be used as the input of the fully connected layer, as shown in formula (24);

[0057] f(P(C(X)))=reshape(P(C(X)), (N,n×h×w)) Formula (24)

[0058] Among them, the shape of the feature map P(C(X)) obtained by the convolution operation is (N,n,h,w), where N is the number of samples, n is the number of convolution kernels, h is the height of the feature map, w is the width of the feature map, reshape means the operation of reshaping the feature map to the specified shape, f is the flattening function, and the one-dimensional vector (feature sequence) obtained by the flattening operation is input into BiLSTM; so that the sequence features can be further processed.

[0059] S 3.4 :By BiLSTM, time information is processed. LSTM processes input in chronological order and reverse order respectively. The two capture input sequence features from the forward and reverse directions respectively. The two are combined and input into the fully connected layer to obtain the final time series prediction value.

[0060] As formula (25)-formula (31);

[0061] f t =σ(W f ·[h t-1 , x t ]+b f ) Formula (25)

[0062] i t =σ(W ix xt +W ih h t-1 +b i ) Formula (26)

[0063] f t =σ(W fx x t +W fh h t-1 +b f ) Formula (27)

[0064] o t =σ(W ox x t +W oh h t-1 +b o ) Formula (28)

[0065]

[0066] h t =o t ☉tanh(C t ) Formula (31)

[0067] Among them, i t represents the memory gate; f t represents the forget gate; o t represents the output gate; represents the candidate state of the current information; σ represents the sigmoid function; tanh represents the hyperbolic tangent function; represents the element-by-element dot product; C t 、h t Represent the hidden state and unit state of the tth time step respectively;

[0068] The final output of BiLSTM is concatenated from the hidden states in two directions, and the positive and negative bidirectional combinations are combined to obtain the output of BiLSTM as shown in formula (32);

[0069] y t =[h t ; h′ t ] Formula (32)

[0070] S 3.5 : Introduce a multi-head attention mechanism, add the output results of each unit structure in BiLSTM to the multi-head attention mechanism, assign weights, and then change the degree of attention to the output value, such as formula (33)-formula (36);

[0071]

[0072]

[0073] Among them, a i is the input vector, and three linear transformations are performed on the input vector through formula (33) to obtain the query vector Key Vector Value vector h represents the number of attention heads. Then, the scaling dot product method of formula (34) is used to calculate the potential information matrix obtained by a single self-attention mechanism, that is, the attention score of each head, d k represents the dimension of the key vector, and finally the weighted representation obtained by fusing the multi-head outputs of multiple self-attention mechanisms is obtained through equations (35) and (36);

[0074] S 3.6 : Through formula (37), the feature vector processed by the attention mechanism is connected to the output and a nonlinear transformation (ReLU function) is performed. Wfc is the weight matrix, bfc is the bias vector, and Z is the output of the fully connected layer;

[0075] [Z = ReLU (b i +y t )·W fc +b fc ] Formula (37)

[0076] The feature vector processed by the attention mechanism is connected to the output and a nonlinear transformation (ReLU function) is performed. Wfc is the weight matrix, bfc is the bias vector, and Z is the output of the fully connected layer. During the training process, the swarm intelligence optimization algorithm needs to be used to iterate the hyperparameters of the neural network to obtain the hyperparameters that best suit the model.

[0077] Further, S4: perform time series analysis, input the features extracted by CNN into the bidirectional long short-term memory network BiLSTM to learn the time dependency of time series data;

[0078] Furthermore, S5: introduces a multi-head attention mechanism to CNN-BiLSTM and optimizes its output weights, so that the model can more effectively capture the key information in time series data;

[0079] S6: Output the predicted value, perform denormalization, and draw a fitting curve.

[0080] Furthermore, the present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a main controller, the method described in any one of the above is implemented.

[0081] Compared with the prior art, the present invention has the following beneficial effects:

[0082] The present invention overcomes the shortcomings of current time series prediction methods, especially the weak prediction performance of the prediction model based on measurement for complex nonlinear time series; the machine learning neural network method requires manual adjustment of parameter settings and has strong randomness; and solves the problems of insufficient extraction of intrinsic features of time series data leading to large prediction errors. It can be widely used in parameter optimization problems, improve the degree of convergence, and efficiently find the optimal solution.

[0083] The present invention combines the advantages of multiple neural networks and greatly improves the utilization of time series data when processing time series data, fully taps the available information in the data for calculation and iteration, thereby obtaining more accurate prediction results and improving the prediction level.

[0084] The model proposed in the present invention has high accuracy in predicting time series data. Compared with other common models, regression fitting evaluation indicators such as mean absolute error (MAE), mean absolute percentage error (MAPE), mean deviation (MBE), mean square error (MSE), root mean square error (RMSE) and determination coefficient (R2) are at a lower level. It can effectively extract the intrinsic characteristics of time series data and can well improve the problem of weak prediction ability of quantitative-based prediction models for complex nonlinear time series.

[0085] The present invention mixes two chaotic mapping methods and adds an adaptive weight coefficient to optimize the original HO algorithm, which greatly reduces the randomness of the algorithm, reduces the number of iterations required for optimization, and improves the efficiency of the algorithm. The IHO algorithm iterates the three important hyperparameters of each round of the neural network hybrid model to find the optimal hyperparameter, and performs the next round of iteration based on this hyperparameter. The loss value and RMSE of the model are greatly reduced, indicating that it has a good prediction effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. The following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0087] Figure 1 is a flow chart of the method of the present invention;

[0088] Figure 2 is the IHO flow chart of the present invention;

[0089] Figure 3 It is the IHO-CNN-BiLSTM-MATT model flow chart of the present invention;

[0090] Figure 4 is a comparison of the prediction results of the training set of the present invention;

[0091] Figure 5 is a comparison of the prediction results of the test set of the present invention;

[0092] Figure 6 is the training set relative error of the present invention;

[0093] Figure 7 is the test set relative error of the present invention;

[0094] Figure 8 It is a fitting effect diagram of the present invention;

[0095] Fig. 9 It is the RMSE iteration curve graph of the present invention;

[0096] Fig.10 It is the loss value iteration graph of the present invention. DETAILED DESCRIPTION

[0097] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but is only for selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0098] See also Figure 1-Figure 10 The present invention provides a CNN-BiLSTM-MATT time series prediction method.

[0099] In this embodiment, 4858 pieces of transaction data related to the Shanghai Composite Index from January 4, 2004 to January 4, 2024 are selected as samples, and the data are all from Dongfang Finance Network. The sample uses the opening price, highest price, lowest price, and trading volume as feature inputs, and the closing price as the prediction object.

[0100] The number of iterations of the IHO algorithm is set to 5 in the model, the population size, that is, the number of features, is set to 5, and the number of optimization parameters (outputs) is set to 3. The upper and lower bounds of the search space are set according to the characteristics of the learning rate, hidden layer nodes, and regularization coefficient. The learning rate range is [0.001, 0.01], the hidden layer node range is [10, 30], and the regularization coefficient range is [0.0001, 0.1]. The neural network training is set to 100 rounds, and the number of training times per round is 53. After the IHO algorithm iterations, the total number of learnable parameters of the deep learning network is 209.8k, and the number of hidden layers is 14. After the model predicts the sample data, a comparison chart of the predicted value and the true value, a fitting chart of the prediction result, and an iteration chart of the RMSE and loss value are obtained, as shown below: Figure 4-Figure 10 shown.

[0101] In this example, the range of the true value and the predicted value are both between 0 and 6000, the training set fitting root mean square error is 15.2052, the test set root mean square error is 15.782, and the total sample root mean square error is 15.4936; the model has a good fit to the data and a high degree of convergence, indicating that the model can process time series data and make predictions with high prediction accuracy. Figure 6 ,The CNN-BiLSTM-MATT module in the model has a loss value that gradually tends to between 0 and 0.005 after the 2500th training. The loss value is very small, indicating that the data utilization of the input neural network is high; the root mean square error (RMSE) of the predicted value of the training neural network model gradually decreases with the number of training times, and converges to between 0.025 and 0.075 around the 2500th time. The model has good generalization ability.

[0102] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention has various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A CNN-BiLSTM-MATT time series prediction method, characterized by: Please follow the steps below: S1: Input the time series data to be predicted, including multiple feature value inputs and one feature value output; S 1.1 : Perform data normalization processing; The input data is normalized according to formula (I), the normalized data set is mapped between [-1, 1], and the output data is denormalized after prediction; S2: Optimize the hyperparameters in CNN-BiLSTM-MATT, initialize the hyperparameters in CNN-BiLSTM according to the IHO algorithm, including learning rate, L2 regularization coefficient and number of hidden layers, and obtain the optimal hyperparameter values ​​in the iterative process; S 2.1 : Set the initial number of iterations according to the number of data features; S 2.2 : Population initialization, using Logistics-Tent chaotic mapping to initialize the population of the Hippo optimization algorithm HO; S 2.3 : Optimize the Hippo iteration process and introduce adaptive weight coefficients to optimize the random multiplier in the Hippo iteration process; S3: Perform feature extraction: Use convolutional neural network CNN to extract convolutional features, and use the obtained data features as the input of subsequent BiLSTM; S4: Perform time series analysis and input the features extracted by CNN into the bidirectional long short-term memory network BiLSTM to learn the temporal dependency of time series data; S5: Introduce a multi-head attention mechanism to CNN-BiLSTM and optimize its output weights; S6: Output the predicted value, perform denormalization, and draw a fitting curve.

2. A CNN-BiLSTM-MATT time series prediction method according to claim 1, characterized in that: In step S2, the Logistics-Tent chaotic mapping is used for initialization, and the one-dimensional Logistic system and the Tent chaotic system are integrated into a Logistics-Tent composite chaotic system, as shown in formula (1); Among them, x n is the nth chaotic number, n is the number of iterations, r is a real number, mod means remainder, when r = 4, the formula is transformed into a Logistic mapping; S 2.1 : The chaotic sequence generated by equation (1) is transformed into the solution space of the hippo population. The initial position of the hippo population and the position of the predator in the search space are shown in equations (2)-(3); x i : x i,j = lb j + x n (ub j - lb j ), i = 1, 2,......, N; j = 1, 2,......, m Equation (2) Predator:Predator j = lb j + x n (ub j - lb j ),j = 1, 2,..., m Equation (3) Among them, the population matrix is ​​generated by formula (2), as shown in formula (4)-formula (6), where x i represents the position of the i-th candidate solution; r is a random number in the range [0, 1]; lb j andub j They represent the lower and upper bounds of the j-th decision variable, respectively; N represents the population size of hippos in the group; m represents the number of decision variables in the problem; Among them, formula (5) represents the position update of male hippopotamus members in the population in lakes or ponds, represents the position of the male hippopotamus; DH represents the position of the hippopotamus leader, that is, the hippopotamus with the best target value in the current iteration; α represents a random number between [0, 1], and the five expressions in the vector h represent five scenarios to enhance the global search capability; in, is a random vector between [0, 1]; r5 is a random number between [0, 1]; I1 and I2 are integer random numbers with values ​​of {1, 2}; Q1 and Q2 are integer random numbers with values ​​of {0, 1}.

3. A CNN-BiLSTM-MATT time series prediction method according to claim 2, characterized in that: As shown in formula (7)-formula (9); in, describes the position of female or immature hippopotamuses in the population, t represents the current iteration, T represents the maximum number of iterations, and if θ>0.6, it indicates that the immature hippopotamus has become alienated from its mother. i represents the average value of some randomly selected hippos; r6 and r7 are random numbers in the range of [0, 1]; if r6>0.5, it means that the young hippo has kept a distance from its mother but is still near the hippo herd, otherwise it has been separated from the hippo herd; h1 and h2 are numbers or vectors randomly selected from formula (6).

4. A CNN-BiLSTM-MATT time series prediction method according to claim 3, characterized in that: As formula (10)-formula (11); Among them, equations (10) and (11) describe the male hippopotamus in the population Female hippopotamus or juvenile hippopotamus Location update; F i is the objective function value.

5. A CNN-BiLSTM-MATT time series prediction method according to claim 4, characterized in that: The second stage is to carry out target defense, as shown in formula (12); Predator j represents the position of the predator in the search space (generated by equation (3)); represents the distance from the i-th hippopotamus to the predator; as shown in formula (13); Hippopotamus according to factor To protect itself from predators, we can use formula (13) if This indicates that the predator is very close to the hippopotamus, among which, is the position of the hippopotamus facing the predator; f is a random number that follows a uniform distribution [2, 4]; c is a random number that follows a uniform distribution [1, 1.5]; d is a random number that follows a uniform distribution [2, 3]; g is a random number that follows a uniform distribution [-1, 1]; is a 1×m-dimensional random vector, is a random vector with Levy distribution, which is used to account for the sudden change in the predator’s position when attacking the hippopotamus. The mathematical model of Levy motion is calculated as shown in Equations (14) to (16); Where W and v are random numbers between 0 and 1; i is a constant (i=1.5), Γ is the abbreviation of the Gamma function, and σ w It is obtained by formula (15).

6. A CNN-BiLSTM-MATT time series prediction method according to claim 5, characterized in that: Entering the third stage, escaping, the hippopotamus finds a safe position near the current position, and generates a random position near the current position of the hippopotamus; as shown in formula (17); The adaptive weight coefficient is introduced to search for the safe position in this stage. The specific expression is as follows: in, represents the hippopotamus closest to the current hippopotamus, and d represents the adaptive weight coefficient. Based on this, the closest safe position is searched to the hippopotamus position. It is formula (19)-formula (21); When the new position improves the cost function value, it indicates that the hippopotamus has found a safer position near its current position and has changed its position accordingly; in formula (19), is the hippopotamus position searched to find the closest safe position, λ1 is a random vector or number randomly selected from the three scenarios λ in formula (20), represents a random vector of [0, 1]; r 13 Represents a random number generated in the range [0, 1]; r 12 is a random number that satisfies a Gaussian distribution.

7. A CNN-BiLSTM-MATT time series prediction method according to claim 1, characterized in that: In step S3, the following steps are specifically performed: S 3.1 : Perform convolution operation, assuming that the length of the input sequence X is T, the feature dimension is m, the convolution kernel size is k×m, the number of convolution kernels is n, for each convolution kernel i, its weight matrix is ​​wi, and the bias is bi, as shown in formula (22); [c i [t] = f i (W i *x t:t+k-1 +b i )] Formula (22) Among them, x t:t+k-1 represents the subsequence from t to t+k-1 in the input sequence X, * represents the convolution operation, f i is the activation function. The present invention adopts the ReLU function, c i [t] represents the convolution result of convolution kernel i at position t; S 3.2 : Perform pooling operation; as shown in formula (23); p i =max(c i ) Formula (23) Among them, p i Represents the pooling result of convolution kernel i. These operations are performed independently for each convolution kernel and generate corresponding feature maps; S 3.3 : Perform a flattening operation to convert the two-dimensional or multi-dimensional feature map into a one-dimensional vector, so that the output of the convolutional layer can be used as the input of the fully connected layer, as shown in formula (24); f(P(C(X)))=reshape(P(C(X)), (N, n×h×w)) Formula (24) Among them, the shape of the feature map P(C(X)) obtained by the convolution operation is (N, n, h, w), where N is the number of samples, n is the number of convolution kernels, h is the height of the feature map, w is the width of the feature map, reshape means the operation of reshaping the feature map to a specified shape, f is the flattening function, and the one-dimensional vector (feature sequence) obtained by the flattening operation is input into BiLSTM; S 3.4 :By BiLSTM, time information is processed. LSTM processes input in chronological order and reverse order respectively. The two capture input sequence features from the forward and reverse directions respectively. The two are combined and input into the fully connected layer to obtain the final time series prediction value. As formula (25)-formula (31); f t = σ(W f · [h t-1 , x t + b f ) Equation (25) i t = σ(W ix x t + W ih h t-1 + b i ) Equation (26) f t = σ(W fx x t + W fh h t-1 + b f ) Equation (27) o t = σ(W ox x t + W oh h t-1 + b o ) Equation (28) h t =o t ⊙tanh(C t ) Formula (31) Among them, i t represents the memory gate; f t represents the forget gate; o t represents the output gate; represents the candidate state of the current information; σ represents the sigmoid function; tanh represents the hyperbolic tangent function; represents the element-by-element dot product; C t 、h t Represent the hidden state and unit state of the tth time step respectively; The final output of BiLSTM is concatenated from the hidden states in two directions, and the positive and negative bidirectional combinations are combined to obtain the output of BiLSTM as shown in formula (32); y t =[h t ; h′ t ] Formula (32) S 3.5 : Introduce a multi-head attention mechanism, add the output results of each unit structure in BiLSTM into the multi-head attention mechanism, assign weights, and then change the degree of attention to the output value, as shown in formula (33)-formula (36); Among them, a i is the input vector, and three linear transformations are performed on the input vector through formula (33) to obtain the query vector Key Vector Value vector h represents the number of attention heads. Then, the scaling dot product method of formula (34) is used to calculate the potential information matrix obtained by a single self-attention mechanism, that is, the attention score of each head, d k represents the dimension of the key vector, and finally the weighted representation obtained by fusing the multi-head outputs of multiple self-attention mechanisms is obtained through equations (35) and (36); S 3.6 : Through formula (37), the feature vector processed by the attention mechanism is connected to the output and a nonlinear transformation (ReLU function) is performed. Wfc is the weight matrix, bfc is the bias vector, and Z is the output of the fully connected layer; [Z = ReLU(b i + y t ) · W fc + b fc Equation (37) The feature vector processed by the attention mechanism is connected to the output and a nonlinear transformation (ReLU function) is performed. Wfc is the weight matrix, bfc is the bias vector, and Z is the output of the fully connected layer. During the training process, the swarm intelligence optimization algorithm needs to be used to iterate the hyperparameters of the neural network to obtain the hyperparameters that best suit the model.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the main controller, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Time sequence prediction method in combination with attention mechanism

    CN117494898A

  • Time sequence prediction method for weight adjustment based on particle swarm optimization

    CN117709520A

Cited By

  • Space-ground integrated load balancing method based on improved particle swarm and Hereum algorithm

    CN119854219A

  • Space-earth integrated load balancing method based on improved particle swarm and hippopotamus algorithm

    CN119854219B

  • Personal ability and post demand accurate matching recommendation method based on deep learning

    CN120087926A

  • Deep learning-based personal ability and job demand precise matching recommendation method

    CN120087926B

  • Explanatable building energy consumption prediction method and system based on large language model

    CN120124792A