Rainfall-derived inflow/infiltration (RDII) modelling during heavy rainfall events is essential for sewer flow management. In this study, two machine learning algorithms, random forest (RF) and long short-term memory (LSTM), were developed for sewer flow prediction and RDII estimation based on field monitoring data. The study implemented feature engineering for extracting physically significant features in sewer flow modelling and investigated the importance of the relevant features. The results from two case studies indicated the superior capability of machine learning models in RDII estimation in the combined and separated sewer systems, and LSTM model outperformed the two models. Compared to traditional methods, machine learning models were capable of simulating the temporal variation in RDII processes and improved prediction accuracy for peak flows and RDII volumes in storm events.

  • Machine learning models, particularly the LSTM model, outperformed traditional methods in estimating RDII in sewer systems.

  • Feature engineering techniques allowed for the extraction of physically significant features in sewer flow modelling.

  • Machine learning models successfully simulated the temporal variation in RDII processes, resulting in improved accuracy for predicting peak flows and RDII volumes during storm events.

Inflow/infiltration into defective sewers leads to increased amounts of sewage and reduced treatment efficiency of wastewater treatment plants (WWTPs), which can lead to negative impacts on sewer operation and management. During heavy rainfall events, sewage systems can become easily overloaded due to rainfall-derived inflow and infiltration (RDII), and release untreated sewage and other pollutants into the environment (Jiang et al. 2019; Zhang & Parolari 2022). This can damage ecosystems and also pose a health risk to people who live near the affected areas (Yap & Ngien 2017).

Traditional methods for RDII estimation that were commonly used in the literature (Bennett 1999; Lai 2008; Mikalson et al. 2012) include the constant unit rate method (Empirical), the percentage of rainfall volume (R-value) method (Empirical), the percentage of stream flow method (Empirical), the synthetic unit hydrograph (SUH) method (Conceptual), the probabilistic method (Probabilistic), the rainfall/sewer flow regression method (Statistical), the synthetic stream flow regression method (Statistical), and methods embedded in hydraulic software (Mechanistic/Conceptual). Classifications in parentheses are based on the underlying principles employed by each method. A follow-up research based on the existing reviews of RDII quantification was conducted by Bennett (1999), who concluded that the selection of RDII estimation methods highly depends on site-specific rainfall and runoff conditions. The percentage of rainfall volume (R-value) method can be used for estimates of RDII when monitoring data is lacking, but accuracy is usually restricted due to inconsistent judgement from different analysts (Crawford et al. 1999; Vallabhaneni et al. 2007). The application of the percentage of stream flow method to an unmonitored area requires that the precipitation regime of the sewer system and watershed are consistent (Mikalson et al. 2012). The SUH method (Vallabhaneni et al. 2008) is highly dependent on the quality of hourly rainfall monitoring data. The rainfall/flow regression method for RDII estimation typically applies the multiple linear regression model, which is so sensitive to frequently occurring values that it affects the regression coefficients and interferes with the prediction results. Only if application storms are similar to storms for which predictive equations are generated, will the prediction accuracy of the traditional method be high. The choice of application storms used to determine the coefficients is subject to human subjective influence (Bennett 1999).

RDII estimation methods based on water quality parameters (Zhang et al. 2017) have also been applied in previous studies, such as using chemical oxygen demand (COD) (Bareš et al. 2012), total nitrogen (TN) and total phosphorus (TP) (Guo et al. 2022). Even though laboratory-based testing is a highly accurate method of determining water quality parameters, sample collection, transportation, and laboratory analysis usually take more time. Online monitoring technologies make it possible to collect data continuously and automatically, giving users instant access to metrics like rainfall and flow rates. In RDII research, this immediateness is beneficial, particularly when evaluating the dynamic responses of sewer systems to rainfall events. Online monitoring technologies offer a more efficient approach than traditional water quality assessment methods.

Some studies also employed hydrological models, such as the Antecedent Moisture Condition (AMC) model (Sadri & Graham 2011), MIKE URBAN (Borup et al. 2011) and applied mathematical models (Zhang 2007) combining flow data, inflow/infiltration ratio and autoregressive error models to simulate RDII processes and quantify RDII characteristics in sewer systems. However, they are not suitable for areas lacking necessary infrastructure data. The conductivity-based RDII identification method introduced by Zhang et al. (2018) employs an empirical and statistical approach, making it particularly effective in identifying abnormal flow situations. This technique capitalises on the acute sensitivity of conductivity measurements to detect dilution of wastewater by rainwater, offering a real-time and cost-efficient solution for monitoring sewer systems. However, it's important to note that the accuracy of this method can be influenced by the presence of other conductivity-altering substances, such as industrial discharges in the sewer, which necessitates a meticulous interpretation of the data.

Overflows and RDII are typical sewer processes that exhibit nonlinear patterns (Zhang 2008; Zhang et al. 2018). Various machine learning models have been used in numerous fields to identify nonlinear patterns (Finnis et al. 2012; Gholami et al. 2020; Huang et al. 2020) and have yielded excellent results. Particularly in environmental engineering, artificial neural network (ANN), M5 model tree, long short-term memory (LSTM) and k-nearest neighbour (kNN) were applied to simulate stormwater runoff from 16 green roofs across four Norwegian cities (Abdalla et al. 2021). The Autoregressive Integrated Moving Average (ARIMA) and Multilayer Perceptron Neural Network (MLPNN) were used for forecasting wastewater inflow in Barrie, Canada, with ARIMA showing slightly better performance than MLPNN (Zhang et al. 2019). In Vietnam, a deep learning neural network (DLNN) approach, combined with various geographical and environmental factors, was used to predict flash flood susceptibility in regions frequently affected by tropical storms (Bui et al. 2020). However, currently, there are limited studies using machine learning methods to estimate RDII in the combined and separate sewer systems (Mikalson et al. 2012; Zhang et al. 2018).

The same time span with a small time interval produces a large amount of data. Machine learning can effectively analyse massive data and identify hidden relationships in complex datasets (Senanayake et al. 2019). More available data implies better performance of the models. The hourly data used in some traditional methods mentioned above is not enough, and a large amount of data information has a positive effect on prediction. Moreover, machine learning is subject to less subjective judgment. A major advantage of machine learning is its ability to learn from expanding sets of data in order to predict or analyse the characteristics of a system (Rezapour et al. 2021). The ensemble of decision trees was used to produce reasonable prediction results in the random forest (RF) model, with each tree constructed from a randomly selected subset of the training dataset, ensuring a diversity of perspectives within the ensemble. This method effectively mitigates the risk of overfitting, a significant limitation often encountered in single decision tree models, by amalgamating the predictive insights from multiple trees. Consequently, the RF model enhances the robustness of the predictions, offering a more reliable approach to data analysis. This regression process was successfully completed by selecting and ranking related features, and the variation pattern of the target feature was summarised from the training set (Liu et al. 2012). Features with high importance and abundant information are selected from the input features to improve prediction accuracy. ANNs are another common machine learning algorithm for engineering problems. Any complex nonlinear relationship between inputs and outputs can be based on the excellent self-learning ability of neural networks to establish a model reflecting the sample variation pattern (Dongare et al. 2012). When dealing with a complex problem, ANNs usually outperform other models in terms of their fast convergence and powerful computing abilities. LSTM is a kind of ANN, which was proposed by Hochreiter & Schmidhuber (1997) to effectively solve problems of long-term dependences and gradient disappearance/explosion in recurrent neural networks (RNNs) (Yu et al. 2019).

This study aims to verify and develop reliable machine learning models that can be applied to predict sewer flow as well as estimate RDII and compare their performance to a traditional empirical approach. Tree ensemble model RF and deep learning model LSTM were applied to achieve the above-mentioned purpose based on rainfall and sewer flow monitoring data in the combined and separate sewer systems. The contributions of input features were examined by feature importance ranking, leading to a better understanding of the monitoring data. Modelling results were validated through those field observations, and subsequently compared with a traditional empirical approach to evaluate the applicability and accuracy of machine learning models. A discussion regarding the optimal frequency of sewer flow data to use in similar modelling was also conducted.

Data processing and feature engineering

For this study, two sites in Ningbo City, China were carefully chosen (Figure 1). The first site, known as the Bailong residential area, is situated in the Zhenhai District and encompasses a combined sewer system. The second site, referred to as the Wantou area, is located in the Jiangbei District and has a separate sewer system. Data pertaining to flow rate and rainfall were gathered from the online sewer monitoring system implemented at both sites. The pipe layouts and sewage flow directions of Bailong and Wantou are depicted in Figure 1(a) and 1(b), respectively. Manholes are located at the pipe connections. THWater's TWQ Series flow meters, which were initially calibrated using HACH FL900AV flow meters, are dispersed across these manholes. To record rainfall events, a Tipping-Bucket Rain Gauge (THR Series from THWater) with an accuracy of 0.2 mm was utilised. Sewage is pumped from the Bailong residential area to the WWTP via a pump station. The flow monitoring station, which is situated close to the outflow, measures the overall amount of sewage flowing through the community. The WWTP is where the sewage eventually ends (Chen et al. 2022). Monitoring activities were conducted within the Bailong residential area from August 1 to December 10, 2020, and within the Wantou area from November 3, 2021 to December 31, 2022. Throughout this monitoring period, data were collected at a frequency of 1 min.
Figure 1

Overview of the sewer network: (a) in Bailong and (b) in Wantou, Ningbo, China.

Figure 1

Overview of the sewer network: (a) in Bailong and (b) in Wantou, Ningbo, China.

Close modal
The raw dataset contains the sewer flow, temporal information, and rainfall measurement. The latter two were identified as the primary features in predicting sewer flow and the associated rain-derived inflow and infiltration. Feature engineering approaches were employed to extract supplementary input features, thereby augmenting the models with additional information. Notably, the dry weather flow (DWF) constitutes a vital constituent of sewer flow, characterised by the well-known diurnal pattern. Feature engineering approaches include four features, namely trigonometric transformations ‘the sine and cosine functions’, the lag feature ‘Prior Flow’ and rainfall. These are the independent features used to estimate the dependent feature of sewage flow. The diurnal pattern of DWF was captured using the sine and cosine functions as dual inputs. By using trigonometric transformations, we may more accurately simulate the cyclic behaviour in DWF and enhance the temporal accuracy of models. The equation for this can be expressed mathematically as Equation (1).
(1)
where DWFt is DWF at time t, a and b are amplitude coefficients, and f represents the frequency of the 24-h cycle.
The flow that was observed 5 min before the current observation as a lagged feature is called Prior Flow. Mathematically, if Ft denotes the flow at time t, Prior Flow at time t is expressed as Ft−1. This feature helps in comprehending how the immediate past conditions have influenced the current flow. The rainfall is an external feature in the model. It has a significant impact on sewer flow, especially during and after rainfall events. To assess the efficacy of the features in modelling the sewer flow pattern, a sequential forward feature selection method was utilised to identify the most pertinent features from the entire dataset. The process commences with an empty feature set and progressively incorporates the optimal features (Marcano-Cedeño et al. 2010; Mayer et al. 2018). LSTMs can automatically extract and learn temporal properties from sequence data. They are capable of identifying significant patterns or features in sequence data, hence feature engineering was not added manually in this study. The principal methods for model development and evaluation are encapsulated in the diagram depicted in Figure 2.
Figure 2

Methodological framework.

Figure 2

Methodological framework.

Close modal

Model development

In this study, the RF model and LSTM model were constructed. The features affecting sewer flow need to be determined and then a model developed. Rainfall was assumed as a dominant feature and the other features ‘sine and cosine functions’ and ‘Prior Flow’ was added. Based on these data, the prediction of sewage flow variation is known as the supervised learning process. RF model is a tree ensemble model and was developed to focus on reducing variance. Its performances were compared with the deep learning model LSTM.

Estimates of RDII can be obtained by subtracting the statistical mean DWF from the wet weather flow (WWF). Therefore, the accuracy of RDII estimation is highly dependent on the performance of total sewer flow modelling.

Indicators used in this study for evaluating models are mean absolute error (MAE), mean square error (MSE) and coefficient of determination (R2) (Yang et al. 2020; Keramat-Jahromi et al. 2021). Equations (2) to (4) are used to calculate the mentioned indicators. The smaller values of MAE and MSE imply higher model accuracy. Note that R2 value close to 1 indicates a good match between the observed values and the predicted ones. The selection of MAE was based on its interpretive simplicity and clarity. It allows for an intuitive comprehension of the model's accuracy independent of error direction by giving a direct average of the absolute errors in the forecasts. MSE emphasises penalising greater errors by squaring the differences before averaging, which guarantees the model's resilience to large deviations and is essential for accurate forecasts in the context of this study. The explanatory power of the model was evaluated using R2, which shows how much of the variance in the dependent feature can be predicted from the independent features.
(2)
(3)
(4)
where is the predicted value, is the observed value, is the average of observed value, n is the total number of data.

RF model

RF is an algorithm that randomly samples different subsets from the provided data and integrates multiple decision trees (Kang & Ryu 2019). It can be competent to determine the importance of features when there are many features in the data, and the RF model has an anti-overfitting ability (Baareh et al. 2021). The RF model represents all possible outcomes of a decision using a branching method based on ensemble learning. Each decision tree is trained through the training dataset. All the features of the sample are tested in turn. As each test is completed, a branch node will be assigned according to the results, thereby classifying samples. A decision tree's final outcome is determined by the average of its prediction results or the result that is supported by the majority of decision trees (Figure 3).
Figure 3

The common structure of RF.

Figure 3

The common structure of RF.

Close modal

There are three important hyperparameters to consider when optimising the RF model, including max_features (maximum number of features used on each node), max_depth (maximum depth that a tree can be formed) and n_estimators (the number of trees). Hyperparameter optimisation aims to reduce the complexity of the model and increase model accuracy. The grid search method in the sklearn library offering a range of tools for data analysis, was adopted to conduct parameter tuning (Wang et al. 2019; Sun et al. 2020).

LSTM model

ANN is a kind of computer algorithm that is designed to simulate human thoughts. The ANN is made up of interconnected nodes, or neurons, which are designed to mimic the behaviour of individual neurons in the human brain. The core structure of an ANN includes the input layer, hidden layers and the output layer. During the training process, information will be transferred from the input layer to the output layer, with data processed in the hidden layers by activation functions. Weights will be altered with iterations using the gradient descent algorithm (Chen et al. 2021), which helps find parameter values that minimise the cost function towards a local minimum or optimal accuracy. RNN is one class of typical neural networks, which is often used to cope with time series prediction (Sutskever et al. 2014). LSTM (Hochreiter & Schmidhuber 1997) is an enhanced version of RNN, which adds three gates to control the transmission of information on the basis of RNN, namely, the forget gate, the input gate and the output gate (Sherstinsky 2020) and solves some disadvantages of RNN mentioned in the introduction section. The LSTM structure is shown in Figure 4 and Equations (5)–(10) define the inputs and outputs through activation functions with parameter matrices. The output gate controls information on external output . The forget gate decides whether information can flow from state to state. The input gate determines the key information storage and allows information to be input to state (Liu et al. 2020). Weight matrices w and bias vectors b are included in every gate control equation, which is to obtain the most appropriate value in the training process.
(5)
(6)
(7)
(8)
(9)
(10)
where i, f, o, c and g are the input gate, forget gate, output gate, cell activation and input modulation gate vectors, respectively; h is the hidden value, σ is the sigmoid activation function and is the activation function. The term is the input to the cell layer; , , , and are weight matrices; , , , and are bias vectors.
Figure 4

The common structure of an LSTM unit.

Figure 4

The common structure of an LSTM unit.

Close modal

In the study, the model is a sequential Keras model (Joshi et al. 2020) made up of a dense output layer with a sigmoid activation function, a bidirectional LSTM layer with 128 hidden units, and a 0.2 dropout rate. The Adam optimiser (Nwankpa 2020) and mean squared error loss function are used in its compilation. Using a different test set, the training process is verified after 45 epochs with a batch size of 300. To help with the evaluation of model performance, plot training and validation losses to visualise learning curves.

The optimisation of the LSTM model was accomplished by adjusting epoch (the training number) and batch size (the sample number) based on the Bayesian optimisation algorithm (Mockus 1989) in this study. The number of epochs refers to the total number of forward and backward passes of the training dataset through the LSTM network. A low number of epochs can lead to underfitting, whereas an excessive number of epochs can cause overfitting. The ideal number of epochs that balances model performance and training efficiency can be found with the use of Bayesian optimisation. The term ‘batch size’ describes how many training samples an optimisation process uses in a single iteration. While smaller batches can result in faster convergence, they also produce more noise when being trained. Although they may be slower and need more memory, larger batch sizes offer more consistent gradient changes. Batch sizes that offer the optimal balance between learning effectiveness and computational resource consumption can be found with the use of Bayesian optimisation.

The procedure for applying Bayesian optimisation to an LSTM model's hyperparameter can be summed up as follows:

It is necessary to define an objective function first. The loss function is the objective function of optimisation in the LSTM model. This function, which offers a means of assessing the effectiveness of various hyperparameter combinations, is fundamental to the optimisation process. A few randomised studies were carried out to gather preliminary results. For Bayesian optimisation algorithms, the data serve as the foundation, enabling the algorithm to start comprehending the behaviour of the objective function.

In iterative optimisation, the Bayesian optimisation algorithm chooses the subsequent set of hyperparameters to assess based on the present model. The epoch count and batch size of the LSTM model are considered hyperparameters. The LSTM model is trained and assessed subsequent to the selection of each set of hyperparameters. The Bayesian model is updated using these fresh evaluation results. The optimisation algorithm can progressively develop a more precise understanding of the objective function's behaviour by repeating this approach. Until a predetermined number of iterations is reached or the model's performance achieves a predetermined convergence threshold, the iterative process is repeated. Ultimately, an ideal set of hyperparameters will be discovered upon completion of the optimisation procedure. In addition, the goal of training or optimising neural networks is to minimise the loss function and increase prediction accuracy. A learning curve illustrates a model's performance over time as it learns from data in machine learning. In order to prevent overfitting, this plot indicates when to cease training and recommends the ideal number of training epochs. Plotting the loss rate as a performance parameter on the y-axis against the quantity of training data or number of iterations (epochs) on the x-axis typically provides important insights into the learning process of the model. The model's underfitting (high losses on both training and validation data), overfitting (training loss decreases while the validation loss increases), or discovering a good balance is indicated by the curve's shape. When training loss and validation loss tend to be constant on the loss curve during the descent process, the model can be considered as converged. Further optimisation of the model may be needed in other situations (Domingo et al. 2022).

Feature importance ranking

In this investigation, the flow and rainfall data, originally collected at a 1-min interval, were transformed into a 5-min interval dataset for analysis. This conversion was necessary due to the presence of considerable noise in the original high-frequency dataset. Figure 5 illustrates the monitored sewer flow and rainfall over time. During dry weather, a conspicuous diurnal pattern of sewer flow was discerned. The increases in sewer flow during wet weather can be attributed to the influence of rainfall on the sewer system.
Figure 5

Sewer flow and rainfall time series data: (a) Bailong from August 1 to December 10, 2020; (b) Wantou from November 3, 2021 to December 31, 2022.

Figure 5

Sewer flow and rainfall time series data: (a) Bailong from August 1 to December 10, 2020; (b) Wantou from November 3, 2021 to December 31, 2022.

Close modal
In Bailong, where both the initial autocorrelation coefficient and subsequent ones exceed 0.8, while all remain outside the 95% confidence interval, this situation reveals a compelling degree of autocorrelation within the dataset (Figure 6). The autocorrelation coefficients exceeding 0.8 signify a robust positive linear relationship between each data point and its lagged predecessors.
Figure 6

Autocorrelation analysis of sewage flow in Bailong and Wantou. The lag is indicated on the horizontal axis (each lag is 5 min), and the value of the autocorrelation coefficient indicates the degree of correlation on the vertical axis. The light blue shaded part represents 95% confidence interval.

Figure 6

Autocorrelation analysis of sewage flow in Bailong and Wantou. The lag is indicated on the horizontal axis (each lag is 5 min), and the value of the autocorrelation coefficient indicates the degree of correlation on the vertical axis. The light blue shaded part represents 95% confidence interval.

Close modal

The key observation lies in the fact that these coefficients transcend the bounds of the 95% confidence interval, signifying their statistical significance. Such statistical significance suggests that these correlations are unlikely to be the result of random noise, thus indicating the presence of systematic and persistent patterns or influences within the data. In practical terms, this strong autocorrelation bears considerable implications for data forecasting and decision-making.

In Wantou, where the first autocorrelation coefficient surpasses 0.6, followed by subsequent coefficients exceeding 0.5, but with a subsequent decline to around 0.3, all while remaining outside the 95% confidence interval, a nuanced autocorrelation pattern emerges (Figure 6). The initial autocorrelation value of 0.6 denotes a relatively strong positive correlation between the current observation and the previous one. As subsequent coefficients also exceed 0.5 and fall outside the confidence interval, they underscore the persistence and significance of this autocorrelation.

The observed decline in autocorrelation coefficients beyond a certain lag suggests a temporal weakening of this relationship. This decline to around 0.3 may indicate that the impact of past observations on the current one diminishes as the lag increases. While the autocorrelation coefficients remain statistically significant beyond the confidence interval, this evolving pattern necessitates a more nuanced interpretation. It suggests that there is a time-dependent influence on the data, but this influence wanes as the temporal gap widens.

There is more flow fluctuation in combined systems since stormwater and sanitary sewage are transported through the same pipes. The weather, particularly rainfall, has a major impact on this alteration since it can lead to abrupt and significant increases in flow. Such variability results in a complex flow pattern with higher autocorrelation, especially during consistent weather patterns like a rainy season. However, flow autocorrelation is less in separate systems that isolate household wastewater from stormwater. The sanitary flow is more dependable and stable, largely influenced by human usage patterns, and resistant to variations caused by the weather. This causes the flow pattern to become more consistent, which lowers autocorrelation in sanitary flow.

The feature importance ranking aids in comprehending the relationship between independent features and dependent features. A high feature importance signifies a substantial contribution to the accuracy of model predictions. It is important to note that the comparatively lower importance of the remaining features does not imply a lack of informative value. It is possible that these features contain similar information to other features, resulting in a minor impact on the split nodes of each tree and consequently, a lower weight. Consequently, they may not be selected by a significant number of trees. Following the sequential forward feature selection process, the optimal feature combination for the RF model encompasses all the aforementioned features.

The importance ranking of features used in the modelling process is shown in Figure 7. As anticipated, Prior Flow emerges as the foremost influential feature in predicting sewer flow using the RF model, primarily due to the pronounced diurnal pattern exhibited by the dominant feature, namely the DWF. Conversely, the other three features exhibit relatively lower importance, primarily owing to the limited occurrence of wet days within the selected timeframe. The marginal assistance provided by the two trigonometric functions in enhancing prediction results is evident in the outcomes of the feature selection process.
Figure 7

Feature importance ranking in the RF model.

Figure 7

Feature importance ranking in the RF model.

Close modal

Model prediction analysis

Table 1 displays the evaluation metrics of the RF model and LSTM model. The performance of both models is commendable on both the training and testing datasets. The R2 values for both models exceed 0.8, indicating a high level of prediction accuracy. The close agreement between the evaluation indices of the predicted and observed values suggests that the models do not suffer from issues of overfitting or underfitting. Figure 8 presents the prediction results for a randomly selected day in Bailong and Wantou. The models demonstrate strong performance in forecasting both the DWF and the WWF, with the LSTM model outperforming the RF model by exhibiting a smaller deviation between the predicted and observed values. The loss curve of the LSTM model (Figure 9) demonstrates a tendency towards stability and convergence.
Table 1

Evaluation of performance indicators for different models (train set vs. test set 7:3)

ModelSiteData typeMAEMSER2
RF Bailong Train 1.221 2.918 0.899 
Test 1.388 4.053 0.863 
Wantou Train 0.414 0.403 0.992 
Test 1.124 2.959 0.945 
LSTM Bailong Train 1.401 3.768 0.889 
Test 1.428 3.740 0.800 
Wantou Train 0.927 1.914 0.928 
Test 1.649 8.609 0.918 
ModelSiteData typeMAEMSER2
RF Bailong Train 1.221 2.918 0.899 
Test 1.388 4.053 0.863 
Wantou Train 0.414 0.403 0.992 
Test 1.124 2.959 0.945 
LSTM Bailong Train 1.401 3.768 0.889 
Test 1.428 3.740 0.800 
Wantou Train 0.927 1.914 0.928 
Test 1.649 8.609 0.918 
Figure 8

Sewer flow prediction on four selected dates: (a) August 27, 2020 in Bailong; (b) September 14, 2020 in Bailong; (c) April 13, 2022 in Wantou; (d) August 30, 2022 in Wantou.

Figure 8

Sewer flow prediction on four selected dates: (a) August 27, 2020 in Bailong; (b) September 14, 2020 in Bailong; (c) April 13, 2022 in Wantou; (d) August 30, 2022 in Wantou.

Close modal
Figure 9

Learning curve (Loss) for the LSTM model.

Figure 9

Learning curve (Loss) for the LSTM model.

Close modal

Table 2 illustrates the model performance before and after optimisation in two sites. RF model and LSTM model performed well and consistently in the training set and the test set. The optimum parameters after model optimisation are presented in Table 3. After optimisation, the accuracy of the model on the training set was reduced, while the accuracy on the test set increased. The model development process shows that the accuracy of machine learning models can be improved by optimising the hyperparameters. However, through a series of trials, taking MAE value as an example, the value of MAE reduces by around 0.1 L/s at most. The effect of optimisation on the improvement of model accuracy can be regarded as negligible. In fact, it is quite difficult to improve the accuracy of the RF model as expected, to achieve the level of LSTM through hyperparameter optimisation for the tree ensemble model. Nonetheless, if the model is expected to greatly improve accuracy, independent features that have strong correlations with the dependent feature need to be added, such as water level and conductivity (Zhang et al. 2018), or the length of the time series is increased.

Table 2

Evaluation of model performance on the dataset for two chosen dates

ModelDescriptionSiteData typeMAEMSER2
RF Before optimisation Wantou Train 1.104 2.718 0.950 
Test-Apr. 13, 2022 1.039 1.882 0.834 
Test-Aug. 30, 2022 1.295 3.917 0.941 
Bailong Train 0.629 0.785 0.973 
Test-Aug. 27, 2020 1.751 7.256 0.858 
Test-Sep. 14, 2020 1.825 7.562 0.950 
After optimisation Wantou Train 1.122 2.825 0.948 
Test-Apr. 13, 2022 1.012 1.795 0.842 
Test-Aug. 30, 2022 1.245 3.366 0.949 
Bailong Train 1.283 3.125 0.892 
Test-Aug. 27, 2020 1.588 6.754 0.868 
Test-Sep. 14, 2020 1.660 6.248 0.959 
LSTM Wantou Train 1.069 2.686 0.951 
Test-Apr. 13, 2022 0.904 1.422 0.875 
Test-Aug. 30, 2022 1.433 5.169 0.962 
Bailong Train 1.381 3.721 0.870 
Test-Aug. 27, 2020 1.326 4.110 0.917 
Test-Sep. 14, 2020 1.507 5.018 0.967 
ModelDescriptionSiteData typeMAEMSER2
RF Before optimisation Wantou Train 1.104 2.718 0.950 
Test-Apr. 13, 2022 1.039 1.882 0.834 
Test-Aug. 30, 2022 1.295 3.917 0.941 
Bailong Train 0.629 0.785 0.973 
Test-Aug. 27, 2020 1.751 7.256 0.858 
Test-Sep. 14, 2020 1.825 7.562 0.950 
After optimisation Wantou Train 1.122 2.825 0.948 
Test-Apr. 13, 2022 1.012 1.795 0.842 
Test-Aug. 30, 2022 1.245 3.366 0.949 
Bailong Train 1.283 3.125 0.892 
Test-Aug. 27, 2020 1.588 6.754 0.868 
Test-Sep. 14, 2020 1.660 6.248 0.959 
LSTM Wantou Train 1.069 2.686 0.951 
Test-Apr. 13, 2022 0.904 1.422 0.875 
Test-Aug. 30, 2022 1.433 5.169 0.962 
Bailong Train 1.381 3.721 0.870 
Test-Aug. 27, 2020 1.326 4.110 0.917 
Test-Sep. 14, 2020 1.507 5.018 0.967 
Table 3

Parameter values after model optimisation

RF
n_estimatorsmax_featuresmax_depth
200 10 
LSTM   
batch_size epochs  
300 45  
RF
n_estimatorsmax_featuresmax_depth
200 10 
LSTM   
batch_size epochs  
300 45  

MAE and MSE of LSTM model results were the smallest, while R2 was the largest, which further demonstrates that LSTM has relatively high accuracy. R2 values in the test set were above or close to 0.9 on both sites in the LSTM model and RF model.

In reality, the accuracy of the tree ensemble model is low without adding the feature of Prior Flow. In the RF model, R2 before adding the feature Prior Flow does not exceed 0.5. After adding the feature Prior Flow to the non-optimised model, R2 increases to over 0.8 and even exceeds 0.9. The accuracy of the RF model has been greatly improved, which is close to the LSTM model. The same findings can also be reached using other evaluation indices. This is due to the fact that the flow rate in the time series correlates with itself over different time periods. The majority of sewer flow data comes from dry weather days. Additionally, due to the lack of other significant independent features directly correlating to the dependent feature, strong autocorrelation is a leading factor in improving the prediction accuracy in the tree ensemble model in this study. In other words, if there are other independent features that are very relevant to the dependent feature, they will be more decisive in improving the accuracy of the model. Autocorrelation may lose its dominant role. Autoregressive models use historical data of the feature itself to predict future values (Singh & Mohapatra 2019). Despite the low percentage of dates with rainfall in the selected sample, rainfall is still needed as an external feature to respond to the sudden increase in sewer flow. ARIMA, a popular statistical model for time series forecasting, performs optimally with data exhibiting clear trends or seasonal patterns. However, as Wang & Jiang (2019) note, ARIMA, being an autoregressive model, necessitates a stationary time series and struggles with nonlinear forecasting patterns, which are prevalent in our dataset. Additionally, ARIMA's effectiveness may diminish when applied to large datasets with diverse input features. These limitations are key reasons why the ARIMA model was not employed in this study.

In contrast, long-term dependencies and nonlinear relationships in time series data are well captured by LSTM, which makes it particularly well-suited for our work that involves analysing complex patterns over extended durations. Its capability to process entire sequences of data comprehensively aligns ideally with the demands of this study. Likewise, renowned for its resilience and adaptability, RF is advantageous in handling diverse data types and configurations. Relative to single decision tree models, the ensemble approach characterised by the aggregation of multiple decision trees, yields enhanced accuracy and more effectively manages overfitting.

Generally, the LSTM model is capable of predicting the temporal pattern of RDII with satisfactory accuracy for a wide range of rainfall events. The LSTM model was used to predict the sewer flow of eight selected typical rainfall events in two sites (Figure 10). DWF at every time of the day was computed by averaging the values of all dry days within the same month. The difference between DWF and WWF was considered RDII. RDII obtained this way might be negative for smaller amounts of rainfall since the calculated DWF may exceed the observed DWF depending on the weather and other unknown features. The estimated amount of RDII under different rainfall events during the monitoring period is shown in Figure 12. Rainfall has a good linear relationship with the corresponding RDII in simulated and observed results in Bailong. This can be attributed to the fact that rainfall directly impacts infiltration and inflow. The maximum relative errors were less than 7% after calculation, indicating that the assessment of RDII amount using machine learning is more accurate than the R-value method in Chen et al. (2022).
Figure 10

Simulating sewer flow for four typical storm events with rainfall depth in Bailong: (a) 9.5 mm on Oct 4; (b) 17 mm on Aug 27; (c) 38.4 mm on Sep 14; (d) 52.6 mm on Sep 18.

Figure 10

Simulating sewer flow for four typical storm events with rainfall depth in Bailong: (a) 9.5 mm on Oct 4; (b) 17 mm on Aug 27; (c) 38.4 mm on Sep 14; (d) 52.6 mm on Sep 18.

Close modal
In Wantou and Bailong, the sewage flow significantly increases in response to rainfall. The separate sewer system is located in Wantou, therefore it is inferred that there may be problems with rainwater and sewage mixed connection or structural defects in the sewage pipeline. After the rainfall disappears, the sewage flow in the Bailong quickly decrease to coincide with DWF. However, it takes about 2–3 days for the sewage flow in Wantou to be similar to DWF (Figure 11).
Figure 11

Simulating sewer flow for four typical storm events with rainfall depth in Wantou: (a) 20.5 mm on Nov 29, 2021; (b) 32.5 mm on Nov 7, 2021; (c) 50 mm on Mar 21, 2022; (d) 78.5 mm on Aug 30, 2022.

Figure 11

Simulating sewer flow for four typical storm events with rainfall depth in Wantou: (a) 20.5 mm on Nov 29, 2021; (b) 32.5 mm on Nov 7, 2021; (c) 50 mm on Mar 21, 2022; (d) 78.5 mm on Aug 30, 2022.

Close modal
Figure 12

Estimating total volume of RDII for different rainfall events using the LSTM model: (a) in Bailong and (b) in Wantou.

Figure 12

Estimating total volume of RDII for different rainfall events using the LSTM model: (a) in Bailong and (b) in Wantou.

Close modal

The RDII in a separate sewer system is mainly related to infiltration and inflow in sanitary sewage systems. This situation may occur when there are defects in the sewer pipeline, such as cracks or joints, that allow rainwater to enter the sewer systems. In addition, groundwater may seep into the sewer system through damaged pipes or manholes. In a combined sewer system, RDII is the direct result of the combined flow of stormwater runoff, inflow, and infiltration during rainfall events.

In a separate sewage system, according to the design of the system, the diverted rainwater is usually sent to separate treatment facilities, detention ponds, or natural water bodies. RDII related to diverted stormwater is treated or managed separately from sanitary sewage. Due to inflow and infiltration, RDII in the sanitary sewage may still occur, but it should be lower compared to the combined sewer system during the same rainfall event. After the rainfall event subsides, the separate system will gradually return to normal flow conditions.

The relationship between rainfall and RDII exhibits a strong linearity within the context of a separate sewage system as shown in Yap & Ngien (2017). However, there are instances of data points deviating from the trendline in Wantou (Figure 12). This discrepancy may be attributed to the RDII data derived from the difference in flow rates between wet and dry days. It is likely that the selected pattern for DWF does not perfectly align with the actual DWF observed on the day of the rainfall event. In essence, DWF in Wantou examined in this study did not consistently conform to a similar pattern at certain times.

This study aims to conduct RDII assessment based on monitoring data with machine learning methods. Machine learning models can predict flow under both wet- and dry-weather conditions with better accuracy, and then RDII is estimated under different storm events. RDII is a common problem in sewer systems. An accurate assessment of RDII can better cope with sewer backflow and overflow, and provide references for decision-makers in planning and management. The performance of machine learning depends on the ability of algorithms to convert datasets into regression models. The model is much easier to train and to estimate accurately when the dataset has strong regularity.

The impact of time resolution on model accuracy

The time interval of the monitoring data selected in this study was 5 min, while the monitoring interval of the sensors installed in the sewer system was 1 min. The model accuracy was also tested by resampling data of 5, 10, 20, 30 and 60 min. In Table 4, the results of two models show that the highest accuracy occurs when using the 5-min dataset. There is a general tendency for the accuracy of the model to decrease as the monitoring frequency decreases. R2 decreases with an increase in monitoring interval from 5 to 60 min in the RF model (0.154) and LSTM model (0.222) in Bailong and in the RF model (0.208) and LSTM model (0.225) in Wantou. The LSTM model reduces accuracy more than the RF model. Other evaluation indices are consistent with this outcome. This may be due to a reduction in information available from the training set, and a higher probability that the rule in the test set has not been learned. It should be noted that a smaller monitoring frequency helps increase the availability of information, but it also increases running time.

Table 4

Comparison of the evaluation indices in test set at different monitoring frequencies (train/test = 7/3)

ModelSiteIndices5 min10 min20 min30 min60 min
RF Wantou MAE 1.151 1.352 1.576 1.811 2.429 
MSE 3.060 4.225 5.878 7.718 14.243 
R2 0.943 0.919 0.890 0.862 0.735 
Bailong MAE 1.423 1.614 1.711 1.688 1.880 
MSE 3.832 4.910 5.298 5.253 6.489 
R2 0.794 0.735 0.649 0.680 0.640 
LSTM Wantou MAE 1.649 2.099 2.395 2.759 3.584 
MSE 8.609 11.308 14.924 19.809 32.287 
R2 0.918 0.892 0.857 0.811 0.693 
Bailong MAE 1.428 1.604 1.844 2.020 2.170 
MSE 3.740 4.578 5.686 6.777 7.793 
R2 0.800 0.749 0.685 0.638 0.578 
ModelSiteIndices5 min10 min20 min30 min60 min
RF Wantou MAE 1.151 1.352 1.576 1.811 2.429 
MSE 3.060 4.225 5.878 7.718 14.243 
R2 0.943 0.919 0.890 0.862 0.735 
Bailong MAE 1.423 1.614 1.711 1.688 1.880 
MSE 3.832 4.910 5.298 5.253 6.489 
R2 0.794 0.735 0.649 0.680 0.640 
LSTM Wantou MAE 1.649 2.099 2.395 2.759 3.584 
MSE 8.609 11.308 14.924 19.809 32.287 
R2 0.918 0.892 0.857 0.811 0.693 
Bailong MAE 1.428 1.604 1.844 2.020 2.170 
MSE 3.740 4.578 5.686 6.777 7.793 
R2 0.800 0.749 0.685 0.638 0.578 

In this study, two machine learning algorithms, RF and LSTM, were used to predict sewer flow in combined and separate sewer systems, and then the RDII was further analysed using the estimated DWF. The two proposed models all achieved high accuracy in sewer flow prediction while the LSTM model outperformed the RF model. Compared with the traditional methods in the previous literature, machine learning models were capable of providing reliable estimates of the sewer flow rate and RDII, and outputting importance ranking of the related features in sewer flow modelling. To further improve the prediction accuracy, future work should focus on examining the effectiveness of more relevant features to sewer flows, such as water level, conductivity, and exploring the potential of more advanced machine learning models in sewer modelling.

This work was funded by the National Key R&D Programme of China (2022YFC3203200), the Key Research and Development Programme of Zhejiang Province (2020C03082), and the Key Research and Development Programme of Ningbo (2023Z216). The corresponding author was also supported by the Ningbo Young Technology Innovation Leading Talent Programme (2023QL029).

All relevant data are included in the paper or its Supplementary Information.

The authors declare there is no conflict.

Abdalla
E. M. H.
,
Pons
V.
,
Stovin
V.
,
De-Ville
S.
,
Fassman-Beck
E.
,
Alfredsen
K.
&
Muthanna
T. M.
2021
Evaluating different machine learning methods to simulate runoff from extensive green roofs
.
Hydrol. Earth Syst. Sci.
25
(
11
),
5917
5935
.
Baareh
A. K.
,
Elsayad
A.
&
Al-Dhaifallah
M.
2021
Recognition of splice-junction genetic sequences using random forest and Bayesian optimization
.
Multimed. Tools Appl.
80
(
20
),
30505
30522
.
Bareš
V.
,
Stránský
D.
&
Sýkora
P.
2012
Evaluation of sewer infiltration/inflow using COD mass flux method: Case study in Prague
.
Water Sci. Technol.
66
(
3
),
673
680
.
Bennett
D.
1999
Using Flow Prediction Technologies to Control Sanitary Sewer Overflows
.
Water Environment Research Foundation, Alexandria, VA, USA
.
Borup
M.
,
Grum
M.
&
Mikkelsen
P. S.
2011
Real time adjustment of slow changing flow components in distributed urban runoff models
. In:
Proceedings of the 12th International Conference on Urban Drainage
,
Porto Alegre, Brazil
, Vol.
1116
, p.
8
.
Bui
D. T.
,
Hoang
N. D.
,
Martínez-Álvarez
F.
,
Ngo
P. T. T.
,
Hoa
P. V.
,
Pham
T. D.
,
Samui
P.
&
Costache
R.
2020
A novel deep learning neural network approach for predicting flash flood susceptibility: A case study at a high frequency tropical storm area
.
Sci. Total Environ.
701
,
134413
.
Chen
X.
,
Huang
B.
,
Zhang
S.
,
Liu
J.
,
Qian
Y.
,
Wang
C.
&
Zhu
D. Z.
2022
Performance evaluation of sewer system upgrade in an old residential area in Ningbo, China
.
J. Environ. Eng.
148
(
8
),
04022044
.
Crawford
D.
,
Eckley
P. L.
&
Pier
E.
1999
Methods for estimating inflow and infiltration into sanitary sewers
.
J. Water Manag. Modelling
7, 299–315.
Domingo
J. D.
,
Gómez-García-Bermejo
J.
&
Zalama
E.
2022
Optimization and improvement of a robotics gaze control system using LSTM networks
.
Multimed. Tools Appl.
81
(
3
),
3351
3368
.
Dongare
A. D.
,
Kharde
R. R.
&
Kachare
A. D.
2012
Introduction to artificial neural network
.
Int. J. Eng. Innov. Technol.
2
(
1
),
189
194
.
Finnis
J.
,
Hsieh
W. W.
,
Lin
H.
&
Merryfield
W. J.
2012
Non-linear post-processing of numerical seasonal climate forecasts
.
Atmos.-Ocean
50
(
2
),
207
218
.
Gholami
H.
,
Mohammadifar
A.
,
Bui
D. T.
&
Collins
A. L.
2020
Mapping wind erosion hazard with regression-based machine learning algorithms
.
Sci Rep
10
(
1
),
1
16
.
Guo
S.
,
Ding
R.
,
Huang
B.
,
Zhu
D. Z.
,
Zhou
W.
&
Li
M.
2022
Experimental study on three simple tracers for the assessment of extraneous water into sewer systems
.
Water Sci. Technol.
85
(
2
),
633
644
.
Hochreiter
S.
&
Schmidhuber
J.
1997
Long short-term memory
.
Neural Comput.
9
(
8
),
1735
1780
.
Joshi
D.
,
Anwarul
S.
&
Mishra
V.
2020
Deep leaning using keras
. In:
Machine Learning and Deep Learning in Real-Time Applications
(Mahrishi, M., Hiran, K., Meena, G. & Sharma, P., eds.)
.
IGI Global
, Hershey, PA, USA, pp.
33
60
.
Keramat-Jahromi
M.
,
Mohtasebi
S. S.
,
Mousazadeh
H.
,
Ghasemi-Varnamkhasti
M.
&
Rahimi-Movassagh
M.
2021
Real-time moisture ratio study of drying date fruit chips based on on-line image attributes using kNN and random forest regression methods
.
Measurement
172
,
108899
.
Lai
F. H.
2008
Review of Sewer Design Criteria and RDII Prediction Methods
.
United States Environmental Protection Agency
,
Washington, DC
, USA, p.
30
.
Liu
Y.
,
Wang
Y.
&
Zhang
J.
2012
New machine learning algorithm: Random forest
. In:
International Conference on Information Computing and Applications
(Liu, B., Ma, M. & Chang, J., eds.).
Springer
,
Berlin, Heidelberg
, Germany, pp.
246
252
.
Marcano-Cedeño
A.
,
Quintanilla-Domínguez
J.
,
Cortina-Januchs
M. G.
&
Andina
D.
2010
Feature selection using sequential forward selection and classification applying artificial metaplasticity neural network
. In:
IECON 2010-36th Annual Conference on IEEE Industrial Electronics Society
. pp.
2845
2850
.
Mayer
J.
,
Rahman
R.
,
Ghosh
S.
&
Pal
R.
2018
Sequential feature selection and inference using multi-variate random forests
.
Bioinformatics
34
(
8
),
1336
1344
.
Mikalson
D.
,
Guo
Y.
&
Adams
B. J.
2012
Rainfall derived inflow and infiltration modeling approaches
.
J. Water Manag. Modelling
R245–08, 127–140.
Mockus
J.
1989
The application of Bayesian methods
. In:
Bayesian Approach to Global Optimization: Theory and Applications
(Hazewinkel, M., Kirilloy, A., Manin, Y., Moiseey, N., Novikoy, S., Polyvanoy, M. & Rozanoy, Y., eds.). 37,
157
196
.
Nwankpa
C. E.
2020
Advances in optimisation algorithms and techniques for deep learning. Advances in science
.
Technol. Eng. Syst. J.
5
(
5
),
563
577
.
Rezapour
M.
,
Farid
A.
,
Nazneen
S.
&
Ksaibati
K.
2021
Using machine leaning techniques for evaluation of motorcycle injury severity
.
IATSS Res.
45
(
3
),
277
285
.
Sadri
S.
&
Graham
E.
2011
Development of an antecedent moisture condition model for prediction of Rainfall-Derived Inflow/Infiltration (RDII)
. In
AGU Fall Meeting Abstracts
, Vol.
2011
, pp.
H53J
1547
.
Senanayake
S.
,
White
N.
,
Graves
N.
,
Healy
H.
,
Baboolal
K.
&
Kularatna
S.
2019
Machine learning in predicting graft failure following kidney transplantation: A systematic review of published predictive models
.
Int. J. Med. Inform.
130
,
103957
.
Sutskever
I.
,
Vinyals
O.
&
Le
Q. V.
2014
Sequence to sequence learning with neural networks
.
Adv. Neural Inf. Process. Syst.
27,
3104
3112
.
Vallabhaneni
S.
,
Chan
C. C.
&
Burgess
E. H.
2007
Computer Tools for Sanitary Sewer System Capacity Analysis and Planning
.
US Environmental Protection Agency, Office of Research and Development
,
Washington, DC, USA
.
Vallabhaneni
S.
,
Lai
F. H.
,
Chan
C.
,
Burgess
E. H.
&
Field
R.
2008
SSOAP – a USEPA toolbox for SSO analysis and control planning
. In:
World Environmental and Water Resources Congress 2008: Ahupua'A
(Babcock, R. & Walton, R., eds), Reston, VA, USA, 316,
1
10
.
Yu
Y.
,
Si
X.
,
Hu
C.
&
Zhang
J.
2019
A review of recurrent neural networks: LSTM cells and network architectures
.
Neural Comput.
31
(
7
),
1235
1270
.
Zhang
M.
,
Liu
Y.
,
Dong
Q.
,
Hong
Y.
,
Shi
H.
&
Yuan
Z.
2017
Estimating rainfall-induced inflow and infiltration in a sanitary sewer system based on water quality modelling: Which parameter to use?
Water Sci. Technol.
4
(
3
),
385
393
.
Zhang
Q.
,
Li
Z.
,
Snowling
S.
,
Siam
A.
&
El-Dakhakhni
W.
2019
Predictive models for wastewater flow forecasting based on time series analysis and artificial neural network
.
Water Sci. Technol.
80
(
2
),
243
253
.
This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY-NC-ND 4.0), which permits copying and redistribution for non-commercial purposes with no derivatives, provided the original work is properly cited (http://creativecommons.org/licenses/by-nc-nd/4.0/).