SHAP-HO-GRU interpretable drainage basin flood intelligent forecasting method based on rainfall classification

By using SOM and K-means clustering algorithms in the flood forecasting model for rainfall classification, combined with HO optimization algorithm and SHAP model, the existing flood forecasting model has been solved, and a more efficient and interpretable flood forecasting is achieved.

CN119740693AInactive Publication Date: 2025-04-01TIANJIN UNIV

Patent Information

Application Number
CN202411796576.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing flood forecasting model has low forecast accuracy when dealing with complex watershed conditions, making it difficult to adapt to the characteristics of different types of rainfall, resulting in insufficient overfitting and generalization capabilities.

Method used

The rainfall is classified by using the SOM and K-means two-stage clustering algorithm, combined with the HO optimization algorithm to optimize the parameters of the GRU model, and the explanation of the model input features is provided through the SHAP model.

Benefits of technology

It improves the accuracy and efficiency of flood forecasting in the basin, enhances the interpretability of forecast results, can more accurately identify the characteristics of different types of rainfall, and improves the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740693A_ABST
    Figure CN119740693A_ABST
Patent Text Reader

Abstract

The invention relates to a rainfall classification-based SHAP-HO-GRU interpretable watershed flood intelligent forecasting method, which comprises the following steps of: 1) classifying all rainfall sessions according to the maximum hourly rainfall, the total rainfall, the rainfall peak moment, the rainfall duration proportion and other characteristics of the rainfall sessions by adopting an SOM and K-means two-stage clustering algorithm; 2) dividing different types of rainfall data into a training set and a verification set as model input; using an HO algorithm to optimize hyper-parameters of the GRU model; 3) evaluating the forecasting precision of the flood forecasting model according to indexes such as CSI, NSE and RMSE; and 4) interpreting and analyzing a forecast result of the GRU model through the SHAP model. According to the method, the precision and efficiency of flood forecasting of the drainage basin are improved, the interpretability of the forecasting result is enhanced, technical support is provided for flood management and disaster prevention and reduction decisions, the forecasting precision of the GRU model can be effectively improved, and quantitative analysis and interpretation are carried out on the forecasting result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of flood prevention and disaster reduction, relates to a basin flood forecasting method, and particularly to a SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification. Background Art

[0002] With the intensification of climate change and the complexity of human activities, the uncertainty and extremeness of basin hydrological conditions are becoming increasingly significant, posing a serious threat to people's lives and property. Flood forecasting, as an important non-engineering flood control measure, is one of the key means to reduce flood losses. Its core is the flood forecasting model. How to improve the prediction accuracy of the flood forecasting model is a research hotspot and difficulty in the field of intelligent disaster prevention.

[0003] At present, flood forecasting models are mainly divided into two categories: traditional hydrological models based on physical processes and data-driven "black box" models. By simplifying the evolution law of the basin's hydrological conditions and the physical characteristics of the underlying surface, hydrological models can simulate the evolution of rainfall runoff and floods in the basin under natural and artificial intervention conditions, and are applicable to a variety of environments. However, due to the complex conditions of basin runoff, flood forecasting needs to comprehensively consider multiple factors such as topography, vegetation distribution, meteorological differences, and water system distribution. Traditional hydrological models based on physical mechanisms (such as distributed hydrological models, Xin'anjiang models, HEC-HMS models, etc.) have complex modeling processes, limited formula expression capabilities, difficulty in adapting to hydrological simulations under complex conditions, and low forecast accuracy.

[0004] In recent years, "black box" models such as neural networks have attracted extensive attention from scholars at home and abroad due to their excellent ability to handle complex nonlinear relationships. Neural networks do not need to focus on the physical mechanism of runoff generation and convergence, but build models through data mining and analysis, thereby providing new methods and ideas for improving the accuracy of flood forecasting. In time series tasks such as flood forecasting, commonly used neural network models include RNN, LSTM and gated recurrent unit (GRU). RNN is the most basic recurrent neural network, which processes sequence data by repeatedly using the same weight matrix at each time step to capture temporal dependencies. However, RNN is prone to gradient vanishing or gradient exploding problems when processing long sequences, which makes it difficult to capture long-distance dependencies. LSTM was proposed to solve the gradient vanishing problem of RNN when processing long sequences. LSTM can effectively control the flow of information and maintain long-term dependencies by introducing three mechanisms: input gate, forget gate and output gate. Gated recurrent unit (GRU) is another variant of recurrent neural network (RNN), similar to long short-term memory (LSTM), which can solve the gradient vanishing problem of RNN in long-term memory. In addition, to solve the problem of LSTM model with many parameters and difficult training, GRU merges the forget gate and input gate of LSTM into an update gate, cancels the linear self-update operation of the memory unit, and directly performs linear self-update in the hidden unit through gating. The structure of GRU is similar to RNN and LSTM, but compared with LSTM, it reduces a gating structure, reduces model complexity, improves convergence speed, and significantly reduces the risk of overfitting, while having excellent prediction performance.

[0005] In addition, different types of rainfall (such as light rain, heavy rain, thunderstorms, etc.) have significant differences in intensity, duration, and distribution. If the rainfall is not classified, but all rainfall events are simply divided into training sets and validation sets, the model may not be able to effectively identify the characteristics of different types of rainfall due to overfitting, resulting in poor performance on the validation set. In addition, the uneven distribution of rainfall types may cause the model to focus mainly on rainfall types with a large proportion during training, thereby reducing the ability to identify rare rainfall types. The generalization ability of the model will be limited, and extreme floods cannot be accurately predicted, further increasing the risk of error superposition. Therefore, rainfall classification is the key to improving model performance and practical application effects.

[0006] The K-means algorithm is widely used in flood classification research due to its simplicity, ease of understanding and high computational efficiency. However, the K-means algorithm has problems such as sensitivity to initial values, easy to fall into local optimal solutions, reliance on experience to determine the optimal number of clusters, and sensitivity to "noise" and isolated point data. At the same time, the SOM network, as a competitive learning network, can perform data mapping from high dimensions to low dimensions, extract the main statistical features, and automatically classify according to similarity, but it is insufficient in providing accurate clustering information. The SOM+K-means two-stage clustering algorithm combines the high-precision advantage of K-means when the number of clusters and center points are known with the automatic clustering ability of SOM, and can provide more accurate clustering information. It has broad application prospects in the fields of meteorological forecasting and disaster warning.

[0007] At the same time, parameter optimization is crucial in the process of model construction because it directly affects the performance and prediction accuracy of the model. Reasonable parameter optimization can improve the model's fitting ability and generalization ability, effectively reduce errors, and improve its reliability in actual predictions. Common parameter optimization methods include grid search, random search, gradient descent method, and swarm intelligence optimization algorithm. Among them, grid search is simple and easy to understand, but the calculation is large and time-consuming when the parameters are high-dimensional; although random search reduces the computational cost, it may not cover the entire parameter space, and the results are random; the gradient descent method can quickly approach the local optimal solution and is suitable for high-dimensional data, but it is easy to fall into the local optimum; the intelligent optimization algorithm simulates the behavior of biological groups in nature, uses the information exchange and competition mechanism between individuals, can widely search the parameter space, avoid falling into the local optimum, has good robustness and strong adaptability, and is easy to implement. The Hippopotamus Optimization Algorithm (HO) is a new swarm intelligence optimization algorithm that iteratively updates the position of the hippo population to find the optimal solution by simulating the behavior of hippos in the natural environment (such as position update and defense strategy). The algorithm has strong global search capability and fast convergence, can overcome local optimal problems, and is particularly suitable for processing high-dimensional complex function optimization.

[0008] Finally, in view of the "black box" characteristics of machine learning models, the Shapley additive explanation method (SHAP) is introduced. SHAP is a method based on game theory that aims to evaluate the importance of each feature to the prediction result by calculating the marginal contribution of the model input features to the output results. This can verify the rationality of the features and provide a theoretical basis for the screening of input features. SHAP can explain the results of flood forecasting models from both local (single sample) and global (entire data set) levels to enhance the transparency and interpretability of the prediction results of the "black box" model.

[0009] Therefore, the present invention integrates the SHAP model and HO optimization algorithm into the GRU model, and proposes a SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification. Summary of the invention

[0010] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification. Firstly, a SOM and K-means two-stage clustering algorithm is used to classify all rainfall events according to the characteristics of the maximum hourly rainfall, total rainfall, rainfall peak time and rainfall duration ratio of the rainfall event; then, different types of rainfall data are divided into training sets and verification sets as model input; secondly, the HO algorithm is used to optimize the hyperparameters of the GRU model; then, the forecast accuracy of the flood forecasting model is evaluated according to indicators such as CSI, NSE and RMSE; finally, the forecast results of the GRU model are interpreted and analyzed by the SHAP model; the present invention not only improves the accuracy and efficiency of basin flood forecasting, but also enhances the interpretability of the forecast results, provides technical support for flood management and disaster prevention and mitigation decision-making, can effectively improve the prediction accuracy of the GRU model, and quantitatively analyze and interpret the prediction results.

[0011] The present invention solves the technical problem by the following technical solutions:

[0012] A SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification is proposed. First, the SOM and K-means two-stage clustering algorithms are used to classify rainfall. Then, the HO intelligent algorithm is used to optimize the key parameters of the GRU neural network. The classified rainfall data and the optimized parameters are used as the input of the GRU model for flood prediction. Finally, the SHAP value of each input feature is calculated and sorted based on SHAP, and the marginal contribution of each input feature to the prediction result is deeply analyzed to verify the rationality of the selected features and provide theoretical support for the screening of model input features.

[0013] The steps of the method are:

[0014] S1. Rainfall classification: Collect rainfall and flood data in the study basin, classify all rainfall events using a two-stage clustering algorithm based on SOM and K-means, and divide each category of rainfall into a training set and a validation set, where the training set is used to optimize the parameters of the GRU model, and the validation set is used to test the prediction accuracy of the GRU model;

[0015] S2. Select model input features. The model input features are preliminarily selected through rainfall-flood process analysis and expert experience;

[0016] S3, data preprocessing and normalization: normalize the dimensional data to the range of [0, 1]. After normalizing the rainfall and flood data, use these data to make predictions for the GRU model. After the prediction is completed, restore the results to the original order of magnitude through denormalization to keep consistent with the actual data.

[0017] S4, parameter optimization: The Hippopotamus optimization algorithm HO is used as an optimization tool. The key parameters of the number of hidden layers, the number of neurons in the hidden layer, the number of iterations, and the learning rate are encoded as the position of the hippopotamus. The model parameters are optimized by updating the position of the hippopotamus. The NSE is used as the objective function. The GRU flood forecast output flow sequence generated by the model parameters at the current moment is extracted. Based on this, the objective function value is calculated to evaluate the quality of the parameters. The maximum number of iterations of the HO algorithm is used as the number of cycles. The parameter update and evaluation process is repeated until the objective function result converges, thereby obtaining the parameter group with the best overall fitting performance.

[0018] S5, model training: input the parameters optimized by S3 into the GRU model, and train the model using the dimensionless data processed by S3;

[0019] S6, model prediction: input the normalized validation set into the GRU flood forecasting model trained in S5 to obtain the flood forecasting results;

[0020] S7, accuracy evaluation: The accuracy of the prediction results of the S6 model is evaluated using the correction coefficient CSI, Nash coefficient NSE and root mean square error RMSE;

[0021] S8. Model interpretability analysis: SHAP is used to calculate the SHAP value of each input feature when it is added to the model. The sign represents a positive or negative impact, and the absolute value represents the degree of impact on the prediction result. Based on the calculation results, the importance of each input feature to the prediction result is evaluated to verify the rationality of the selected features and provide theoretical support for the screening of GRU model input features.

[0022] Moreover, the SOM and K-means two-stage clustering algorithm of S1 is specifically as follows: the total rainfall amount, the maximum hourly rainfall and the peak rainfall time are selected as classification indicators, and the SOM+K-means two-stage clustering algorithm is used to classify all rainfall events.

[0023] The first stage: The number of clusters and the center points of each type are obtained by initial clustering of SOM:

[0024] (1) Weight initialization: Let W j (j=1,2,…,p) is the weight vector connecting the input node j to the output node, which is assigned a random number, and the initial number of cycles is t=1;

[0025] (2) For each input pattern X K (K=1,2,…,m):

[0026] 1) Find W j Zhong and X K The connection weight vector W with the minimum distance g ,have:

[0027]

[0028] The distance here is the Euclidean distance. The Euclidean distance of any two n-bit vectors E and F is calculated by the following formula:

[0029]

[0030] 2) Define unit g as the winner and define N g (t) is the neighborhood of the winner, and the connection weight vectors corresponding to each unit in the neighborhood are added to X i Closer, the learning equation is:

[0031]

[0032] w ij =w ij +Δw ij (4)

[0033] Where: η(t) is the learning rate of the tth time, which decreases as the number of training times increases; is the input of the i-th input node of the K-th sample data; w ij is the connection weight between the i-th input node and the j-th output node, where j∈N g (t);

[0034] 3) Repeat step 2) for different training times t, and the network is considered to have converged when the weights are stable;

[0035] 4) After the network converges, the initial clustering of samples is completed according to the responses of the output nodes;

[0036] (3) Output the number of clusters K and cluster center Z;

[0037] Phase 2: Use the cluster number K and cluster center Z output from the first phase as the initial input of the K-means algorithm for iteration:

[0038] (4) Select a convergence condition and use the output of step (3) as the initial input value of the K-means algorithm for iterative calculation until convergence;

[0039] (5) Output clustering information.

[0040] Moreover, the S7 correction coefficient CSI accurate evaluation process is:

[0041] (1) Construction of confusion matrix:

[0042] The confusion matrix is ​​constructed using the model's predictions and actual observations, which consists of the following four parts:

[0043] True Positives (TP): the number of floods that are actually floods and predicted as floods;

[0044] False Positives (FP): The number of floods that are actually non-floods;

[0045] False negatives (FN): the number of cases where there is actually a flood but it is predicted to be non-flood;

[0046] True negatives (TN): the number of cases that are actually not floods and are predicted to be not floods;

[0047] (2) Calculation of CSI

[0048] The CSI is calculated using the following formula. The value range of CSI is [0,1]. The larger the value, the better the prediction effect of the model. CSI = 1 means perfect prediction, and CSI = 0 means completely wrong prediction.

[0049]

[0050] Among them: TP is the number of true positives; FP is the number of false positives; FN is the number of false negatives.

[0051] Moreover, the S8 is specifically: the SHAP value calculation formula is as follows:

[0052]

[0053] Where: represents the SHAP value of prediction feature j; N represents the set of all prediction factors of the input model; |N| represents the number of all prediction features; S represents any subset of the prediction feature set that does not contain prediction feature j; |S| represents the number of features in any subset of the prediction feature set that does not contain prediction feature j; S∪{j} represents any subset of prediction features that contains prediction feature j; f (S∪{j}) (x (S∪{j} ) represents the model prediction result obtained by fitting the prediction feature set S∪{j}; f S (x S ) represents the simulation forecast result obtained by fitting the forecast feature set S; f (S∪{j}) (x (S∪{j}) )-f S (x S ) represents the marginal contribution of factor j to S; The term represents the weight of the sample;

[0054] Assume that the i-th sample is x i , the jth feature of the i-th sample is x ij , the model's predicted value for this sample is y i , the baseline of the entire model, that is, the mean of the target variable of all samples is y base , then the SHAP value obeys the following equation:

[0055] y i =y base +f(x i1 )+f(x i2 )+f(x i3 )+…+f(x ik ) (29)

[0056] Among them, f(x ij ) is x ij SHAP value, f(x i1 ) is the final predicted value y of the first feature in the i-th sample i The contribution value of f(x i1 )>0, it means that the feature improves the prediction value, which is a positive effect; otherwise, it means that the feature value reduces the prediction value, which has a negative effect.

[0057] The advantages and beneficial effects of the present invention are:

[0058] The present invention firstly uses the SOM and K-means two-stage clustering algorithms to classify rainfall, and then applies the HO intelligent algorithm to optimize the key parameters of the GRU neural network, such as the number of hidden layers, the number of neurons, the number of iterations and the learning rate. The classified rainfall data and the optimized parameters are used as the input of the GRU model for flood forecasting. Finally, SHAP is used to calculate the SHAP value of each input feature to evaluate the importance of each input feature to the prediction result. The rationality of the selected input feature is verified according to the size of the SHAP value of each input feature, providing theoretical support for the screening of the model input parameters. Through this comprehensive method, the present invention not only improves the accuracy and efficiency of basin flood forecasting, but also enhances the interpretability of the forecast results, providing technical support for flood management and disaster prevention and mitigation decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 This is a structural diagram of the GRU cycle unit of the present invention;

[0060] Figure 2 is a flow chart of the present invention;

[0061] Figure 3 This is a flow chart of the Hippo optimization algorithm of the present invention;

[0062] Figure 4 This is a flow chart of GRU model parameter optimization in the present invention. DETAILED DESCRIPTION

[0063] The present invention is further described in detail below through specific examples. The following examples are only illustrative and not restrictive, and the protection scope of the present invention cannot be limited thereto.

[0064] like Figure 2 As shown in the figure, a SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification is proposed. Its innovation lies in: firstly, the SOM and K-means two-stage clustering algorithms are used to classify rainfall; then the HO intelligent algorithm is used to optimize the key parameters of the GRU neural network; the classified rainfall data and the optimized parameters are used as the input of the GRU model for flood prediction; finally, the SHAP value of each input feature is calculated and sorted based on SHAP, and the marginal contribution of each input feature to the prediction result is deeply analyzed to verify the rationality of the selected features and provide theoretical support for the screening of model input features;

[0065] The steps of the method are:

[0066] S1. Rainfall classification: Collect rainfall and flood data in the study basin, classify all rainfall events using a two-stage clustering algorithm based on SOM and K-means, and divide each category of rainfall into a training set and a validation set, where the training set is used to optimize the parameters of the GRU model, and the validation set is used to test the prediction accuracy of the GRU model;

[0067] S2. Select model input features. The model input features are preliminarily selected through rainfall-flood process analysis and expert experience;

[0068] S3, data preprocessing and normalization: normalize the dimensional data to the range of [0, 1]. After normalizing the rainfall and flood data, use these data to make predictions for the GRU model. After the prediction is completed, restore the results to the original order of magnitude through denormalization to keep consistent with the actual data.

[0069] (1) Normalization

[0070] The rainfall and flood data have large differences in magnitude. The differences should be eliminated before building the GRU model. Normalization is generally used to convert dimensional data into dimensionless data in the range of [0,1], which is conducive to quickly finding the optimal solution and facilitating data analysis. The rainfall and runoff time series do not involve distance measurement and are relatively concentrated, so they are suitable for the largest minimum normalization method. The specific calculation formula is as follows:

[0071]

[0072] Where: X and X * are the original data and the standardized data respectively; X min and X max are the maximum and minimum values ​​in the original data time series, respectively.

[0073] (2) Denormalization

[0074] After the rainfall and flood data are normalized, they are used for GRU model prediction. The predicted results need to be processed to the original order of magnitude, so the predicted results are denormalized to a magnitude consistent with the actual situation.

[0075] S4, parameter optimization: The Hippopotamus optimization algorithm HO is used as an optimization tool. The key parameters of the number of hidden layers, the number of neurons in the hidden layer, the number of iterations, and the learning rate are encoded as the position of the hippopotamus. The model parameters are optimized by updating the position of the hippopotamus. The NSE is used as the objective function. The GRU flood forecast output flow sequence generated by the model parameters at the current moment is extracted. Based on this, the objective function value is calculated to evaluate the quality of the parameters. The maximum number of iterations of the HO algorithm is used as the number of cycles. The parameter update and evaluation process is repeated until the objective function result converges, thereby obtaining the parameter group with the best overall fitting performance.

[0076] S5, model training: input the parameters optimized by S3 into the GRU model, and train the model using the dimensionless data processed by S3;

[0077] S6, model prediction: input the normalized validation set into the GRU flood forecasting model trained in S5 to obtain the flood forecasting results;

[0078] S7, accuracy evaluation: The accuracy of the prediction results of the S6 model is evaluated using the correction coefficient CSI, Nash coefficient NSE and root mean square error RMSE;

[0079] S8. Model interpretability analysis: SHAP is used to calculate the SHAP value of each input feature when it is added to the model. The sign represents a positive or negative impact, and the absolute value represents the degree of impact on the prediction result. Based on the calculation results, the importance of each input feature to the prediction result is evaluated to verify the rationality of the selected features and provide theoretical support for the screening of GRU model input features.

[0080] The SOM and K-means two-stage clustering algorithm of S1 is specifically as follows: the total rainfall amount, maximum hourly rainfall and rainfall peak time are selected as classification indicators, and the SOM+K-means two-stage clustering algorithm is used to classify all rainfall events.

[0081] The first stage: The number of clusters and the center points of each type are obtained by initial clustering of SOM:

[0082] (1) Weight initialization: Let W j (j=1,2,…,p) is the weight vector connecting the input node j to the output node, which is assigned a random number, and the initial number of cycles is t=1;

[0083] (2) For each input pattern X K (K=1,2,…,m):

[0084] 1) Find W j Zhong and X K The connection weight vector W with the minimum distance g ,have:

[0085]

[0086] The distance here is the Euclidean distance. The Euclidean distance of any two n-bit vectors E and F is calculated by the following formula:

[0087]

[0088] 2) Define unit g as the winner and define N g (t) is the neighborhood of the winner, and the connection weight vectors corresponding to each unit in the neighborhood are added to X i Closer, the learning equation is:

[0089]

[0090] w ij =w ij +Δw ij (4)

[0091] Where: η(t) is the learning rate of the tth time, which decreases as the number of training times increases; is the input of the i-th input node of the K-th sample data; w ij is the connection weight between the i-th input node and the j-th output node, where j∈N g (t);

[0092] 3) Repeat step 2) for different training times t, and the network is considered to have converged when the weights are stable;

[0093] 4) After the network converges, the initial clustering of samples is completed according to the responses of the output nodes;

[0094] (3) Output the number of clusters K and cluster center Z;

[0095] Phase 2: Use the cluster number K and cluster center Z output from the first phase as the initial input of the K-means algorithm for iteration:

[0096] (4) Select a convergence condition and use the output of step (3) as the initial input value of the K-means algorithm for iterative calculation until convergence;

[0097] (5) Output clustering information.

[0098] The GRU model structure includes input layer, hidden layer and output layer. The GRU cycle unit structure is as follows Figure 1 As shown in the figure. The features that affect the training results of the GRU model include the batch size of the training set, the learning rate, and the number of iterations. In order to avoid overfitting during the training process, Dropout is used to randomly generate 0 and 1 values ​​with the same number of nodes through the Bernoulli distribution with a probability of p, and the nodes after the calculation result is multiplied by the input value are shielded. These nodes are then used to process the subsequent neural network, and the propagation of untrained neurons is stopped. The final output model is the average of the neural network after Dropout, which improves the generalization ability of the neural network. Figure 1 The meaning of each parameter is:

[0099] x t : Input information at the current moment; h t-1 : The hidden state at the previous moment. The hidden state acts as the neural network memory, which contains the data information that the node has seen before; Candidate hidden state; r t : reset gate; z t : Update gate; σ: sigmoid function, through which the data can be converted into a value in the range of 0-1; tanh: tanh function, through which the data can be converted into a value in the range of [-1,1].

[0100] The forward propagation formula of the GRU model is as follows:

[0101] z t =σ(W z ·[h t-1 ,x t ]) (5)

[0102] r t =σ(W r ·[h t-1 ,x t ]) (6)

[0103]

[0104] Here, “*” represents matrix multiplication, and “·” represents dot multiplication.

[0105] The S4 is specifically:

[0106] (1) Hippo population initialization

[0107] The initialization phase of HO involves the generation of a random initial solution, using the following formula to generate a vector of decision variables:

[0108] X i,j =b lj +r(b uj -b lj ) i=1,2,…,n; j=1,2,…,m (9)

[0109] Where: X i,j is the position of the i-th candidate solution, j represents the number of current decision variables; r is a random number between [0,1]; b uj 、b lj are the upper and lower bounds of the jth decision variable respectively; n is the population size; m is the number of decision variables in this problem;

[0110] (2) Update of hippopotamus’ position in river or pond

[0111] The mathematical representation of the position of the male hippopotamus members of the group in a lake or pond is:

[0112]

[0113] Where: is the position of the male hippopotamus; y1 is a random number between [0,1]; X Dhippo is the hippopotamus with the best position in the current iteration; h is one of five randomly selected scenes; ~ρ1 and ~ρ2 are integer random numbers, ranging from [0,1]; r1 to r4 are random vectors between [0,1]; r5 is a random number between [0,1]; I1 and I2 are integers between [1,2];

[0114] If T is greater than 0.6, it means that the immature hippopotamus has moved away from the mother hippopotamus. If the random number r6>0.5 at this time, it means that although the immature hippopotamus has left the group, it is still near the population. The following formula describes the position update of male and female or immature hippopotamus in the group:

[0115]

[0116]

[0117] Where: T is the distance between the current iteration number and the maximum iteration number; t is the current iteration number; τ is the maximum iteration number; The position of the immature hippopotamus; G iis the average value of some randomly selected hippos; h1 and h2 are numbers or vectors randomly selected from the five scenarios in the h equation; Ξ is the situation of immature hippos leaving the group, including being near the group or having left the group; r7 is a random number between [0, 1]; F i is the objective function value; is the target value for male hippos; is the target value for female hippos;

[0118] (3) Hippopotamus defending against predators (exploration phase)

[0119] To resist predators, hippos will adopt a defensive strategy of quickly turning towards the predator and making loud calls to prevent the predator from approaching. The position of the predator in the search space is:

[0120]

[0121] Where: r8 is a random vector between [0, 1];

[0122]

[0123] Where: D is the distance between the hippopotamus and the predator. In this process, the hippopotamus adopts Factors of defense, including is the target value of the hippopotamus in the defense exploration stage; when it is much smaller than F i When the predator is close to the hippopotamus, the hippopotamus will quickly turn to the predator to drive it back. If the distance of the predator invading the hippopotamus's territory is greater, the following formula is used:

[0124]

[0125] Where: The pose of a hippopotamus facing a predator; is an XOR operation; ξ is a uniform random number between [2,4]; c is a uniform random number between [1,1.5]; d is a uniform random number between [2,3]; g is a random number between [-1,1]; r9 is a 1×m random vector; RL is a random vector with Lévy distribution, which is used to represent the position of the predator mutation when the hippopotamus is attacked by the predator;

[0126] Lévy's expression is as follows:

[0127]

[0128]

[0129] Where: ω and V are random numbers between [0,1]; θ is a constant value (θ=1.5); σω is the Lévy step length; Γ is the gamma function;

[0130] The final position of the hippopotamus at this stage can be known from the following formula: Represents the target value corresponding to the final position of the hippopotamus. If It means that a certain hippo has been hunted and another hippo will replace it in the herd, or the predator will escape and the hippo will return to the herd;

[0131] The global search capability of the algorithm is significantly enhanced, effectively reducing the risk of falling into the local minimum.

[0132]

[0133] (4) Hippopotamus escape from predator (exploitation stage)

[0134] When the hippopotamus cannot repel the predator, it will try to leave the area. Usually, the hippopotamus tries to run to the nearest safe area to avoid being hurt by the predator. The mathematical model based on the above behavior is as follows. When the newly created position improves the success function, it indicates that the hippopotamus has found a safer position near the current position and moved to the safe position:

[0135]

[0136] Where: are the upper and lower bounds of the current safe position respectively; The location of the hippopotamus being searched for the nearest safe place; 10 is a random number between [0,1]; S1 can be obtained by randomly selecting the three scenarios in the following formula;

[0137]

[0138] Where: r 11 is a random vector between [0,1]; r 12 is a normally distributed random number; r 13 is a random number between [0,1];

[0139] Finally, the position of the optimal population is updated, and its expression is as follows:

[0140]

[0141] Where: is the target value corresponding to the position of the optimal candidate solution.

[0142] By setting the population size, evaluation times, optimization problem dimension, upper and lower limits of each decision variable, and other parameter values ​​of the Hippo algorithm, a multi-objective optimization framework for HO parameters is built. The forward calculation of the GRU model is embedded in the multi-objective optimization framework for HO parameters. The flowchart of the Hippo optimization algorithm is shown in the attached figure. Figure 3 Therefore, the multi-objective optimization flowchart of GRU model parameters is shown in Appendix 4.

[0143] The S7 correction coefficient CSI accurate evaluation process is as follows:

[0144] (1) Construction of confusion matrix:

[0145] The confusion matrix is ​​constructed using the model's predictions and actual observations, which consists of the following four parts:

[0146] True Positives (TP): the number of floods that are actually floods and predicted as floods;

[0147] False Positives (FP): The number of floods that are actually non-floods;

[0148] False negatives (FN): the number of cases where there is actually a flood but it is predicted to be non-flood;

[0149] True negatives (TN): the number of cases that are actually not floods and are predicted to be not floods;

[0150] (2) Calculation of CSI

[0151] The CSI is calculated using the following formula. The value range of CSI is [0,1]. The larger the value, the better the prediction effect of the model. CSI = 1 means perfect prediction, and CSI = 0 means completely wrong prediction.

[0152]

[0153] Among them: TP is the number of true positives; FP is the number of false positives; FN is the number of false negatives.

[0154]

[0155] The specific S8 is: the SHAP value calculation formula is as follows:

[0156]

[0157] Where: represents the SHAP value of prediction feature j; N represents the set of all prediction factors of the input model; |N| represents the number of all prediction features; S represents any subset of the prediction feature set that does not contain prediction feature j; |S| represents the number of features in any subset of the prediction feature set that does not contain prediction feature j; S∪{j} represents any subset of prediction features that contains prediction feature j; f(S∪{j}) (x (S∪{j}) ) represents the model prediction result obtained by fitting the prediction feature set S∪{j}; f S (x S ) represents the simulation forecast result obtained by fitting the forecast feature set S; f (S∪{j}) (x (S∪{j}) )-f S (x S ) represents the marginal contribution of factor j to S; The term represents the weight of the sample;

[0158] Assume that the i-th sample is x i , the jth feature of the i-th sample is x ij , the model's predicted value for this sample is y i , the baseline of the entire model, that is, the mean of the target variable of all samples is y base , then the SHAP value obeys the following equation:

[0159] y i =y base +f(x i1 )+f(x i2 )+f(x i3 )+…+f(x ik ) (29)

[0160] Among them, f(x ij ) is x ij SHAP value, f(x i1 ) is the final predicted value y of the first feature in the i-th sample i The contribution value of f(x i1 )>0, it means that the feature improves the prediction value, which is a positive effect; otherwise, it means that the feature value reduces the prediction value, which has a negative effect.

[0161] Although the embodiments and drawings of the present invention are disclosed for illustrative purposes, those skilled in the art will appreciate that various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the scope of the present invention is not limited to the contents disclosed in the embodiments and drawings.

Claims

1. A SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification, characterized by: Firstly, the SOM and K-means two-stage clustering algorithms are used to classify rainfall. Then, the HO intelligent algorithm is used to optimize the key parameters of the GRU neural network. The classified rainfall data and the optimized parameters are used as the input of the GRU model for flood prediction. Finally, the SHAP value of each input feature is calculated and sorted based on SHAP, and the marginal contribution of each input feature to the prediction result is deeply analyzed to verify the rationality of the selected features and provide theoretical support for the screening of model input features. The steps of the method are: S1. Rainfall classification: Collect rainfall and flood data in the study basin, classify all rainfall events using a two-stage clustering algorithm based on SOM and K-means, and divide each category of rainfall into a training set and a validation set, where the training set is used to optimize the parameters of the GRU model, and the validation set is used to test the prediction accuracy of the GRU model; S2. Select model input features. The model input features are preliminarily selected through rainfall-flood process analysis and expert experience; S3, data preprocessing and normalization: normalize the dimensional data to the range of [0, 1]. After normalizing the rainfall and flood data, use these data to make predictions for the GRU model. After the prediction is completed, restore the results to the original order of magnitude through denormalization to keep consistent with the actual data. S4, parameter optimization: The Hippopotamus optimization algorithm HO is used as an optimization tool. The key parameters of the number of hidden layers, the number of neurons in the hidden layer, the number of iterations, and the learning rate are encoded as the position of the hippopotamus. The model parameters are optimized by updating the position of the hippopotamus. The NSE is used as the objective function. The GRU flood forecast output flow sequence generated by the model parameters at the current moment is extracted. Based on this, the objective function value is calculated to evaluate the quality of the parameters. The maximum number of iterations of the HO algorithm is used as the number of cycles. The parameter update and evaluation process is repeated until the objective function result converges, thereby obtaining the parameter group with the best overall fitting performance. S5, model training: input the parameters optimized by S3 into the GRU model, and train the model using the dimensionless data processed by S3; S6, model prediction: input the normalized validation set into the GRU flood forecasting model trained in S5 to obtain the flood forecasting results; S7, accuracy evaluation: The accuracy of the prediction results of the S6 model is evaluated using the correction coefficient CSI, Nash coefficient NSE and root mean square error RMSE; S8. Model interpretability analysis: SHAP is used to calculate the SHAP value of each input feature when it is added to the model. The sign represents a positive or negative impact, and the absolute value represents the degree of impact on the prediction result. Based on the calculation results, the importance of each input feature to the prediction result is evaluated to verify the rationality of the selected features and provide theoretical support for the screening of GRU model input features.

2. The SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification according to claim 1 is characterized by: The SOM and K-means two-stage clustering algorithm of S1 is specifically as follows: the total rainfall amount, the maximum hourly rainfall and the peak rainfall time are selected as classification indicators, and the SOM+K-means two-stage clustering algorithm is used to classify all rainfall events. The first stage: The number of clusters and the center points of each type are obtained by initial clustering of SOM: (1) Weight initialization: Let W j (j=1,2,…,p) is the weight vector connecting the input node j to the output node, which is assigned a random number, and the initial number of cycles is t=1; (2) For each input pattern X K (K=1,2,…,m): 1) Find W j Zhong and X K The connection weight vector W with the minimum distance g ,have: The distance here is the Euclidean distance. The Euclidean distance of any two n-bit vectors E and F is calculated by the following formula: 2) Define unit g as the winner and define N g (t) is the neighborhood of the winner, and the connection weight vectors corresponding to each unit in the neighborhood are added to X i Closer, the learning equation is: In ij =in ij +Δw ij (4) Where: η(t) is the learning rate of the tth time, which decreases as the number of training times increases; is the input of the i-th input node of the K-th sample data; w ij is the connection weight between the i-th input node and the j-th output node, where j∈N g (t); 3) Repeat step 2) for different training times t, and the network is considered to have converged when the weights are stable; 4) After the network converges, the initial clustering of samples is completed according to the responses of the output nodes; (3) Output the number of clusters K and cluster center Z; Phase 2: Use the cluster number K and cluster center Z output from the first phase as the initial input of the K-means algorithm for iteration: (4) Select a convergence condition and use the output of step (3) as the initial input value of the K-means algorithm for iterative calculation until convergence; (5) Output clustering information.

3. The SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification according to claim 1 is characterized by: The S7 correction coefficient CSI accurate evaluation process is as follows: (1) Construction of confusion matrix: The confusion matrix is ​​constructed using the model's predictions and actual observations, which consists of the following four parts: True Positives (TP): the number of floods that are actually floods and predicted as floods; False Positives (FP): The number of floods that are actually non-floods; False negatives (FN): the number of cases where there is actually a flood but it is predicted to be non-flood; True negatives (TN): the number of cases that are actually not floods and are predicted to be not floods; (2) Calculation of CSI The CSI is calculated using the following formula. The value range of CSI is [0, 1]. The larger the value, the better the prediction effect of the model. CSI = 1 indicates a perfect prediction, and CSI = 0 indicates a completely wrong prediction. Among them: TP is the number of true positives; FP is the number of false positives; FN is the number of false negatives.

4. The SHAP-HO-GRU interpretable basin flood intelligent forecasting method based on rainfall classification according to claim 1 is characterized by: The specific S8 is: the SHAP value calculation formula is as follows: Where: represents the SHAP value of prediction feature j; N represents the set of all prediction factors of the input model; |N| represents the number of all prediction features; S represents any subset of the prediction feature set that does not contain prediction feature j; |S| represents the number of features in any subset of the prediction feature set that does not contain prediction feature j; S∪{j} represents any subset of prediction features that contains prediction feature j; f (S∪{j}) (x (S∪{j}) ) represents the model prediction result obtained by fitting the prediction feature set S∪{j}; f S (x S ) represents the simulation forecast result obtained by fitting the forecast feature set S; f (S∪{j}) (x (S∪{j}) )-f S (x S ) represents the marginal contribution of factor j to S; The term represents the weight of the sample; Assume that the i-th sample is x i , the jth feature of the i-th sample is x ij , the model's predicted value for this sample is y i , the baseline of the entire model, that is, the mean of the target variable of all samples is y base , then the SHAP value obeys the following equation: y i =y base +f(x i1 )+f(x i2 )+f(x i3 )+…+f(x ik ) (29) Among them, f(x ij ) is x ij SHAP value, f(x i1 ) is the final predicted value y of the first feature in the i-th sample i The contribution value of f(x i1 )>0, it means that the feature improves the prediction value, which is a positive effect; conversely, it means that the feature value reduces the prediction value, which has a negative effect.

Citation Information

Patent Citations

  • Flood forecasting model parameter multi-objective optimization method based on long short-term memory network and NSGA-II

    CN113887787A

  • Neural network drainage basin rainfall runoff forecasting method and system considering initial loss

    CN115860165A

  • Graded intelligent flood forecasting method based on AE-RCNN

    CN117034060A

  • Interpretable CNN-LSTM-based drainage basin flood simulation method

    CN118798064A

  • Explanatable cascade hydropower station output prediction method

    CN118886562A

Cited By

  • Flotation whole process bottleneck technology identification method and system

    CN120885342A

  • Explanatable photovoltaic power ultra-short-term prediction method and system

    CN122393923A