1 Introduction

Water utilities should ensure a proper balance between water production and consumption at any moment to satisfy users’ requirements for water demand and pressure and minimize the energy-related costs for water treatment and pumping. This requirement has increased the need for efficient management of water supply operations. Since short-term water demand forecasting is an important component for achieving effective city water management, it is crucial to predict it effectively and accurately.

Based on different forecast horizons (i.e., the interval that water demand is to be predicted into the future), water demand forecasting can be generally categorized as long-term, medium-term and short-term. For short term forecasting, however, no generally accepted time frame yet exists. Some studies have defined forecasts spanning between 1 and 3 months as short term, while another study categorized hourly to monthly forecasts of up to a year as short term (Donkor et al. 2014). For clarity, we follow the latter in defining short-term forecasting in this study.

In recent years, with the rapid development of artificial intelligence (AI) techniques, a wide variety of short-term water demand forecasting methods, models or techniques using AI techniques have been proposed for different forecast periodicities (i.e., the time span between consecutive predictions), variables and determinants. One of the most important and widely used AI models is the artificial neural network (ANN). Due to its flexible nonlinear modelling capability and lack of requirements for as many assumptions as conventional statistical models (e.g., the multivariable linear regression model, autoregressive moving average model, etc.), ANNs have been extensively studied in short-term water demand forecasting.

Jain et al. (2001) examined three modelling techniques for weekly water demand forecasting. In this study, five regression models and two time series models were developed. The results show that ANNs provide better weekly water demand predictions than do other methods. Bougadis et al. (2005) developed three different ANNs for short-term peak water demand forecasting in Ottawa, Ontario, Canada and found that the ANN models consistently outperformed regression and time series models. Firat et al. (2009) investigated the performances of three ANNs and found that generalized regression neural networks outperform feed-forward neural networks and radial basis neural networks at monthly water consumption forecasting. Banjac et al. (2015) employed a BPNN combined with an adaptive model parameter tuning procedure to predict 24-h-ahead water demand; the results showed a significant improvement in the prediction ability compared with a BPNN with fixed parameters. More recently, Guo et al. (2018) applied a new generation of recurrent neural networks (RNNs) called gated recurrent units (GRUs) to forecast water demand from 15 min to 24 h into the future at 15-min intervals. They compared their proposed deep learning method with a conventional ANN model and seasonal autoregressive integrated moving average (SARIMA) model and concluded that their model improved the water demand prediction performance.

To further improve the performance of a single ANN, many studies on the development of water demand prediction models have focused mainly on hybrid models. The main idea underlying the hybrid model approaches is to combine ANNs with other models or algorithms to obtain better forecasting results. Adamowski et al. (2012) proposed a method that coupled the discrete wavelet transform (WA) and ANNs for urban water demand forecasting applications. The results indicated that the WA-ANN model provided more accurate forecasts than did multiple linear regression, multiple nonlinear regression, autoregressive integrated moving average, and classical ANN models. Other examples of short-term water demand forecasting methods based on hybrid models can be found in Pulido-Calvo and Gutierrez-Estrada (2009) and Campisi-Pinto et al. (2012).

Although hybrid methods have been widely tested and evaluated, ensemble methods for water demand forecasting have not yet been studied sufficiently. In the past two decades, a variety of ensemble models or methods have been proposed and widely applied to classification and regression problems (Borra and Ciaccio 2002; Chen and Ren 2009; Khwaja et al. 2017). More recently, adaptive boosting (AdaBoost), a novel ensemble learning algorithm, has been successfully applied to enhance learning ability by promoting model architecture synthesis (Yang et al. 2010; Mathanker et al. 2011). Moreover, ANNs combined with the AdaBoost algorithm (as a typical neural network ensemble) form a powerful forecasting method. The effectiveness of this methodology has been proven in many areas (Zhao et al. 2014; Shao et al. 2017), and water demand forecasting could certainly benefit from it. However, few studies in water demand forecasting can be found that apply neural network ensemble models as mentioned above. To fill this research gap, in this study, an ensemble learning-based method is proposed to forecast short-term water demand. Considering that the BPNN is the most common network used for water demand forecasting (Bougadis et al. 2005), the neural network ensemble model used in the proposed method integrates BPNNs into the AdaBoost algorithm: this ensemble model is called the BP_AdaBoost model. The novelty of this study is that it attempts to improve prediction performance in short-term water demand forecasting using an ensemble learning method, which is an approach that has not yet been studied sufficiently.

The remainder of this paper is organized as follows. Section 2 describes knowledge related to the proposed method and the procedural details required for short-term water demand forecasting. In the Section 3, the proposed model is tested, and its performance is compared with single BPNN and SARIMA models. Finally, Section 4 presents the summary of the paper and provides some suggestions for future study.

2 Methodology

Figure 1 presents the basic framework of the proposed method for water demand forecasting. First, historical data were collected from a real-world water distribution system in NN city, which is in southern China. Second, features were selected as model inputs. Then, data pre-processing was conducted. Next, the water demand data were reconstructed to represent the relationships between sample data more effectively. Finally, the BP_AdaBoost model, coupled with equal-dimension and new-information models, was applied to perform short-term water demand forecasting.

Fig. 1
figure 1

Framework of the proposed method for water demand prediction

2.1 Feature Selection

Good feature selection can improve model performance. Hence, the first task is to select appropriate features to function as the input variables to the BP_AdaBoost model. In short-term water demand forecasting, two major kinds of features are usually used for input variables: historical water demand and weather-related factors (e.g., temperature, humidity and rainfall). Some studies that used both historical and weather-related factors as input data yielded better predictions than those in which only water demand is considered as the input (Adamowski and Karapataki 2010). Doubtless, obtaining a good understanding of the factors that influence demand and reliable estimates of the parameters that describe demand behaviour and consumption patterns can help to obtain a good forecast (Donkor et al. 2014). However, the ability of water utilities to acquire and monitor the input variables should also be taken into consideration. The methods that require many variables are challenging to water utilities in terms of collecting and keeping records of the data, which limits their practicality. In practice, reliable short-term water demand forecasting can still be achieved by using water demand as a single model input, as has been proven in several studies (Ghiassi et al. 2008; Guo et al. 2018). In addition, water demand might be the only variable that is easy for most water utilities to collect and monitor, especially in underdeveloped regions. Consequently, water demand data are the only input required in this paper.

2.2 Data Pre-Processing

Water distribution systems are large and complex systems. Their operation is constrained not only by the system itself but also by the external environment. The complexity of the external environment makes it inevitable that poor data will be generated. Poor data obtained due to abnormal events such as large pipe bursts, human error and extreme weather can seriously distort the internal relationships between data. As a result, poor data should be removed or supplemented before being used as training samples. In this study, to smooth the data while retaining the data characteristics, data pre-processing was implemented as follows (Cheng 2007). Assume that the historical data at the same time on different days are denoted as {x1, x2, …, xn} and that \( \overline{x} \) is the mean of {x1, x2, …, xn}.

$$ \mathrm{If}\ {x}_i>\overline{x}\left(1+20\%\right),\mathrm{then}\ {x}_i=\overline{x}\left(1+20\%\right). $$
$$ \mathrm{If}\ {x}_i<\overline{x}\left(1-20\%\right),\mathrm{then}\ {x}_i=\overline{x}\left(1-20\%\right). $$

Please note that all the dates selected above are workdays or weekends; water usage patterns on holidays are quite different from those on ordinary days, therefore, data obtained on holidays also need to be processed in advance. Considering the rarity of holidays, the holiday data can be replaced with data obtained by the same pre-processing procedure mentioned above.

2.3 Sample Data Reconstruction

In general, the factors that affect short-term water demand can be classified into three main types: 1) factors that affect water demand at different times in the same day, such as users’ water consumption behaviours (e.g., residential users’ water consumption is high at 7:00 am and low at 11:00 pm); 2) factors that affect water demand at the same time on different days, which mainly refers to users’ water consumption behaviours on weekends, working days and holidays; and 3) meteorological factors (e.g., temperature and humidity). According to the above factors, there is a certain time correlation between water demands in different periods. The time correlations of water demands can be manifested in two aspects:

  1. (1)

    Due to the influence of temperature and humidity, the water demand in the current period can be regarded as a continuation of the water demands in previous periods to some extent.

  2. (2)

    Water demand in the current period can also be regarded as the periodic repetition of historical water demand under a similar model to some extent.

From the above analyses, to reveal the nonlinear relationships between water demands more effectively, the sample data need to be reconstructed before being used as model inputs and outputs. Note that we focus on hourly water demand forecasting in this paper. Table 1 shows a sample of the model obtained from data reconstruction.

Table 1 Sample data reconstruction

2.4 Equal-Dimension and New-Information Model

During the system development process, many random factors may affect the system development trend. Therefore, to improve the prediction accuracy, a forecast model needs to update the modelling data periodically. In addition, the influences of data in different periods on prediction are different. Generally, the newer the data are, the greater their impact on the predicted value becomes. Given the above analyses, an equal-dimension and new-information model was introduced into this study. The equal dimension and new-information model uses the approach of adding new data and removing old data to update the information. This model was employed in this paper to update the training data set while keeping its dimensions equal. The implementation of this model is illustrated as follows.

figure a

where Xi are the training data for day i and Yi + 1 are the forecasts for day (i + 1).

2.5 BPNN Model

A BPNN is a multi-layer feed-forward neural network. One of its main characteristics is that the input signal transmits forward while the error propagates backward. During the forward signal transmission stage, the input signal is processed layer by layer: from the input layer to the hidden layer and then to the output layer. The states of the neurons in each layer affects only the states of the neurons in the next layer. If the output layer cannot achieve the desired values, it will switch to the back-propagation stage and adjust the weights and thresholds of the network according to the prediction errors so that the predicted output of the BPNN continues to approach the expected output. Typically, a BPNN used for prediction is composed of three layers: one input layer is dedicated to receiving the inputs, one hidden layer captures the relationships between the inputs and the outputs, and one output layer is used to produce the outputs (Sadeghi 2000).

2.6 BP_AdaBoost Algorithm

Due to its firm theoretical foundation and high forecasting accuracy, the AdaBoost algorithm, proposed by Freund and Schapire (1997), has become one of the most popular ensemble learning methods. The key idea behind AdaBoost is to combine a set of weak learners into a more powerful learner. The algorithm was originally designed for classification; consequently, to use this algorithm for water demand forecasting, it needs to be modified appropriately. The original BP_AdaBoost algorithm adjusts the sample weights based on the classification error rate. The modified BP_AdaBoost algorithm adjusts the sample weights depending on whether a specified threshold is exceeded. In addition, BPNNs are used as weak learners in the modified BP_AdaBoost algorithm. The detailed procedures of the BP_AdaBoost algorithm for short-term water demand forecasting are as follows (Zhao et al. 2014; Zhou and Lai 2017).

  1. Step 1:

    Determine the structure for a single BPNN. In this study, a three-layer BPNN, which is common in water demand forecasting models, is used for prediction (Herrera et al. 2010; Bougadis et al. 2005). The number of input nodes and output nodes are determined based on the input and output dimensions, respectively. Correct determination of the number of hidden nodes has a substantial impact on the prediction accuracy of the BPNN. The network cannot be well trained when the number of hidden nodes is inadequate, while too many hidden nodes may lead to overfitting problems. Nevertheless, no generally accepted standard exists for determining the number of hidden nodes. We provide the following three empirical formulas for reference (Wang et al. 2018):

$$ l<n-1, $$
(1)
$$ l<\sqrt{m+n}+\gamma, $$
(2)
$$ l={\log}_2n, $$
(3)

where l is the number of hidden nodes, n is the number of input nodes, m is the number of output nodes, and γ is a constant in the range [0, 10].

In this study, the approximate range of the number of hidden nodes is first determined based on the three empirical formulas listed above; then, a trial-and-error method is used to obtain the optimal number of hidden nodes.

  1. Step 2:

    Determine the number of BPNNs that are combined into a strong predictor. For simplification, the number of BPNNs is denoted as T. Similar to the procedures for determining the number of nodes in the hidden layer, the range of T is determined first, and then a relatively optimal value can be achieved by observing the trend of the test errors.

  2. Step 3:

    Select a set of N samples for training and initialize the weight of each sample D1(i) to 1/N, i = 1,2,…N. The training samples are denoted as (xi,yi), i = 1,2,…N, where xi is the input variable for BPNN.

  3. Step 4:

    Train the jth (j = 1,2,…T) BPNN using the same samples to obtain a predictor model, which corresponds to the prediction Fj.

  4. Step 5:

    Obtain the predicted output hj(xi). For the samples that satisfy∣hj(xi) − yi ∣  > ε, where ε is a given threshold value, compute the absolute error ej(i) between the predicted output and the expected value, and finally, obtain the sum of the absolute error using Formula (4):

$$ {\mathrm{E}}_j={\sum}_i{e}_j(i)i=1,2,\dots N. $$
(4)
  1. Step 6:

    Calculate the weight of the jth BP network as follows:

$$ {\alpha}_j=0.5\times \ln \left(\frac{1-{E}_j}{E_j}\right). $$
(5)
  1. Step 7:

    Update the weights of the samples using Formulas (6) and (7):

$$ {D}_{j+1}(i)={D}_j(i)\times \upbeta, $$
(6)
$$ {D}_{j+1}(i)=\frac{D_{j+1}(i)}{\sum_{i=1}^N{D}_{j+1}(i)}\kern2.75em i=1,2,\dots N, $$
(7)

where β is a specified coefficient greater than 1. In general, β should not be set to a large value, because a large value will lead to significant weight changes, which may result in unstable forecasts. For this reason, we set β to 1.1 in this study. Formula (7) normalizes the weights without changing their proportions so that the sum of the weights for the samples is equal to 1.

  1. Step 8:

    Repeat Steps 4–7 until the all the BPNNs have completed training.

  2. Step 9:

    Generate a strong predictor. Following the above method, a set of predictions {Fj| j = 1,2, …T} are obtained. A strong predictor is described by a final function, which can be denoted as follows:

$$ \mathrm{P}\left({x}_i\right)={\sum}_{j=1}^T{\alpha}_j\times {F}_j\left({x}_i,{\alpha}_j\right)\kern2.75em i=1,2,\dots N. $$
(8)

The flowchart of the BP_AdaBoost algorithm for short-term water demand forecasting is shown in Fig. 2.

Fig. 2
figure 2

Flowchart of BP_AdaBoost algorithm for prediction

2.7 Model Forecast Evaluation

The effectiveness of evaluation depends on which measure indicator is used; thus, it is essential to select appropriate indicators. Several indicators are usually used in water demand forecasting to measure the performance of forecasting models, namely, mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), absolute percentage error (APE) and mean absolute percentage error (MAPE).

The MAE is a basic evaluation method that is commonly used to select the models that have the fewest average deviations. However, the MAE is not conducive to the comparison of models with different data.

Compared with the MAE, both the MSE and RMSE magnify values with large deviations, which means that both are sensitive to outliers. Therefore, they are generally suitable for evaluating stability. Although some mathematical expression differences exist between the MSE and RMSE, they work on essentially the same principles.

Unlike the three indicators mentioned above, the APE and the MAPE are not absolute values; they are relative values with no units. Therefore, neither the APE nor the MAPE are sensitive to whether the data used in the models are the same. Consequently, these two metrics might be the most important measures for evaluating forecast accuracy.

The mathematical expressions for these indicators can be denoted as follows (Donkor et al. 2014, Guo et al. 2018):

$$ \mathrm{MAE}=\frac{1}{n}\times {\sum}_{i=1}^n\mid {y}_i-{\hat{y}}_i\mid, $$
(9)
$$ \mathrm{MSE}=\frac{1}{n}\times {\sum}_{i=1}^n{\left({y}_i-{\hat{y}}_i\right)}^2, $$
(10)
$$ \mathrm{RMSE}=\sqrt{MSE}=\sqrt{\frac{1}{n}\times {\sum}_{i=1}^n{\left({y}_i-{\hat{y}}_i\right)}^2}, $$
(11)
$$ \mathrm{APE}=\frac{\left|{y}_i-{\hat{y}}_i\right|}{y_i}\times 100\%, $$
(12)
$$ \mathrm{MAPE}=\frac{1}{n}\times {\sum}_{i=1}^n\frac{\left|{y}_i-{\hat{y}}_i\right|}{y_i}\times 100\%, $$
(13)

where yiand \( {\hat{y}}_i \) represent the observed values and forecast values, respectively, and n is the number of observed values or forecast values.

A good prediction model not only has high accuracy but also yields stable forecasts. In other words, it is not sufficient to evaluate the quality of forecasts based solely on accuracy metrics. Given this point and based on the above analyses, RMSE, APE and MAPE are selected as representative measures to evaluate the performance of forecast models in this study.

3 Case Study

3.1 Data Description

Hourly water demand data were obtained from a real-world water distribution system to validate the proposed method. First, the data were pre-processed using the methods mentioned in the “Data Pre-processing” subsection. The dataset contains a total of 4200 observations (i.e., data for 175 days). The hourly water demand curve for a week is shown in Fig. 3, and the daily water demand curve for 175 days is shown in Fig. 4.

Fig. 3
figure 3

Hourly water demand curve for a week

Fig. 4
figure 4

Daily water demand curve

Before the water demand data were used as model inputs and outputs, the data were reconstructed. Table 2 shows the structure of a sample through reconstruction.

Table 2 Structure of a sample

For a better understanding, a concrete example is shown as follows:

Sample

Input variable

Output variable

Time

1:00 on Dec. 25

2:00 on Dec. 25

3:00 on Dec. 25

4:00 on Dec. 25

5:00 on Dec. 4

5:00 on Dec. 11

5:00 on Dec. 18

5:00 on Dec. 25

Value (m3/h)

38,892

39,743

41,471

39,566

42,618

47,008

48,962

42,548

Note that just as in other water distribution systems, the structure of a sample can be determined according to its state.

In this study, the proposed method was used to forecast 24-h-ahead water demand. The forecast for each day uses only the data from the previous 56 days as training data. Coupled with the equal-dimension and new-information model, the forecast was carried out in a rolling way. Observations for 119 days were used to test the performance of the models.

3.2 Parameter Settings for a Single BPNN

The number of nodes in each layer needs to be specified in advance when a BPNN is used for prediction. The number of nodes in the input and output layers can be obtained according to the input and output dimensions, respectively. As shown in Table 2, the number of input and output nodes can be set to 7 and 1, respectively. To determine the number of hidden nodes, a trial-and-error procedure was implemented to find a suitable value. Based on the minimum MAPE of the test data, the number of hidden nodes was set to 6 in this study. Default settings were adopted for the other parameters.

3.3 Parameter Settings for BP_AdaBoost Model

The BP_AdaBoost model requires two parameters to be set: the threshold ε and the number of BPNNs T used to construct the strong predictor. The desired value of T can be determined according to the minimum MAPE on the test data. A T value of 1 will fail to take advantage of the BP_AdaBoost model, while a large T value will result in a heavy computational burden. In this study, the range of T is limited to a value in the range [2, 16]. For each T value, the BP_AdaBoost model was implemented 5 times; then, the mean MAPE was used to select T. The mean MAPE values for different T values are shown in Fig. 5.

Fig. 5
figure 5

Mean MAPE for different T values

As can be seen from Fig. 5, the best result based on the mean MAPE is obtained when T is 15. This means that satisfactory forecasts can be achieved by including 15 BPNNs in the BP_AdaBoost model.

Following similar procedures, according to the best mean MAPE result, we set the threshold ε to 2100. Note that the above procedures are not necessarily able to obtain the global optimum parameter values. However, a relatively excellent performance of the proposed model can be guaranteed when the parameters selected by the above methods are employed. The overall parameter selection results of the ANN-based methods are shown in Table 3.

Table 3 Parameter selection results

3.4 Results

One of the purposes of this study was to investigate whether the proposed method outperforms a single BPNN for short-term water demand forecasting. Consequently, we compared the proposed method with a single BPNN model and a simple weighted average BPNN (SAM_BPNN) model in this paper. The result of the SAM_BPNN model is the average of 15 runs of a single BPNN. To fully evaluate the effectiveness of the proposed method, we also compared it with SARIMA, which is often used in data sets with strong periodic autocorrelations. The SARIMA (1,0,1)×(1,0,1)24 model was selected as the best model for the test data in this paper. All the models in this study was implemented in the MATLAB environment.

As is well known, ANN can be regarded as a black box that can yield different forecasts for each run. Therefore, to evaluate the performances of ANN-based methods more reasonably, we implemented each ANN-based method 5 times. Table 3 shows the performances of the ANN-based methods.

As Table 4 shows, the average MAPE for the proposed method decreases by 0.21% compared with that of a single BPNN, and a 7.34% improvement in prediction accuracy was achieved. Improvements can also be seen among different runs (e.g., the MAPE value reduction is in the 0.09%–0.33% range). This indicates that the proposed method has a better prediction accuracy than does a single BPNN. For the RMSE, a satisfactory improvement can also be seen among the different runs (e.g., RMSE values were reduced in a range from 6.16%–12.24% range). An 8.23% reduction was obtained in the mean value of RMSE. These observations reveal that the errors derived from the proposed method have smaller fluctuations; consequently, it provides more stable forecasts. Thus, it is safe to conclude that the proposed method outperforms a single BPNN. Furthermore, compared with SAM_BPNN, the proposed method clearly obtains lower MAPE and RMSE scores. These results show that the proposed method performs better than does a simple weighted average model. Finally, some other interesting findings can also be observed. For example, the average MAPE of the SAM_BPNN model is slightly lower than that of the single BP model, but the opposite is true regarding the mean RMSE. This observation may indicate that simply taking the weighted average of the predictions of multiple BPNNs does not necessarily improve the performance of a single BP model effectively. Meanwhile, it further reveals the superiority of the proposed method.

Table 4 Performances for ANN-based methods

Table 5 summarizes the performances of the proposed method and the SARIMA model.

Table 5 Performances for the proposed method and the SARIMA model

Table 5 clearly shows that the proposed method performs much better than does the SARIMA model. Compared with SARIMA, the proposed method achieves more than 30% improvements in both MAPE and RMSE. One explanation is that the proposed method captures the nonlinear relationships between water demand time series effectively, while the SARIMA model fails to do this due to its limitations.

Figure 6 shows an example of good-quality forecasts for the three methods, where the prediction curves for the proposed method and single BPNN are close to the real curve overall, while the curve of the SARIMA model deviates significantly from the real curve. This indicates that the other two methods are better at handling nonlinear data than is the SARIMA model. Another interesting finding is that based on the performance in Fig. 6, the proposed method seems to have no significant improvement compared with the single BPNN method. One reasonable explanation is that the forecasts for the single BPNN method are good enough, leaving little room for improvement by the proposed method. In other words, the proposed method cannot fully use its advantages. However, some improvements can be found in Fig. 7, which shows that the APE values of the proposed method have smaller fluctuations than those of the single BPNN. More importantly, there are some points with a large APE (i.e., more than 6%) from the single BPNN. In contrast, the proposed method effectively removes the points with high APE values. These results indicate that the proposed method is more stable after the prediction accuracy of the single BPNN method reaches a certain level.

Fig. 6
figure 6

24 h-ahead water demand forecasts for 4 days

Fig. 7
figure 7

APE distributions for a single BPNN and the proposed method

4 Conclusion

In this paper, an ensemble learning-based method combining the BP_AdaBoost model with equal-dimension and new-information model was presented to forecast short-term water demand. The proposed BP_AdaBoost model employs BPNNs as weak predictors; then, a strong predictor consisting of a set of BPNNs is generated using the AdaBoost algorithm. The proposed method was evaluated by using hourly water consumption data collected from a real-world water distribution system and compared with single BPNN and SARIMA models. The results demonstrate that the proposed model achieves promising improvements in both accuracy and stability compared with the single BPNN and SARIMA models. The proposed method has the potential to be an effective alternative that can outperform a single BPNN in short-term water demand forecasting. These findings can be conducive to achieving optimal control of water distribution systems.

Finally, note that the BP_AdaBoost model is essentially a combination of multiple BPNNs. Therefore, its performance depends on the performance of each individual BPNN to some extent. Due to the randomness of the initial weights, it is almost impossible for BPNN training to achieve good results every time. In other words, the initial value of a single BPNN weight plays an important role in model training. Therefore, it may be feasible to introduce other deep learning methods (e.g., stacked autoencoders) into the proposed method. Other deep learning methods may provide more reasonable parameters for the initial weight of BPNN by extracting deep features from the data, which would further improve the performance of the proposed method.