Medium- and long-term runoff forecasting method and system based on Seq2Seq model
Processing historical runoff data through the Seq2Seq model achieves accuracy and real-time performance in mid- and long-term runoff forecasts, solves the problems of traditional models with many parameters and short forecasting processes, provides real-time flood forecasting and dispatching functions, and improves runoff forecasts at hydrological stations. ability.
Patent Information
- Application Number
- CN202210365992.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-08
AI Technical Summary
In the existing technology, domestic runoff forecast models rely on traditional physical hydrological models, which have many parameters and rely on experience for tuning. In addition, rainfall data sets have large errors, making it difficult to obtain accurate mid- and long-term runoff forecasts, and the existing software forecast process is too short. Lack of flood peak and flood volume forecasting functions.
The medium and long-term runoff forecasting method based on the Seq2Seq model is adopted. By obtaining and processing historical runoff data, the Seq2Seq neural network is used for medium and long-term runoff forecasting, reducing hardware and software development costs, achieving real-time medium and long-term runoff forecasting, simulating water level processes, and providing flood forecasting. and scheduling.
It improves the accuracy and reliability of runoff forecasting, reduces hardware and software costs, realizes flood peak and flood volume forecasting in medium and long-term forecasting, solves the problem that the forecasting process in the existing technology is too short, and provides real-time flood forecasting and dispatching functions. .
Smart Images

Figure CN114692981B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a medium- and long-term runoff forecasting method and system based on a Seq2Seq model, belonging to the technical field of hydrological forecasting. Background Art
[0002] The runoff forecast model is a complex nonlinear time series problem, which plays an extremely important role in the real-time operation and dispatch of important rivers. In recent decades, researchers have been developing physical and machine models to use rainfall data sets to predict future runoff, but the domestic public rainfall data sets have large errors and complex data processing. Accurate rainfall, evaporation and other hydrological data sets related to runoff are owned by a specific unit and are difficult to obtain. In addition, domestic research on runoff forecasting is mostly focused on the Yangtze River Basin, while research on runoff forecasting in the Yellow River Basin is mostly focused on traditional physical hydrological models, such as the Sanshuiyuan Xin'anjiang Model, Muskingum Flood Evolution Algorithm and Rainfall-Runoff Empirical Correlation Method. These traditional hydrological forecasting models have many parameters, and model tuning is mostly based on experience. Summary of the invention
[0003] Purpose of the invention: In view of the problems and shortcomings in the prior art, the present invention provides a medium- and long-term runoff forecasting method and system based on the Seq2Seq model to improve the accuracy of runoff forecasting in the watershed of a hydrological station.
[0004] (1) The medium- and long-term runoff forecasting method of the present invention can perform real-time medium- and long-term runoff forecasting by only measuring the runoff change process, thereby greatly reducing the hardware and infrastructure costs required for the use of the runoff forecasting system.
[0005] (2) The medium- and long-term runoff forecasting method of the present invention can deduce the parameters of the runoff forecasting method by using only the measured historical runoff data that is representative, reliable, and consistent. In addition, the software development cost of the runoff forecasting method is low and the time is short, thus solving the bottleneck limitation of the promotion of the runoff forecasting method.
[0006] (3) The medium- and long-term runoff forecasting method of the present invention presents a real-time runoff forecasting process in the medium- and long-term runoff forecasting, which is conducive to accurately estimating the flood peak, flood volume, and flood process of the flood. The water level process of the hydrological station can be simulated during the forecasting process, and the user can realize the medium- and long-term runoff forecasting and scheduling including real-time flood forecasting, thereby solving the problem that the forecasting process of most current runoff forecasting software is too short and the medium- and long-term forecasting function lacks flood peak and flood volume forecasting.
[0007] Technical solution: A medium- and long-term runoff forecasting method based on Seq2Seq model, comprising the following steps:
[0008] Step 1, obtain the daily average historical runoff data of the hydrological station to be forecasted and perform data preprocessing. If the daily average runoff data is missing, the daily average runoff data needs to be Lagrange quadratic difference; the daily average runoff data without missing data is first Min-Max standardized, and then Box-Cox transformed. Because the data we obtain is the daily average runoff data, the daily average runoff data will be copied; the monthly average runoff data is obtained by accumulating the daily average runoff data for each month and then obtaining the monthly average runoff data, and the monthly average runoff data constitutes the monthly average runoff data; the seasonal average runoff data is obtained by accumulating the monthly average runoff data for each quarter to obtain the quarterly average runoff data, and the average runoff data of each quarter is combined to become the seasonal average runoff data; the annual average runoff data is obtained by accumulating the seasonal average runoff data for each year to obtain the annual average runoff data, and the annual average runoff data is combined to become the annual average runoff data. The processed daily average runoff data is installed in the above steps to organize it into four groups of runoff data: daily average, monthly average, seasonal average and annual average.
[0009] Step 2, 70% of the four groups of runoff data of daily average, monthly average, seasonal average and annual average are used as training data sets, and the remaining 30% are used as test data sets. The performance results of the training and test data of the Seq2Seq model are used to select the input time step, batch size and number of hidden layer neurons that make the Seq2Seq model runoff forecasting accuracy the highest as the input time step, batch size and number of hidden layer neurons of the model. Finally, the trained model is encapsulated to obtain four runoff forecast models, namely the daily average runoff forecast model, the monthly average runoff forecast model, the seasonal average runoff forecast model and the annual average runoff forecast model.
[0010] Step 3, select the appropriate forecast model according to the prompts, perform arithmetic weighted coupling based on the prediction results of each forecast model to obtain the final runoff forecast result, and perform Box-Cox inverse transformation and Min-Max inverse standardization on the forecast result. If daily average runoff forecast is performed, the four runoff forecast models are arithmetic weighted coupled to obtain the final runoff forecast result, and the forecast result is Box-Cox inverse transformation and Min-Max inverse standardization; if monthly average runoff forecast is performed, the monthly average, seasonal average and annual average runoff forecast models are arithmetic weighted coupled to obtain the final runoff forecast result, and the forecast result is Box-Cox inverse transformation and Min-Max inverse standardization, and so on.
[0011] A medium- and long-term runoff forecasting system based on Seq2Seq model is mainly divided into data preprocessing layer, model construction, training, parameter adjustment, encapsulation layer, and result output layer.
[0012] Data preprocessing layer: Get the daily average historical runoff data of the hydrological station to be forecasted, and observe whether the daily average runoff data provided by the observation station is continuous. If there is data missing, perform Lagrange quadratic difference on the daily average runoff data through the Lagrange difference formula to obtain a continuous daily average runoff data. Then, the continuous daily average runoff data is standardized by Min-Max, and finally the Min-Max standardized daily average runoff data is Box-Cox transformed. The data we obtain is the daily average runoff data, so the daily average runoff data will be copied; the monthly average runoff data is obtained by accumulating the daily average runoff data every month and then obtaining the monthly average runoff data, and the monthly average runoff data constitutes the monthly average runoff data; the seasonal average runoff data is obtained by accumulating the monthly average runoff data every quarter to obtain the quarterly average runoff data, and the average runoff data of each quarter is combined to become the seasonal average runoff data; the annual average runoff data is obtained by accumulating the seasonal average runoff data every year to obtain the annual average runoff data, and the annual average runoff data is combined to become the annual average runoff data. The processed daily average runoff data is installed in the above steps to organize it into four groups of runoff data: daily average, monthly average, seasonal average, and annual average, and the final output result of the data preprocessing layer is obtained.
[0013] Model construction, training, parameter adjustment, and packaging layer: The four groups of runoff data (daily average, monthly average, seasonal average, and annual average) are divided into training data and test data. The input time step, batch size, and number of hidden layer neurons that make the model runoff forecasting most accurate are selected based on the performance results of the model training and test data as model parameters for setting. Finally, the trained model is packaged to obtain the daily, monthly, seasonal, and annual runoff forecasting models.
[0014] Result output layer: Select the encapsulated model, perform arithmetic weighted coupling based on the prediction results of each encapsulated model to obtain the final runoff forecast result, perform Box-Cox inverse transformation and Min-Max denormalization on the forecast result, and output the forecast result.
[0015] Model construction: The preprocessed data is divided into training set data and test set data. The torch.nn.GRU neural network function in the pytorch neural network framework is used to build a Seq2Seq neural network model with 1 hidden layer Encoder layer and 1 hidden layer Decoder layer. The built model is trained and learned on the training set according to the preset parameters and the model parameters are updated. The trained model is converted into a test model through the eval function, and the test set is tested according to the parameters trained on the training set. The training parameters of the Seq2Seq neural network model include: 200 as the maximum number of training times, 0.01 as the learning coefficient and target error, the activation functions of the hidden layer and the output layer are both built-in activation functions, the output function uses the torch.nn.Linear neural network function, and the results are directly output. MSELoss is also used as the loss function, and the Adam optimization algorithm is the training optimization algorithm.
[0016] Model training: The built model is trained and learned on samples according to the preset parameters and the model parameters are updated. The trained model is converted into a test model through the eval function, the test set is tested according to the parameters trained in the training set, and the model is evaluated on the test results.
[0017] Model parameter adjustment: The number of neurons m in the model hidden layer is determined by trial and error, taking different values in the interval (32, 64, 128, 256, 512), and the number of neurons that minimizes the Nash efficiency coefficient (NSE) of the regular sample set is selected as the optimal number of neurons in the hidden layer. Different combinations of pre-selected prediction factors are used as the input layer of the Seq2Seq runoff prediction model, so the input layer elements of the Seq2Seq runoff prediction model are determined by the combination of pre-selected prediction factors. The prediction performance of the model when different numbers of prediction factors are selected is analyzed by taking different NSE values obtained from the number of hidden layer neurons m.
[0018] Model packaging: The trained and parameter-adjusted model is packaged, and the model training parameters are saved for subsequent runoff forecasting.
[0019] Result output layer:
[0020] When making daily average runoff forecast, four runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if monthly average runoff forecast is made, monthly average, seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if seasonal average runoff forecast is made, seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if annual average runoff forecast is made, the forecast result obtained by the annual average runoff forecast model is the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output.
[0021] A computer-readable storage medium stores a computer program for executing the medium- and long-term runoff forecasting method based on the Seq2Seq model as described above.
[0022] Beneficial effects: Compared with the prior art, the medium- and long-term runoff forecasting method based on the Seq2Seq model provided by the present invention has the following advantages:
[0023] 1) The principle is clear, the operation is convenient, and it has high practical value.
[0024] 2) Based on the entropy weight method, the forecast results of various forecast models were combined and corrected, and the historical runoff forecast data and the current forecast data were also combined and corrected. The forecast performance advantages of multiple models can be comprehensively utilized, the forecast performance of different forecast models can be explored, and the accuracy of reservoir basin runoff forecast can be effectively improved, thereby providing the necessary data basis for the optimized scheduling of reservoirs. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the architecture of an embodiment of the present invention;
[0026] Figure 2 A schematic diagram of a data preprocessing process according to an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of the relationship between the model frameworks of an embodiment of the present invention;
[0028] Figure 4 A schematic diagram of the result output process of an embodiment of the present invention;
[0029] Figure 5 This is a GRU-Seq2Seq model framework diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.
[0031] The medium- and long-term runoff forecasting method based on the Seq2Seq model is characterized by comprising:
[0032] The first step is to obtain the daily average historical runoff data of the hydrological station to be forecasted and perform data preprocessing. If the daily average runoff data is missing, the daily average runoff data needs to be Lagrange quadratic difference; the daily average runoff data without missing data is first Min-Max standardized, and then Box-Cox transformed. Because the data we obtain is the daily average runoff data, the daily average runoff data will be copied; the monthly average runoff data is obtained by accumulating the daily average runoff data for each month and then obtaining the monthly average runoff data, and the monthly average runoff data constitutes the monthly average runoff data; the seasonal average runoff data is obtained by accumulating the monthly average runoff data for each quarter to obtain the quarterly average runoff data, and the average runoff data of each quarter is combined to become the seasonal average runoff data; the annual average runoff data is obtained by accumulating the seasonal average runoff data for each year to obtain the annual average runoff data, and the annual average runoff data is combined to become the annual average runoff data. The processed daily average runoff data is installed in the above steps to organize it into four groups of runoff data: daily average, monthly average, seasonal average and annual average.
[0033] In the second step, 70% of the four groups of runoff data (daily average, monthly average, seasonal average and annual average) are used as training data, and the remaining 30% are used as test data. The performance results of the model training and test data are used to tune the three parameters of the model: input time step, batch size and number of hidden layer neurons. Finally, the trained model is encapsulated to obtain the daily, monthly, seasonal and annual average runoff forecast models.
[0034] Step 3: Select the appropriate package model according to the prompts, perform arithmetic weighted coupling based on the prediction results of each package model to obtain the final runoff forecast result, and perform Box-Cox inverse transformation and Min-Max inverse standardization on the forecast result. If daily average runoff forecast is performed, the four runoff forecast models are arithmetic weighted coupled to obtain the final runoff forecast result, and the forecast result is Box-Cox inverse transformation and Min-Max inverse standardization; if monthly average runoff forecast is performed, the monthly average, seasonal average and annual average runoff forecast models are arithmetic weighted coupled to obtain the final runoff forecast result, and the forecast result is Box-Cox inverse transformation and Min-Max inverse standardization, and so on.
[0035] If there is a small amount of missing in the obtained daily average runoff data, the Lagrange quadratic difference polynomial will be used to interpolate the daily average runoff data, which can reduce the loss of information on the change pattern of the daily average runoff data. The Lagrange quadratic difference polynomial formula is:
[0036] L2(x)=y0l0(x)+y1l1(x)+y2l2(x)
[0037]
[0038]
[0039]
[0040] The value of the missing runoff data is determined by the runoff data of the three days before the missing daily runoff data, and the obtained value is filled into the daily runoff data. In the formula, x represents the sequence number of the missing daily runoff data in the daily runoff time series to be interpolated, x0, x1, x2 represent the 1st, 2nd, and 3rd sequence numbers before the missing daily runoff data sequence number in the daily runoff time series, y0, y1, y2 represent the daily runoff values under the sequence numbers of the daily runoff data x0, x1, and x2, respectively, and L2(x) represents the interpolated value of the missing daily runoff. Then the daily runoff data after the difference is Min-Max standardized, and the formula is:
[0041]
[0042] The data normalized by Min-Max becomes a number between 0 and 1, where x i represents the daily average runoff data without Min-Max transformation, x j Represents the daily average runoff data that needs to be transformed into Min-Max, y i represents the daily average runoff data after Min-Max transformation. Then the data after Min-Max standardization is transformed into Box-Cox, and the formula is:
[0043]
[0044] Where x i represents the daily average runoff data without Box-Cox transformation, y i represents the daily average runoff data after Box-Cox transformation, and λ is the transformation parameter, which is obtained by the maximum likelihood method.
[0045] like Figure 1As shown in the figure, the medium- and long-term runoff forecasting system based on the Seq2Seq model is mainly divided into a data preprocessing layer, a model building, training, parameter adjustment, encapsulation layer, and a result output layer.
[0046] Data preprocessing layer: Get the daily average historical runoff data of the hydrological station to be forecasted, and observe whether the daily average runoff data provided by the observation station is continuous. If there is data missing, perform Lagrange quadratic difference on the daily average runoff data through the Lagrange difference formula to reduce the loss of information on the change law of the daily average runoff data. The Lagrange quadratic difference polynomial formula is:
[0047] L2(x)=y0l0(x)+y1l1(x)+y2l2(x)
[0048]
[0049]
[0050]
[0051] The value of the missing runoff data is determined by the runoff data of the three days before the missing daily runoff data, and the obtained value is filled into the daily runoff data to obtain a continuous daily runoff data. In the formula, x represents the sequence number of the missing daily runoff data in the daily runoff time series to be interpolated, x0, x1, x2 represent the 1st, 2nd, and 3rd sequence numbers before the missing daily runoff data sequence number in the daily runoff time series, y0, y1, y2 represent the daily runoff values under the sequence numbers of the daily runoff data x0, x1, and x2, respectively, and L2(x) represents the interpolated value of the missing daily runoff.
[0052] Then the continuous daily average runoff data is normalized by Min-Max, and the formula is:
[0053]
[0054] Scale the daily average runoff data to between 0 and 1, where x i represents the daily average runoff data without Min-Max transformation, x j Represents the daily average runoff data that needs to be transformed into Min-Max, y i represents the daily average runoff data after Min-Max transformation. Finally, the daily average runoff data after Min-Max standardization are subjected to Box-Cox transformation, and the formula is:
[0055]
[0056] The final output result of the data preprocessing layer is obtained. irepresents the daily average runoff data without Box-Cox transformation, y i represents the daily average runoff data after Box-Cox transformation, and λ is the transformation parameter, which is obtained by the maximum likelihood method.
[0057] The values of the hydrological stations are calculated through the existing historical runoff data, so that the data can be normalized while ensuring that the original sequence information is not lost. The linearity, normality, homogeneity of variance and independence of the sequence data are significantly improved, the probability of spurious regression is reduced, and the correlation between data is improved.
[0058] Model building, training, parameter adjustment, and encapsulation layers:
[0059] (1) Model construction: Use the torch.nn.GRU neural network function in the pytorch neural network framework to build a Seq2Seq neural network model with one hidden layer, one hidden layer, one encoder layer, and one hidden layer, one decoder layer. Train the built model according to the preset parameters and update the model parameters. Convert the trained model to a test model through the eval function, and test the test set according to the parameters trained in the training set. The training parameters of the Seq2Seq neural network model include: 200 as the maximum number of training times, 0.01 as the learning coefficient and target error, the activation functions of the hidden layer and the output layer are both built-in activation functions, the output function is the torch.nn.Linear neural network function, and the results are directly output. MSELoss is also used as the loss function, and the Adam optimization algorithm is the training optimization algorithm.
[0060] (2) Model training: The built model is trained and learned according to the preset parameters and the model parameters are updated. The trained model is converted into a test model through the eval function. The test set is tested according to the parameters trained by the training set, and the test results are evaluated. Since the acquired data is the daily average runoff data, the daily average runoff data will be copied; the monthly average runoff data is obtained by accumulating the daily average runoff data for each month and then obtaining the monthly average runoff data, and the monthly average runoff data constitutes the monthly average runoff data; the seasonal average runoff data is obtained by accumulating the monthly average runoff data for each quarter to obtain the quarterly average runoff data, and the average runoff data of each quarter is combined to become the seasonal average runoff data; the annual average runoff data is obtained by accumulating the seasonal average runoff data for each year to obtain the annual average runoff data, and the annual average runoff data is combined to become the annual average runoff data. The four groups of runoff data are used as the input data of the Seq2Seq model, and the data are divided into 70% training data and 30% test data according to the groups. The performance results of the model training and test data are used to adjust the model input time step, batch size and number of hidden layer neurons. Finally, the trained model is encapsulated to obtain the daily, monthly, seasonal and annual runoff forecast models.
[0061] (3) Model parameter adjustment: The number of neurons m in the model hidden layer is determined by trial and error, taking different values in the interval (32, 64, 128, 256, 512), and the number of neurons that minimizes the Nash efficiency coefficient (NSE) of the regular sample set is selected as the optimal number of neurons in the hidden layer. Different combinations of pre-selected prediction factors are used as the input layer of the Seq2Seq runoff prediction model, so the input layer elements of the Seq2Seq runoff prediction model are determined by the combination of pre-selected prediction factors. The prediction performance of the model when different numbers of prediction factors are selected is analyzed by taking different NSE values of the number of hidden layer neurons m.
[0062] (4) Model packaging: The trained and parameter-adjusted model is packaged and the model training parameters are saved for subsequent runoff forecasting.
[0063] Result output layer:
[0064] When making daily average runoff forecast, four runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if monthly average runoff forecast is made, monthly average, seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if seasonal average runoff forecast is made, seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if annual average runoff forecast is made, the forecast result obtained by the annual average runoff forecast model is the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output.
[0065] Obviously, those skilled in the art should understand that the various steps of the medium- and long-term runoff forecasting method based on the Seq2Seq model or the various modules of the medium- and long-term runoff forecasting system based on the Seq2Seq model of the above-mentioned embodiment of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Optionally, they can be implemented with program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
Claims
1. A medium- and long-term runoff forecasting method based on Seq2Seq model, characterized in that: The steps include: Step 1: Obtain the daily average historical runoff data of the hydrological station to be forecasted and perform data preprocessing; first perform Min-Max standardization on the daily average runoff data without missing data, then perform Box-Cox transformation, and organize the processed data into four groups according to daily average, monthly average, seasonal average and annual average; Step 2, the four groups of runoff data of daily average, monthly average, seasonal average and annual average are divided into training data and test data respectively, and the input time step, batch size and number of hidden layer neurons that make the Seq2Seq model runoff forecasting accuracy the highest are selected as the input time step, batch size and number of hidden layer neurons of the model by using the performance results of the training and test data of the Seq2Seq model; finally, the trained model is encapsulated to obtain four runoff forecast models, namely, the daily average runoff forecasting model, the monthly average runoff forecasting model, the seasonal average runoff forecasting model and the annual average runoff forecasting model; Step 3, select the forecast model, perform arithmetic weighted coupling based on the forecast results of each forecast model to obtain the final runoff forecast result, perform Box-Cox inverse transformation and Min-Max inverse standardization on the forecast result, and output the forecast result.
2. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1 is characterized in that: In step 3, if a daily average runoff forecast is performed, four runoff forecast models are arithmetically weighted coupled to obtain a final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if a monthly average runoff forecast is performed, the monthly average, seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain a final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if a seasonal average runoff forecast is performed, the seasonal average and annual average runoff forecast models are arithmetically weighted coupled to obtain a final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output; if an annual average runoff forecast is performed, the forecast result obtained by the annual average runoff forecast model is the final runoff forecast result, the forecast result is subjected to Box-Cox inverse transformation and Min-Max inverse standardization, and the forecast result is output.
3. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1, characterized in that: In the step 1, the daily average historical runoff data of the hydrological station to be predicted is obtained and the data is preprocessed. If the daily average runoff data is missing, the daily average runoff data needs to be Lagrangian quadratic difference; The Lagrange quadratic difference polynomial formula is: L2(x)=y0l0(x)+y1l1(x)+y2l2(x) The value of the missing runoff data is determined by the runoff data of the three days before the missing daily runoff data, and the obtained value is filled into the daily runoff data to obtain a continuous daily runoff data; where x represents the sequence number of the missing daily runoff data in the daily runoff time series to be interpolated, x0, x1, x2 represent the 1st, 2nd, and 3rd sequence numbers before the missing daily runoff data sequence number in the daily runoff time series, y0, y1, y2 represent the daily runoff values under the sequence numbers of the daily runoff data x0, x1, and x2, respectively, and L2(x) represents the interpolated value of the missing daily runoff.
4. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1, characterized in that: In the step 1, the continuous daily average runoff data is first subjected to Min-Max standardization and then to Box-Cox transformation; The Min-Max normalization formula is: The daily average runoff data is converted into a number between 0 and 1, where x i represents the daily average runoff data without Min-Max transformation, x i Represents the daily average runoff data that needs to be transformed into Min-Max, y i represents the daily average runoff data after Min-Max transformation; finally, the daily average runoff data after Min-Max standardization are subjected to Box-Cox transformation, and the formula is: Get the final output result of the data preprocessing layer; where x i represents the daily average runoff data without Box-Cox transformation, y i represents the daily average runoff data after Box-Cox transformation, and λ is the transformation parameter, which is obtained by the maximum likelihood method.
5. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1, characterized in that: In the step 2, 70% of the four groups of runoff data, namely, daily average runoff data, monthly average runoff data, seasonal average runoff data and annual average runoff data, are used as training data, and the remaining 30% are used as test data.
6. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1, characterized in that: In step 2, the torch.nn.GRU neural network function in the pytorch neural network framework is used to build a Seq2Seq neural network model with one hidden layer, an Encoder layer, and one hidden layer, a Decoder layer. The built model is trained and learned on the training data according to preset parameters and the model parameters are updated. The trained model is converted into a test model through the eval function, and the test set is tested according to the parameters trained in the training set.
7. The medium- and long-term runoff forecasting method based on Seq2Seq model according to claim 1, characterized in that: Get the daily average runoff data and make a copy of the daily average runoff data. The monthly average runoff data is obtained by accumulating the daily average runoff data every month and then obtaining the monthly average runoff data. The monthly average runoff data constitutes the monthly average runoff data. Similarly, the seasonal average runoff data is obtained by accumulating the monthly average runoff data every quarter to obtain the quarterly average runoff data. The average runoff data of each quarter is combined to become the seasonal average runoff data. The annual average runoff data is obtained by accumulating the seasonal average runoff data every year. The annual average runoff data is combined to become the annual average runoff data.
8. A medium- and long-term runoff forecasting system based on Seq2Seq model, characterized in that: It includes data preprocessing layer, model building, training, parameter adjustment, encapsulation layer, and result output layer; Data preprocessing layer: obtain the daily average historical runoff data of the hydrological station to be forecasted, and observe whether the daily average runoff data provided by the observation station is continuous. If there is data missing, perform Lagrange quadratic difference on the daily average runoff data through the Lagrange difference formula to obtain a continuous daily average runoff data; then the continuous daily average runoff data obtained is standardized by Min-Max, and finally the daily average runoff data after Min-Max standardization is Box-Cox transformed, and the processed daily average runoff data is sorted into four groups of daily, monthly, seasonal and annual runoff data according to the corresponding method to obtain the final output result of the data preprocessing layer; Model construction, training, parameter adjustment, and packaging layer: The four groups of runoff data, namely, daily average, monthly average, seasonal average, and annual average, are divided into training data and test data respectively. The model input time step, batch size, and number of hidden layer neurons are optimized using the performance results of the model training and test data. The model input step, batch size, and number of hidden layer neurons when the model runoff forecast accuracy is the highest are selected as the results of model parameter optimization. Finally, the trained models are packaged to obtain daily average, monthly average, seasonal average, and annual average runoff forecast models respectively. Result output layer: Select the encapsulated model, perform arithmetic weighted coupling based on the prediction results of each encapsulated model to obtain the final runoff forecast result, perform Box-Cox inverse transformation and Min-Max denormalization on the forecast result, and output the forecast result.
9. The medium- and long-term runoff forecasting system based on Seq2Seq model according to claim 8, characterized in that: The model construction, training, parameter adjustment, and encapsulation layers include: Model construction: The output results of the data preprocessing layer are divided into a training set and a test set. The torch.nn.GRU neural network function in the pytorch neural network framework is used to build a Seq2Seq neural network model with one hidden layer, an Encoder layer, and a Decoder layer. The built model is trained and learned on the training set according to the preset parameters and the model parameters are updated. The trained model is converted into a test model through the eval function, and the test set is tested according to the parameters trained in the training set. Model training: Train the built model on samples according to the preset parameters and update the model parameters. Convert the trained model into a test model through the eval function, test the test set according to the parameters trained in the training set, and evaluate the model based on the test results. Model parameter adjustment: The number of neurons m in the model hidden layer is determined by trial and error. Different values are taken in the set interval, and the number of neurons that minimizes the Nash efficiency coefficient of the regular sample set is selected as the optimal number of neurons in the hidden layer. Different combinations of pre-selected prediction factors are used as the input layer of the Seq2Seq runoff prediction model. Therefore, the input layer elements of the Seq2Seq runoff prediction model are determined by the combination scheme of the pre-selected prediction factors. The NSE values obtained by taking different numbers of hidden layer neurons m are used to analyze the prediction performance of the model when different numbers of prediction factors are selected. Model packaging: The trained and parameter-adjusted model is packaged, and the model training parameters are saved for subsequent runoff forecasting.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the medium- and long-term runoff forecasting method based on the Seq2Seq model as described in any one of claims 1 to 7.
