Machine learning model development for predicting aeration efficiency through Parshall flume

This study compares several advanced machine learning models to obtain the most accurate method for predicting the aeration efficiency (E20) through the Parshall flume. The required dataset is obtained from the laboratory tests using different flumes fabricated in National Institute Technology Kurukshetra, India. Besides, the potential of K Nearest Neighbor (KNN), Random Forest Regression (RFR), and Decision Tree Regression (DTR) models are evaluated to predict the aeration efficiency. In this way, several input combinations (e.g. M1-M15) are provided using the laboratory parameters (e.g. W/L, S/L, Fr, and Re). Different predictive models are obtained based on those input combinations and machine learning models proposed in the present study. The predictive models are assessed based on several performance metrics and visual indicators. Results show that the KNN-M11 model ( ), which includes W/L, S/L, and Fr as predictive variables outperforms the other predictive models. Furthermore, an enhancement is observed in KNN model estimation accuracy compared to the previously developed empirical models. In general, the predictive model dominated in the present study provides adequate performance in predicting the aeration efficiency in the Parshall flume.


Introduction
Parshall flume is one of the most commonly used fixed hydraulic structures to measure the surface water and irrigation flows. For a long time, numerous investigators focused on one or more flume components to simplify, improve, and refine its design and operation. Result of those intense experimental researches, the Parshall flume was eventually developed. A brief review of Parshall flume development is offered to benefit those unfamiliar with its history. Cone (1917) initiated a flume made up of a converging section, a diverging section, and a short throat section in-between them. His 'venturi flume' had the ground part as flat throughout the length. Parshall and Rohwer (1921) and Parshall (1928) had designed the present flume and expanded its applications in agriculture. His designed Parshall flume has an upstream converging section, end with downstream diverging exit section & in-between flat throat that has defined width with a downward sloped floor & upward slope section. Various shape weirs & Venturi flumes were used to measure flow at that time, but these devices had various CONTACT Ahmad Sharafati asharafati@srbiau.ac.ir, Nadhir Al-Ansari nadhir.alansari@ltu.se limitations and disadvantages. Six years after his work began on the development of 'modified venturi flume', Dr. Parshall filed for the patent of his construction of a new 'Parshall flume'. Then these flumes were installed in various American irrigation facilities (Heiner & Barfuss, 2011). A Parshall flume includes i) converging, ii) throat, and iii) diverging portions. The converging portion made up of an upstream narrowing approach with a level floor followed by a throat portion with downward-sloping, then flow continues to the diverging downstream portion with upward-sloping as shown in Figure 1 (Mustonen, 1986;Parshall, 1950).
The accelerated velocity causes the air injection process in the Parshall flume (Reclamation et al., 1997). The flow velocity accelerates through contracting sidewalls in the converging portion; then, the flow condition changes from subcritical to supercritical in the throat portion due to contraction and drop. Afterward, aeration is performed in the diverging portion by changes the supercritical flow to subcritical. The dissolved oxygen (DO) concentration is an influential factor in biological and chemical activities in aquatic ecosystems, such as the self-purification of the rivers (Asadollah et al., 2020;Sharafati et al., 2020a). A minimum level of DO is necessary for the survival of the aquatic life, and thus several problems would be raised for the aquatic life when the DO concentration drops down to 5 mg/l. Aeration is a common approach to inject air into the water body to increase the DO level. Besides, it is an essential treatment process in wastewater treatment plants. (Wilhelms et al., 1993), (Gulliver et al., 1998), (Ervine, 1998) and (Chanson, 1995) examined the aeration process in hydraulic structures. (Kaya & Emiroglu, 2010) studied oxygen transfer at baffled chutes. Although weir is a common hydraulic structure to increase DO levels into the treatment channels, it is inappropriate in channels with mild slopes. In contrast, flume provides an efficient aeration system in treatment plants (Dursun, 2016).
The oxygen disperses in the flowing water by turbulent mixing (hydraulic jump) and molecular diffusion (bubble formation). There are two laminar layers on each side of the water-air interface to control the oxygen dispersion. The oxygen transfer rate is directly related to the concentration gradient and would be computed as follows: where C and C s are the absorbed and saturated concentration of oxygen, respectively. K L is the coefficient of the liquid layer, A and V are the area, and the volume of transferred oxygen and t signifies time. (Gulliver et al., 1998) developed a time-independent formula to compute the oxygen aeration efficiency, E, as follows: where, C U and C D are the oxygen concentration in upstream and downstream zones, respectively, R represents the oxygen aeration deficient ratio. The aeration efficiency is unity in the full transfer of oxygen to water, while the zero value indicates that no oxygen can be transferred. To preserve the homogeneity in measured experiments, the results obtained in different temperatures are normalized at 20 • C using the following equation (Gulliver et al., 1998): where, E 20 is the oxygen transfer efficiency at 20 • C and f, which is the aeration exponent, would be computed as follows: Several conventional empirical formulas were developed by previous authors (Markofsky & Kobus, 1978;Preul & Holler, 1969;Wormleaton & Tsang, 2000). The details of the models are presented in Table 1. Several investigations have been conducted to assess the aeration efficiency of hydraulic structures. (Dursun, 2016) and (Tiwari & Sihag, 2020) assessed the  Avery and Novak (1978) E 20 = 1 + 1 1 + 0.24 * 10 −4 Fr 1.78 R 0.53 e 1.115 Markofsky and Kobus (1978) E 20 = 1 − 1 1 + 0.1Fr 1.2 1.115 Wormleaton and Tsang (2000) E 20 = aeration efficiency using the experiments on Parshall flumes. (Emiroglu & Baylar, 2003) performed aeration on a steeped channel either with or without end sills. (Chanson, 2002) calibrated the gas-liquid interface through a stepped channel. The application of soft computing models has been drastically increased in different engineering fields (Sihag and Vajesnayee, 2018;Kumar et al., 2018Kumar et al., , 2020Sihag et al., 2017Sihag et al., , 2019Tiwari et al., 2019). Very few studies have been conducted to assess the aeration mechanism in flumes (i.e. Parshall and modified venture flumes). (Dursun, 2016) provided an experimental laboratory dataset to assess the aeration of the small.  examined the potential of soft computing models, including adaptive neuro-fuzzy inference system (ANFIS), fuzzy logic (FL), and artificial neural network (ANN), to simulate the transfer efficiency of oxygen through the Parshall flumes.
Machine learning models, which are the newest subset of soft computing, are divided into various subcategories from such supervised, unsupervised, and reinforced learning methods can be highlighted. Supervised learning proved to be more applicable to machine learning, consisting of several algorithms employed on hydraulic problems. As a widely employed supervised method, the Support Vector Machines were used in various prediction tasks related to a diverse range of problems such as optical lenses (Petković et al., 2014b), robotics (Jović et al., 2016) as well as the hydraulic jump oxygen transfer (Tiwari, 2019). The Fuzzy-based algorithms also proved to be a highly efficient forecasting technique which utilized in various scientific problems like underwater laser cutting parameter selection (Nikolić et al., 2016), management of precipitation concentration (Petković et al., 2017), wind turbines (Petković et al., 2014a) and many more (Mohammed et al., 2020;Sharafati et al., 2020bSharafati et al., , 2021. While these methods are considered the machine learning most commonly used algorithms, newer models such as tree-based and extreme learning models have also represented high prediction accuracy. For example, M5P, as a basic tree-based model, has been utilized in the assessment of Parshall flumes aeration efficiency Sangeeta & Tiwari, 2019) and proved to be highly efficient against alternative AI algorithms. As another novel algorithm, Extreme Machine Learning also proved to be a useful prediction tool for weirs discharge coefficient problems (Gharib et al., 2020;Yarmohammadi et al., 2019).
Overall, the measurement of Parshall flow aeration efficiency is very costly and time-consuming, which requires laboratory experiments. Due to this matter, the primary motivation of the current study is to evaluate the E20 using novel machine learning algorithms by employing the least experimental parameters and saves time, money, and effort. So, this study is helpful for hydraulic researchers and scientists.
This study evaluates the accuracy of three supervised machine learning approaches, in the particular Decision tree and Random forest as advanced tree-based algorithms and K Nearest Neighbor as an instant based algorithm to predict the oxygen aeration efficiency (E20) in the small Parshall flumes with different forms. To the best of the authors' knowledge, the proposed algorithms have not been developed yet to predict the oxygen aeration efficiency of the Parshall flumes. Furthermore, the results obtained from the best predictive model are compared with the empirical models reported in the literature.

K-Nearest Neighbor
As a pattern recognition regression technique, K Nearest Neighbors (KNN) usually implemented two general tasks, including density function evaluation and subsequently classification of test dataset due to their distribution and pattern. The initial phase of the algorithm consists of finding an approach to measure the distance related to training and testing data. The Euclidean method is the most common technique for distance determination between the mentioned two sets of data: Where α and β denote the training data [x 1 , . . . , x n ] and their corresponding [y 1 , . . . , y n ] parameters, respectively. The dataset samples were sorted from minimum to maximum based on the assessed Euclidean distance (d), which symbolized the most and least similarity, respectively. In the next stage, the K,, an essential parameter in evaluating a specific dataset features, must be determined. Measuring the number of neighbors (K) is crucial, and the effectiveness of this regression method depends on choosing the most similar samples from the original dataset. A small K results in single-point sensitivity, while large-scale K outcomes overlap samples from other clusters into the desired neighborhood. It is evident from previous literature that the optimal value of K assessed by employing the cross-validation technique (Shabani et al., 2020;Wu et al., 2008).

Decision tree
A decision tree, a supervised algorithm in machine learning, can undertake both regression and classification tasks. The Decision Tree Regression (DTR) technique extracts major features from a database and structure them in a tree-shaped architecture, where internal and terminal nodes, respectively, exhibit splits and leaves. By gathering individual trees, which have their specific rules, a collection of rules is starting to form that would be utilized in the regression stage (Witten & Frank, 2002).
Initially, tree bough is established using the original training data. Then the DTR algorithm creates branches from the main body of the tree and subsequently new branches from the old one by separating the data using a binary split procedure. The advance of this process stops when a branch becomes too small and impossible to segregate, which in that case, the related node constructs the leave of a tree or the terminal node (Kamiński et al., 2018;Quinlan, 1987).
What makes the DTR an applicable machine learning method is the easy interpretation of rules originated from the trees, which usually exhibit a logical pattern instead of mathematical relations. Though, the inability to handle nonlinear and noisy data and time series problems are considered major DTR drawbacks (Mitchell, 1997;Tso & Yau, 2007).

Random forest
Random forest is an ensemble algorithm that originated from tree practice, widely used in machine learning and artificial intelligence (Liaw & Wiener, 2002). It is mostly used in a classification problem, such as regression (Goel et al., 2017). The random forest regression (RFR) function is to grow several decisions or predicting trees during the learning process. All of these trees are trained individually. Finally, the result is obtained by identifying the specified category based on classified states and/or the averaged prediction of individual trees (Barandiaran, 1998;Ho, 1995).
The random forest learning algorithm employs generic bootstrap and bagging techniques to train the tree. Bootstrap enhances the model performance by reducing the variance and without introducing any changes in the bias.
Breiman (2001) considered RF as a set of n stochas- indicates the i-th predicting stochastic tree or DT(x), which is grown by { i } as a uniform independent stochastic distribution vector. This vector encrypts the stochastic arrangement needed for constructing the tree, and l is the growth learning data. { i } is selected prior to the tree growth and is independence from learning data. All the predicting trees are integrated and averaged so that an estimator forest of DT(x) is constructed.
The algorithms evaluated in the current study are developed utilizing the Scikit learn library on Python programming language over the Anaconda platform. While there are numerous effective parameters in the KNN, DTR, and RFR algorithms, in the current study, only the parameters listed in Table 2 proved to be highly influential on final results, and the other variables have been set to default.

Description of laboratory experiments
The oxygen transfer efficiency of small Parshal flumes was obtained experimentally in hydraulics at the National Institute Technology in Kurukshetra, India (Sangeeta, 2018). Several flumes were fabricated at the workshop of the mechanical department of the same institute. The dimensional details of the flumes are presented in Table 3. The models are firmly fixed in tilting rectangular rigid steel channel of 0.25 × 0.30 × 4.00m as width, height, and length dimensions, respectively. The tilting channel has a transparent acrylic sheet in the middle for 1.8 m in length. To supply the flow required for experiments, a centrifugal pump is utilized with a discharge capacity of 6 m 3 s to provide the water recirculation. A headbox is used at the begging of the flume, while the upstream entry of the flume is equipped with a metal screen to damp the water fluctuation. The water discharge is regulated and measured using a regulating valve and orificemeter, respectively. The measurement procedure of water depth is performed by a digital gauge with an accuracy of 0.01 mm. Figure 2 illustrates the schematic structure of the test setup.
To find out the oxygen aeration performance of the experimental models, the storage cum aeration tank is filled with a fixed volume of water through each experiment. The sodium sulphite (Na2SO3) and cobalt chloride (CoCl2) are thoroughly mixed in the aeration tank to reduce DO level in the range of 1-2 mg/l. Several samples of water are collected to measure the initial DO concentration. Then, the other samples are obtained after 1-minute of running the flume. It is essential to preserve the level of DO less saturation condition. The Azide modification method is used to compute the level of DO. Besides, a mercury thermometer is employed to measure the temperature of water in the tank. Then, the oxygen aeration efficiency, E20, is computed using Eqs.2-4. A similar procedure is conducted for each experimental model. Ultimately, 237 test runs are obtained while the doubtful tests are repeated twice to achieve reliable results.

Description of the proposed predictive models
The combinations of non-dimensional predictors (e.g. W/L, S/L, Fr, and Re) are defined to obtain the best predictive model for simulating the aeration efficiency in the Parshall flume. In this way, fifteen combinations (M1 − M15)are defined to assess supervised machine learning models (e.g. DTR, KNN and RFR). The details of input combinations defined in the present study are illustrated in Table 4.

Description of dataset
Several non-dimensional physical and hydraulic parameters, including W/L, S/L, Fr, andRe are measured to provide a dataset for simulating the aeration efficiency in Parshal flume (E20). The collected experimental dataset  is split into the training and testing subsets to develop the soft computing models-the training subset employed for model preparation. In contrast, the testing dataset is used for model validation. The dataset is divided into 163-74 observations for the training-testing stages. The division is obtained by trial and error search to provide the best performance. Table 5 demonstrates the ranges of measured target and input variables over both training and testing stages.

Description of performance metrics
To analyze the capability of various modeling methods to predict the E 20, coefficient of determination (R 2 ), root mean square error (RMSE), Nash-Sutcliffe efficiency (NSE), and mean absolute error (MAE) indices are calculated in both training and the testing stages as following equations: Where, E obs and E pred are observed and predicted aeration efficiency, respectively. n is the total number of observations.

Results and discussions:
Several predictive models with various input combinations are developed to achieve the best predictive model for predicting the aeration efficiency (E20) at Parshall flumes. In this way, fifteen possible input combinations are obtained based on the four input variables (Table 4). The predictive models proposed in the present study, including Decision Tree, K nearest neighbor, and Random Forest Regression models, use those combinations to predict the E 20 at Parshall flumes.
Tables 6-8, respectively, report the performance indices obtained for different combinations of DTR, KNN, and RFR models in both training and testing stages. From Table 6, it is clear that the DRT-M15 model (RMSE test = 0.003 and NSE test = 0.867) provides better performance compared to other input combinations.    (Table 7). Furthermore, better prediction performance is observed in RFR-M11 (RMSE test = 0.004 and NSE test = 0.884) compared with the other RFRbased models (Table 8).
The result obtained from the comparison between the best predictive models (e.g. DRT-M15,  indicates that the KNN-M11 provides better performance prediction than other machine learning techniques. In contrast, the KNN-M11 model comprises a simpler input combination including W/L, S/L, and Fr. The superiority is notified as a significant reduction in RMSE & MAE and considerable improvement in R 2 & NSE obtained by KNN rather than other techniques. Outcomes of training and testing stages suggest that both these stages have the same results, which means the developed models are not data sensitive and have similar behavior with different data samples. To investigate the linear relation among observed and predicted values of E 20 at Parshall flumes, the agreement plots of the predictive models are shown in Figure 3. Although all the predictive models provide acceptable performance in predicting the E 20 at Parshall flumes, the KNN-M11 model has the highest value of the coefficient of determination (R 2 ) value as 0.929 for the testing stage. It is indicated that the values predicted by KNN-M11 models are lying significantly closer to the line of perfect agreement (R 2 = 1.00). This indicates that the KNN learning method is more suitable than other models for predicting E20 at Parshall flumes.
The graphical comparison among predictive models in terms of standardized performance evaluation parameters is also shown in the heat-map plot. As shown in Figure 4, the KNN-M11 model (dark red) offers the best prediction performance compared to other models. In contrast, the lowest performance is found in the To evaluate the consistency of the predicted E 20 against the observed values, the 25%, 50%, 75% quantile values of the experimental and predicted E 20 and their corresponding Inter Quartile Range (IQR) are assessed using a combination of Violin and Box plots. From Figure 5, it is evident that in the training stage, KNN-M11 (IQR = 0.017) profoundly mimics the observed data (IQR = 0.017), in the testing stage, the KNN-M11 (IQR = 0.016) and RFR-M11 (IQR = 0.011) models represent very close prediction to the experimental values (IQR = 0.013), and the DTR-M15 (IQR = 0.007) exhibits the least accurate prediction.
The relative error diagrams of DTR-M15, KNN-M11, and RFR-M11 and their boxplots in the testing stage are depicted in Figure 6. The figure indicates that the lowest confidence limit of the relative error is observed in KNN-M11 in the range of −8.67% to 12.12%. In contrast, the RFR-M11 provides the biggest confidence limit in the range of −17.16% to 18.32%.
As one of the most commonly utilized graphical evaluation approaches, the Taylor diagram is represented in Figure 7. This diagram combines the statistical measurement with the correlation coefficient and assigns a colorful shape to predictive models. The performance of models then assessed by considering their distance with experimental values. The figure shows that the KNN-C11 (orange dot) is the closest shape with the experimental (dark blue dot) and subsequently considered a more accurate model. Meanwhile, with a slightly more distance, the DTR-C15 is ranked as least precise among others.
Overall it can be concluded that, while all three employed machine learning algorithms in the current study provide the acceptable prediction performance, the KNN using the M11 combination, which includes W/L, S/L, and Fr input parameters, shows a slightly higher prediction accuracy compare to Decision Tree and Random forest models based on both statistical and graphical evaluations. It was evident that the KNN-M11 improved the prediction accuracy by reducing the RMSE by nearly 40% as well as enhancing the R 2 by 7% over the testing phase compare to other alternatives.
From Tables 6-8, it is evident that the prediction performance significantly decreases in M4 (R 2 testing average = 0.179) and M3 (R 2 testing average = 0.389) combinations which indicate the low correlation of Re and Fr input parameters to the E 20 values, respectively. However, the most important input parameters find to be the W/L with average R 2 testing of 0.76 compared to other inputs. Table 9 compares the outcome of the current study and the result obtained from calculating the E20 with the previous experimental formula proposed by (Avery & Novak, 1978;Markofsky & Kobus, 1978;Preul & Holler, 1969;Wormleaton & Tsang, 2000). As presented in Table 8, it is clear that the machine learning algorithm proposed in the present study significantly outperforms the empirical formulas in predicting E20.

Conclusions
Prediction of the aeration efficiency (E 20 ) values at Parshall flumes is essential because it has a proper application in irrigation canals, mine discharge, dam seepage, sewage treatment plants. In this study, experimental data are used to investigate the performance of machine learning approaches, namely K Nearest Neighbor (KNN), Random Forest Regression (RFR), and Decision Tree Regression (DTR). Laboratory parameters consist of W/L, S/L, Fr, and Re are employed as inputs of prediction models, and subsequently, by arranging these four parameters, 15 input combinations are established, which are noted as M1 ∼ M15. A total of 237 experimental  Current study 0.003 0.929 (Preul & Holler, 1969) 0.959 0.460 (Avery & Novak, 1978) 0.041 0.322 (Markofsky & Kobus, 1978) 0.030 0.458 (Wormleaton & Tsang, 2000) 0.041 0.324 samples used in predictive models is divided into training and testing stages, with 163 and 74 samples, respectively. To assess the performance of developed models, few performance indices (i.e. RMSE, MAE, R 2 & WI) and some graphical representations (i.e. Agreement plot, Heat-map, Violin diagram, and Relative error plot) are used for both training and testing stages. Statistical results and graphical comparisons suggest that the KNN model with M11 combination (MAE testing = 0.002, R 2 testing = 0.929), which includes W/L, S/L, and Fr input parameters is outperforming other models. The RFR-M11 (MAE testing = 0.003, R 2 testing = 0.886) and DTR-M15 (MAE testing = 0.003, R 2 testing = 0.868) model achieves the next rank for predicting (E 20 ) values at Parshall flumes, respectively. The input sensitivity analysis also indicates the Re and W/L as the least and most influential parameter on the prediction results, respectively. With relatively high-performance indices for all three predictive models and superiority to previous experimental results, this study reveals that the machine learning algorithms are highly accurate and versatile to solve the problems of hydraulic system engineering and management.

Disclosure statement
No potential conflict of interest was reported by the author(s).