# A Multistep Prediction of Hydropower Station Inflow Based on Bagging-LSTM Model

Authors: Lulu Wang; Hanmei Peng; Mao Tan; Rui Pan
Journal: Discrete Dynamics in Nature and Society
 (2021)

---

## Abstract

The inflow forecasting is one of the most important technologies for modern hydropower station. Under the joint influence of soil, upstream inflow, and precipitation, the inflow is often characterized by time lag, nonlinearity, and uncertainty and then results in the difficulty of accurate multistep prediction of inflow. To address the coupling relationship between inflow and the related factors, this paper proposes a long short-term memory deep learning model based on the Bagging algorithm (Bagging-LSTM) to predict the inflows of future 3 h, 12 h, and 24 h, respectively. To validate the proposed model, the inflow and related weather data come from a hydropower station in southern China. Compared with the classical time series models, the results show that the proposed model outperforms them on different accuracy metrics, especially in the scenario of multistep prediction.


---

## Body

## 1. Introduction

For hydropower stations, power generation is the main source of economic benefits and water is the raw material of production. An accurate inflow prediction is conducive to avoiding flood disasters, reasonably arranging flood control and power generation schedules, and improving the economic benefits of power generation. In the past decades, a large number of studies are aimed at how to effectively improve the prediction accuracy. With the progress of science and technology, machine learning technologies are applied, and the prediction accuracy is further improved [1, 2].In the following, we briefly review the techniques in the existing literature for inflow forecasting. The researchers have employed traditional time series analysis methods in the field, such as autoregressive (AR) [3], moving average (MA), autoregressive moving average (ARMA), and autoregressive integrated moving average (ARIMA) [4]. The application and comparison between above methods can be found in References [5–7]. However, these traditional methods have the problem that the prediction trend is roughly correct, but the prediction of fluctuation is not ideal, which is mainly reflected in the amplitude difference and phase offset of fluctuation. Then, some researchers have proven that those methods fail to further improve forecasting accuracy due to their stationarity and linearity [8]. In comparison with many statistical methods, artificial neural network (ANN) has proved to be more accurate in time series forecasting due to their ability to deal with nonlinearity and nonstationarity. A three-layered artificial neural network was used to forecast inflow of reservoir for 7 days of head-time [9]. It demonstrated that the ANN model has a great generalization ability over 23 dams in the U.S. with varying hydrological characteristics. Reference [7] shows a comparison about prediction effect between ARMA, ARIMA, and autoregressive artificial neural network. From the reference, we know that the reservoir inflow in the past 12 months that the ARIMA model had less error than the ARMA model, while autoregressive artificial neural network can forecast the inflow from the past 60 months well. Besides, a validation framework for ANNs is introduced to effectively evaluate the replicative and structural validity [10]. In the past few years, many machine learning algorithms have been successfully applied to solve the reservoir inflow forecasting problems, such as support vector regression (SVR) [11, 12], deep belief network (DBN) [13, 14], as well as some hybrid models [15–17]; those models are frequent to inflow prediction. Under the background of the new era, the rise of deep learning technologies provides a new solution for the prediction of inflow. When inflow forecasting is considered, the use of multilayer perceptron (MLP), recurrent neural network (RNN), and convolutional neural network (CNN) is widely observed [18]. Reference [19] represents a comparison between CNN, MLP, and support vector machine (SVM) in which the superiority of the CNN is revealed. Some variants of RNN, e.g., long short-term memory (LSTM) [20–22] and gated recurrent unit (GRU) [23, 24] have been proposed and found that their performance is better than the traditional RNN network.In this study, we propose a LSTM deep learning model based on the Bagging ensemble learning algorithm in the inflow prediction of hydropower station. The contributions of this paper can be summarized as follows. (1) This paper is devoted to addressing the problem of multistep forecasting. By strictly considering the influence of rainfall, temperature, wind direction, and wind speed to inflow, a fusion matrix is constructed with those features. (2) Our method considers the Bagging strategy for model integration in the inflow prediction scenario. We use the strategy to generate multiple base learners on different resampling subsets. This also reduces the deviation by utilizing the independence between base learners.The remainder of the paper is as follows. Section2 introduces the application context and abstract description of the problem. Section 3 describes the overall framework of the proposed model. Section 4 demonstrates the data exploratory analysis and the experimental results. Section 5 gives a conclusion.


## 2. Problem Description

In recent years, with the increasing accumulation of hydrometeorological data, it becomes possible for researchers to further explore and grasp the basic pattern of reservoir inflow variation. Through the effective data analysis methods, we can reach a precise forecast about future reservoir stream flow according to huge amounts of historical data and accessible monitoring data from observation stations in different basins. This will bring significant safety and economic value to hydropower station production. For all that, owing to the absence of forecasting time-lag flow upstream and downstream of cascade and interval runoff and the impact of other many factors, the predicted values are often greater than actual values. This often leads to the hydropower station’s operation plan suffer frequent revisions and is not conducive to the safe, efficient, and stable operation of the power station. To solve the aforesaid problem, this proposes a short-term inflow forecasting method from the side of actual real production demand. It predicts the inflow in the next 24 hours to provide a reference for irrigation, hydropower generation, domestic and industrial consumption, and flood control measures in the station. The schematic diagram of hydropower station inflow is shown in Figure1.Figure 1
The schematic diagram of hydropower station inflow.Forecasting the inflow of a hydropower station is essentially a time series forecasting problem. In order to make a forecast, it is essential to find the variation pattern of historical data and explore the relationship between the forecasted variable and various related factors so as to make a scientific forecast of the future trend of the forecasted variable. Therefore, from the perspective of time series analysis, the basic principle of the forecasting problem is depicted in Figure2. The variable t indicates the time scale, which can be minutes, hours, days, and so on, and it should be based on the specific problem. According to the collected historical sample data yt, it is now necessary to make a forecast y^t for the future time period T+Q≤t≤T+Q based on the historical development pattern of the forecast object yt, where t∈1,T; the time period T is the last period of known data; P≤Q, T, P, and Q are the corresponding time scale constants.(1)yt=fS,Xt,t.Figure 2
The schematic diagram of the time series prediction problem.In equation (1), t is the time series number; y is the variable to be predicted; X=x1,x2,…,xm is a vector of m relevant factors; and S is the parameter vector of this prediction model.


## 3. Methodology

### 3.1. Model Framework

The flow chart of the model framework is shown in Figure3. Generally, model integration has a stronger generalization ability than the base learner. To make the model more reliable, the Bagging ensemble learning algorithm is introduced to enhance the independence between the base models, thereby reducing the model error. From the figure, we can see that the prediction model consists of the following sections.(1)
Data Preprocessing. Firstly, the missing value and abnormal value of the data are processed, and then the data are normalized to improve the convergence speed of the model. Due to the different temporal resolutions between the datasets, the environmental data and the rainfall data of the telemetry station are resampled to keep the temporal resolution consistent with the inflow data, and then all the features are fused.(2)
Model Training. The fused dataset is divided into a training set and a test set. For the training set, Bagging uses self-sampling to generate different base learners. It introduces self-sampling to obtain a training subset for training base learners. In this model, each base learner uses a three-layer neural network. The first layer is the input layer. The second layer is the LSTM layer, with 50 neurons, tanh as the activation function, and Adam as the optimizer. The third layer is the output layer, with the activation function defaulted to sigmoid.(3)
Model Integration and Prediction. Bagging integrates the base learners using the classical weighted averaging method. It will perform a weighted average of the predictions of each base learner to obtain the final prediction of the model.Figure 3
The flow chart of model framework.


### 3.2. LSTM Neural Network Cell

RNN is a common neural network structure, which is used to process time series data. RNN has a special network structure and reflects the impact of past moments in current projections. Meanwhile, it shares the weight matrix at different times and decreases the number of parameters so that increasingly improves the training efficiency. Besides, it has the advantages to deal with arbitrary length time series data.The recurrent cell of the standard RNN is shown in Figure4(a). The network has same structure at each t time. Xt is the input data at t time. Ht is the hidden state at t time, which is the memory state of network. It also can capture the information at all times before. Ht−1 is the hidden state at t-1 time. It is usually initialized to zero. Ht is calculated by Ht−1 and Xt. The activation function is nonlinear, such as tanh or relu. Ot is the output data at t time.Figure 4
The loop cell structure of (a) RNN and (b) LSTM.
(a)(b)However, in the practical application, there is a problem of long-term dependence for the optimization algorithm of standard recurrent neural network training. As the network structure deepens, the network disables to learn the past information. When the LSTM network model was proposed, it can effectively solve the problem of a long-term dependence on information and avoid gradient disappearance or explosion.The LSTM unit is described in Figure4(b). Compared with the traditional RNN, the uniqueness of LSTM in structure is that it cleverly designed the gate structure. LSTM uses two gates to control the content of unit state C. One is forget gate, which determines how much of the unit state Ct−1 of the previous moment remains to the current moment Ct. Another input gate decides how much input Xt of the current network is saved to the cell state Ct. As for the output gate, it is used to control how much unit state Ct has output to the current output value Ht of LSTM.(2)ft=σwfht−1,xt+bf,it=σwiht−1,xt+bi,c^t=tanhwcht−1,xt+bc,ct=ftct−1+itc^t,ot=σwoht−1,xt+bo,ht=ottanhct.In equation (2), ft, it, and ot denote the forget gate, input gate, and output gate, respectively; ct denotes the cell state; ht denotes the current output value; xt denotes the current input value; w denotes the weight matrix;b denotes the bias vector; ⋅,⋅ represents splicing the two matrices by rows; σ⋅ is the sigmoid function; and tanh is the hyperbolic tangent function. In order to obtain the optimal model parameters, the model parameters are updated during training using backpropagation through time algorithm.


### 3.3. The Flow Chart of Model Training

The training process of the model is shown in Figure5. Specifically, the fused feature dataset D is first used as input, then the LSTM is selected as the base learner, the number of base learners T is set, and the training model set is further initialized. Besides, the loop count variable q is set and initialized to 1. Next, the size of q value is judged, and when q value is less than T, the training model is started by entering the loop. In the first step, m samples are randomly selected from the fused feature set D to form the subset Sub, and the samples are selected with put-back sampling, which causes some samples to be selected multiple times, while some samples may not be selected; in the second step, the subset Sub is divided into a training set Sub_Train and a validation set Sub_Valid, and the base learner is trained using the training set to obtain the trained base model Mq; in the third step, the validation set is fed into the Mq model for verifying whether its prediction accuracy meets the requirements; if not, the model is retrained, and if it meets, the trained model Mq is added to the model set Models; in the fourth step, the loop variable q is added by 1 for training the next base model until the training of T models is completed. Finally, the model set Models containing T base learning models is obtained.Figure 5
The flow chart of model training.


### 3.4. Evaluation Metrics

In order to comprehensively evaluate the proposed model,NSE and R2 indicators are used to measure the accuracy of the model:(3)NSE=1−∑t=1Tyt−y^t2∑t=1Tyt−y¯2,R2=∑i=1nyi−y¯y^i−y^¯∑i=1nyi−y¯2∑i=1ny^i−y^¯2.InNSE index, yt represents the real value at time t, y^t represents the predicted value at time t, y¯ represents the average of the real value, and T represents the total time. In R2 metric, n represents the number of samples, yi represents the real value at time i, y¯ represents the average of the real value, y^i represents the predicted value at time i, and y^¯ represents the average of the predicted value.The mean absolute error (MAE), root mean square error (RMSE), and normalized root mean square error (NRMSE) were selected to calculate the model error:(4)MAE=1N∑i=1Nyi−y^i,RMSE=1N∑i=1Nyi−y^i2,NRMSE=1/N∑i=1Nyi−y^i2ymax−ymin.In the metrics,N represents the number of samples, yi represents the real value at time i, y^i represents the predicted value at time i, and ymax and ymin represent the maximum and minimum values of a test set, respectively.


## 3.1. Model Framework

The flow chart of the model framework is shown in Figure3. Generally, model integration has a stronger generalization ability than the base learner. To make the model more reliable, the Bagging ensemble learning algorithm is introduced to enhance the independence between the base models, thereby reducing the model error. From the figure, we can see that the prediction model consists of the following sections.(1)
Data Preprocessing. Firstly, the missing value and abnormal value of the data are processed, and then the data are normalized to improve the convergence speed of the model. Due to the different temporal resolutions between the datasets, the environmental data and the rainfall data of the telemetry station are resampled to keep the temporal resolution consistent with the inflow data, and then all the features are fused.(2)
Model Training. The fused dataset is divided into a training set and a test set. For the training set, Bagging uses self-sampling to generate different base learners. It introduces self-sampling to obtain a training subset for training base learners. In this model, each base learner uses a three-layer neural network. The first layer is the input layer. The second layer is the LSTM layer, with 50 neurons, tanh as the activation function, and Adam as the optimizer. The third layer is the output layer, with the activation function defaulted to sigmoid.(3)
Model Integration and Prediction. Bagging integrates the base learners using the classical weighted averaging method. It will perform a weighted average of the predictions of each base learner to obtain the final prediction of the model.Figure 3
The flow chart of model framework.


## 3.2. LSTM Neural Network Cell

RNN is a common neural network structure, which is used to process time series data. RNN has a special network structure and reflects the impact of past moments in current projections. Meanwhile, it shares the weight matrix at different times and decreases the number of parameters so that increasingly improves the training efficiency. Besides, it has the advantages to deal with arbitrary length time series data.The recurrent cell of the standard RNN is shown in Figure4(a). The network has same structure at each t time. Xt is the input data at t time. Ht is the hidden state at t time, which is the memory state of network. It also can capture the information at all times before. Ht−1 is the hidden state at t-1 time. It is usually initialized to zero. Ht is calculated by Ht−1 and Xt. The activation function is nonlinear, such as tanh or relu. Ot is the output data at t time.Figure 4
The loop cell structure of (a) RNN and (b) LSTM.
(a)(b)However, in the practical application, there is a problem of long-term dependence for the optimization algorithm of standard recurrent neural network training. As the network structure deepens, the network disables to learn the past information. When the LSTM network model was proposed, it can effectively solve the problem of a long-term dependence on information and avoid gradient disappearance or explosion.The LSTM unit is described in Figure4(b). Compared with the traditional RNN, the uniqueness of LSTM in structure is that it cleverly designed the gate structure. LSTM uses two gates to control the content of unit state C. One is forget gate, which determines how much of the unit state Ct−1 of the previous moment remains to the current moment Ct. Another input gate decides how much input Xt of the current network is saved to the cell state Ct. As for the output gate, it is used to control how much unit state Ct has output to the current output value Ht of LSTM.(2)ft=σwfht−1,xt+bf,it=σwiht−1,xt+bi,c^t=tanhwcht−1,xt+bc,ct=ftct−1+itc^t,ot=σwoht−1,xt+bo,ht=ottanhct.In equation (2), ft, it, and ot denote the forget gate, input gate, and output gate, respectively; ct denotes the cell state; ht denotes the current output value; xt denotes the current input value; w denotes the weight matrix;b denotes the bias vector; ⋅,⋅ represents splicing the two matrices by rows; σ⋅ is the sigmoid function; and tanh is the hyperbolic tangent function. In order to obtain the optimal model parameters, the model parameters are updated during training using backpropagation through time algorithm.


## 3.3. The Flow Chart of Model Training

The training process of the model is shown in Figure5. Specifically, the fused feature dataset D is first used as input, then the LSTM is selected as the base learner, the number of base learners T is set, and the training model set is further initialized. Besides, the loop count variable q is set and initialized to 1. Next, the size of q value is judged, and when q value is less than T, the training model is started by entering the loop. In the first step, m samples are randomly selected from the fused feature set D to form the subset Sub, and the samples are selected with put-back sampling, which causes some samples to be selected multiple times, while some samples may not be selected; in the second step, the subset Sub is divided into a training set Sub_Train and a validation set Sub_Valid, and the base learner is trained using the training set to obtain the trained base model Mq; in the third step, the validation set is fed into the Mq model for verifying whether its prediction accuracy meets the requirements; if not, the model is retrained, and if it meets, the trained model Mq is added to the model set Models; in the fourth step, the loop variable q is added by 1 for training the next base model until the training of T models is completed. Finally, the model set Models containing T base learning models is obtained.Figure 5
The flow chart of model training.


## 3.4. Evaluation Metrics

In order to comprehensively evaluate the proposed model,NSE and R2 indicators are used to measure the accuracy of the model:(3)NSE=1−∑t=1Tyt−y^t2∑t=1Tyt−y¯2,R2=∑i=1nyi−y¯y^i−y^¯∑i=1nyi−y¯2∑i=1ny^i−y^¯2.InNSE index, yt represents the real value at time t, y^t represents the predicted value at time t, y¯ represents the average of the real value, and T represents the total time. In R2 metric, n represents the number of samples, yi represents the real value at time i, y¯ represents the average of the real value, y^i represents the predicted value at time i, and y^¯ represents the average of the predicted value.The mean absolute error (MAE), root mean square error (RMSE), and normalized root mean square error (NRMSE) were selected to calculate the model error:(4)MAE=1N∑i=1Nyi−y^i,RMSE=1N∑i=1Nyi−y^i2,NRMSE=1/N∑i=1Nyi−y^i2ymax−ymin.In the metrics,N represents the number of samples, yi represents the real value at time i, y^i represents the predicted value at time i, and ymax and ymin represent the maximum and minimum values of a test set, respectively.


## 4. Experimental Result and Analysis

To verify the prediction effect of the proposed model, the real data of a hydropower station in southern China were selected for experiments. Using the inflow data recorded by the station from 2015 to 2017, the time resolution is 3 h, and the historical inflow data are shown in Figure6. Given the comprehensive influence of precipitation, evaporation, soil (directly affecting surface runoff and underground runoff), upstream inflow, and many other factors, the rainfall data of local telemetry stations and environmental observation data (temperature, wind direction, and wind speed) were added as the consideration factors. In view of the security concerns, all used data have been desensitized. According to the proportion of 80% and 20%, the training set and test set are divided and the reservoir inflow of the next 3 h, 12 h, and 24 h is predicted, respectively. All relevant datasets can be retrieved from https://github.com/HYNU-WLL/The-Inflow-Prediction.Figure 6
The normalized historical data of inflow.


### 4.1. Data Exploration

Data exploration is an important part of data analysis, which can provide references for experiments. Usually, inflow is closely related to meteorological and seasonal changes, with a certain periodicity and continuity. Time correlation is one of the most important information in the prediction of inflow. Rainwater reaching the reservoir through infiltration and underground runoff often has a certain delay. The measured inflow data of the hydropower station in a certain period are selected for the correlation function calculation of time series, including autocorrelation function (ACF) and partial autocorrelation function (PACF). The analysis of the results is shown in Figure7. The ACF and PACF measure the dependence of present samples on the past samples of the same series, which can be calculated by the following equations:(5)ρk=∑t=k+1Nyt−y¯yt−k−y¯∑t=1Nyt−y¯2,0<k<N,(6)φkk=ρ1,k=1,ρk−∑j=1k−1φk−1,jρk−j1−∑j=1k−1φk−1,jρj,k>1.Figure 7
The ACF and PACF of inflow data.In equations (5) and (6), N is the series length, yt is the value at moment t of the series, y¯ is mean of the series, and φk,j=φk−1,j−φkkφk−1,k−j,j=1,2,…,k−1From Figure7, it can be found that there is a specific regularity and periodicity between adjacent time nodes as time changes. However, their correlations become weaker when the time interval becomes longer. Therefore, in the actual forecasting work, the selection of historical data within a reasonable time range determines the performance of the model prediction. The setting of this parameter can not only improve the prediction accuracy of the model but also reduce the unnecessary computational burden. With the graphical analysis results, 8 time steps of historical data are selected for the input of the model in this paper.The inflow of hydropower stations mainly comes from rainfall-runoff, watershed confluence, and river confluence, and water vapor evaporation and surface transpiration will reduce the amount of water. At the same time, human needs and behavior will also affect the change of reservoir flow, which often makes the inflow difficult to predict, and many factors are difficult to accurately observe. This cannot obtain effective data as a support, so it is difficult to effectively improve the prediction accuracy. Considering the influence of rainfall, temperature, wind speed, and wind direction on inflow, the correlation between inflow and other factors is shown in Figure8. It also reveals that in the hydropower station basin, the correlation between inflow and temperature is high, followed by the correlation with rainfall. In contrast, the correlation between wind speed and wind direction and inflow is relatively low. In this model, the inflow is used as the prediction feature, and the influence of rainfall, temperature, wind speed, and wind direction on the inflow is considered to improve the prediction accuracy.Figure 8
The correlation analysis of inflow and environmental factors.


### 4.2. Experimental Result and Analysis

To prove the effect of the model, several classical neural network models are used for comparative experiments. When predicting 3 hours in advance, it can be found from the results shown in Table1 that the model proposed in this paper is better in all metrics. Its NSE and R2 reached 0.84 and 0.92, respectively, while MAE, RMSE, and NRMSE decreased to 0.053, 0.078, and 0.080, respectively. Among all experimental models, the SVR model had the worst prediction effect. Its NSE metric is 0.49 and R2 is 0.73. A careful analysis and comparison show that the NSE and R2 metrics of all the models except the SVR model are relatively close. The prediction curves of the model are shown in Figure 9. The proposed model has the closest prediction to the true value, and it has better stability and less volatility in its prediction results. However, it can be seen from the prediction curve of the SVR model in Figure 9 that its prediction curve is too wave-shaped and far from the true value, which is consistent with the error calculation index of the model. The predicted values of the DBN, RFR, and GBRT models fit the true value better, but the models do not predict the extreme values well enough to capture the change of the extreme value. Meanwhile, the scatter plots of the predicted and true values of each model are depicted in Figure 10. The effect of the model prediction results can be judged from the degree of aggregation of the scatter plots. Compared with the general LSTM model, the Bagging−LSTM model uses the strategy of integrating multiple models to make predictions, and its predicted values are more closely near to the true values, and the prediction results are better than the LSTM. After comparing the calculations, however, it is found that the proposed model has a slight advantage over other models in terms of prediction errors.Table 1
Evaluation results for lead time of 3 h.
MethodsNSER2MAERMSENRMSESVR0.4972370.7303700.1048050.1397420.141425DBN0.8343520.9147220.0549550.0800830.081048RFR0.8331300.9147940.0568970.0802900.081257GBRT0.8220450.9066950.0567610.0828930.083891LSTM0.8104370.9021510.0576310.0855740.086604Ours0.8390150.9169500.0526320.0789080.079858Figure 9
The predicted results over testing period for 3 h lead times.Figure 10
The scatter plot of the forecast and observed inflow for 3 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)With the increase in the prediction step, the prediction effect of the model is significantly improved. The proposed model significantly outperforms other models in all indicators when 12-hour ahead and 24-hour ahead forecasts are performed. The evaluation indexes of the 12-hour ahead and 24-hour ahead prediction results are shown in Tables2 and 3, respectively, from which it can be seen that the NSE and R2 indexes of the SVR model decrease rapidly and the error of the model becomes larger. This is due to the fact that the lack of long-term memory capability of the SVR model makes it unable to better solve the multistep prediction problem. Specifically, it will use the prediction result of the previous step as the output of the current prediction step result when the prediction step becomes longer, resulting in a single prediction value that appears as a prediction straight line in Figures 11 and 12. Similarly, the prediction distribution of the scatter plots in Figures 13 and 14 shows that the prediction results of the DBN and RFR models are limited to a single maximum value, which is shown as a sort of the withdrawal phenomenon in the plots. This reveals the shortcomings of traditional machine learning models. Comparing the prediction results of the Bagging−LSTM model and the LSTM model, the Bagging−LSTM model always outperforms the LSTM model in terms of prediction accuracy, and the prediction error of the LSTM model is always higher than that of the Bagging−LSTM model. This phenomenon becomes more obvious as the prediction step size increases.Table 2
Evaluation results for lead time of 12 h.
MethodsNSER2MAERMSENRMSESVR0.0041460.0228370.1654140.7851910.794646DBN0.7213100.8500400.0721230.4153010.420302RFR0.7557400.8785300.0688690.3886270.393308GBRT0.7706200.8778990.0653270.3756280.380152LSTM0.6654450.8201810.0789560.1136840.115053Ours0.7894790.8887340.0624980.0899790.091062Table 3
Evaluation results for lead time of 24 h.
MethodsNSER2MAERMSENRMSESVR0.000000 080.0141570.1656221.5743461.593306DBN0.5848260.7751520.0919461.0275811.039956RFR0.6919220.8458040.0799190.8749780.885515GBRT0.7236480.8502490.0712630.8229570.832868LSTM0.5464100.7519270.0933180.1327510.134350Ours0.717 500.8487690.0718120.1043720.105629Figure 11
The predicted results over testing period for 12 h lead times.Figure 12
The predicted results over testing period for 24 h lead times.Figure 13
The scatter plot of the forecast and observed inflow for 12 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)Figure 14
The scatter plot of the forecast and observed inflow for 24 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)As a whole, the longer the model predicts, the prediction accuracy decreases and the prediction error gradually becomes larger. In conclusion, we can see that the model proposed in this paper has high prediction accuracy, lower error, and better robustness compared with the traditional model.


## 4.1. Data Exploration

Data exploration is an important part of data analysis, which can provide references for experiments. Usually, inflow is closely related to meteorological and seasonal changes, with a certain periodicity and continuity. Time correlation is one of the most important information in the prediction of inflow. Rainwater reaching the reservoir through infiltration and underground runoff often has a certain delay. The measured inflow data of the hydropower station in a certain period are selected for the correlation function calculation of time series, including autocorrelation function (ACF) and partial autocorrelation function (PACF). The analysis of the results is shown in Figure7. The ACF and PACF measure the dependence of present samples on the past samples of the same series, which can be calculated by the following equations:(5)ρk=∑t=k+1Nyt−y¯yt−k−y¯∑t=1Nyt−y¯2,0<k<N,(6)φkk=ρ1,k=1,ρk−∑j=1k−1φk−1,jρk−j1−∑j=1k−1φk−1,jρj,k>1.Figure 7
The ACF and PACF of inflow data.In equations (5) and (6), N is the series length, yt is the value at moment t of the series, y¯ is mean of the series, and φk,j=φk−1,j−φkkφk−1,k−j,j=1,2,…,k−1From Figure7, it can be found that there is a specific regularity and periodicity between adjacent time nodes as time changes. However, their correlations become weaker when the time interval becomes longer. Therefore, in the actual forecasting work, the selection of historical data within a reasonable time range determines the performance of the model prediction. The setting of this parameter can not only improve the prediction accuracy of the model but also reduce the unnecessary computational burden. With the graphical analysis results, 8 time steps of historical data are selected for the input of the model in this paper.The inflow of hydropower stations mainly comes from rainfall-runoff, watershed confluence, and river confluence, and water vapor evaporation and surface transpiration will reduce the amount of water. At the same time, human needs and behavior will also affect the change of reservoir flow, which often makes the inflow difficult to predict, and many factors are difficult to accurately observe. This cannot obtain effective data as a support, so it is difficult to effectively improve the prediction accuracy. Considering the influence of rainfall, temperature, wind speed, and wind direction on inflow, the correlation between inflow and other factors is shown in Figure8. It also reveals that in the hydropower station basin, the correlation between inflow and temperature is high, followed by the correlation with rainfall. In contrast, the correlation between wind speed and wind direction and inflow is relatively low. In this model, the inflow is used as the prediction feature, and the influence of rainfall, temperature, wind speed, and wind direction on the inflow is considered to improve the prediction accuracy.Figure 8
The correlation analysis of inflow and environmental factors.


## 4.2. Experimental Result and Analysis

To prove the effect of the model, several classical neural network models are used for comparative experiments. When predicting 3 hours in advance, it can be found from the results shown in Table1 that the model proposed in this paper is better in all metrics. Its NSE and R2 reached 0.84 and 0.92, respectively, while MAE, RMSE, and NRMSE decreased to 0.053, 0.078, and 0.080, respectively. Among all experimental models, the SVR model had the worst prediction effect. Its NSE metric is 0.49 and R2 is 0.73. A careful analysis and comparison show that the NSE and R2 metrics of all the models except the SVR model are relatively close. The prediction curves of the model are shown in Figure 9. The proposed model has the closest prediction to the true value, and it has better stability and less volatility in its prediction results. However, it can be seen from the prediction curve of the SVR model in Figure 9 that its prediction curve is too wave-shaped and far from the true value, which is consistent with the error calculation index of the model. The predicted values of the DBN, RFR, and GBRT models fit the true value better, but the models do not predict the extreme values well enough to capture the change of the extreme value. Meanwhile, the scatter plots of the predicted and true values of each model are depicted in Figure 10. The effect of the model prediction results can be judged from the degree of aggregation of the scatter plots. Compared with the general LSTM model, the Bagging−LSTM model uses the strategy of integrating multiple models to make predictions, and its predicted values are more closely near to the true values, and the prediction results are better than the LSTM. After comparing the calculations, however, it is found that the proposed model has a slight advantage over other models in terms of prediction errors.Table 1
Evaluation results for lead time of 3 h.
MethodsNSER2MAERMSENRMSESVR0.4972370.7303700.1048050.1397420.141425DBN0.8343520.9147220.0549550.0800830.081048RFR0.8331300.9147940.0568970.0802900.081257GBRT0.8220450.9066950.0567610.0828930.083891LSTM0.8104370.9021510.0576310.0855740.086604Ours0.8390150.9169500.0526320.0789080.079858Figure 9
The predicted results over testing period for 3 h lead times.Figure 10
The scatter plot of the forecast and observed inflow for 3 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)With the increase in the prediction step, the prediction effect of the model is significantly improved. The proposed model significantly outperforms other models in all indicators when 12-hour ahead and 24-hour ahead forecasts are performed. The evaluation indexes of the 12-hour ahead and 24-hour ahead prediction results are shown in Tables2 and 3, respectively, from which it can be seen that the NSE and R2 indexes of the SVR model decrease rapidly and the error of the model becomes larger. This is due to the fact that the lack of long-term memory capability of the SVR model makes it unable to better solve the multistep prediction problem. Specifically, it will use the prediction result of the previous step as the output of the current prediction step result when the prediction step becomes longer, resulting in a single prediction value that appears as a prediction straight line in Figures 11 and 12. Similarly, the prediction distribution of the scatter plots in Figures 13 and 14 shows that the prediction results of the DBN and RFR models are limited to a single maximum value, which is shown as a sort of the withdrawal phenomenon in the plots. This reveals the shortcomings of traditional machine learning models. Comparing the prediction results of the Bagging−LSTM model and the LSTM model, the Bagging−LSTM model always outperforms the LSTM model in terms of prediction accuracy, and the prediction error of the LSTM model is always higher than that of the Bagging−LSTM model. This phenomenon becomes more obvious as the prediction step size increases.Table 2
Evaluation results for lead time of 12 h.
MethodsNSER2MAERMSENRMSESVR0.0041460.0228370.1654140.7851910.794646DBN0.7213100.8500400.0721230.4153010.420302RFR0.7557400.8785300.0688690.3886270.393308GBRT0.7706200.8778990.0653270.3756280.380152LSTM0.6654450.8201810.0789560.1136840.115053Ours0.7894790.8887340.0624980.0899790.091062Table 3
Evaluation results for lead time of 24 h.
MethodsNSER2MAERMSENRMSESVR0.000000 080.0141570.1656221.5743461.593306DBN0.5848260.7751520.0919461.0275811.039956RFR0.6919220.8458040.0799190.8749780.885515GBRT0.7236480.8502490.0712630.8229570.832868LSTM0.5464100.7519270.0933180.1327510.134350Ours0.717 500.8487690.0718120.1043720.105629Figure 11
The predicted results over testing period for 12 h lead times.Figure 12
The predicted results over testing period for 24 h lead times.Figure 13
The scatter plot of the forecast and observed inflow for 12 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)Figure 14
The scatter plot of the forecast and observed inflow for 24 h lead times. (a) SVR, (b) DBN, (c) RFR, (d) GBRT, (e) LSTM, (f) Bagging-LSTM.
(a)(b)(c)(d)(e)(f)As a whole, the longer the model predicts, the prediction accuracy decreases and the prediction error gradually becomes larger. In conclusion, we can see that the model proposed in this paper has high prediction accuracy, lower error, and better robustness compared with the traditional model.


## 5. Conclusion

The real-time and effective prediction of hydropower station inflows can provide a favorable reference for irrigation, hydroelectric power generation, domestic and industrial consumption, and flood control. In this work, aBagging−LSTM deep learning model has been constructed for forecasting reservoir inflows and evaluated by the historical data of real hydropower stations in southern China. Extensive test experiments showed that the proposed model yields higher accuracy and lower error compared with LSTM, SVR, DBN, RFR, and GBRT approach. Especially, the prediction effect of the proposed model becomes more significant as the prediction step becomes longer. Besides, for long-term forecasting and extreme-event analysis, the Bagging−LSTM model shows a better superiority than conventional methods. However, there is still room for improvement in the Bagging−LSTM stream-flow forecasting model. The results show that errors in peak volume forecast cannot be ignored.



---

*Source: 1031442-2021-12-13.xml*