Investigation of discharge coefficient of trapezoidal labyrinth weirs using artificial neural networks and support vector machines

Weirs are a commonly used system to adjust water surface level and to control the flow in canals and hydraulic structures. Labyrinth weirs are a type of weirs that can pass through a certain amount of flow which has a lower upstream water level than the linear weirs, by increasing the effective length. In the present study, the performance of multilayer perceptron (MLP) networks, radial basis function networks and support vector machines with different kernel functions were investigated in order to estimate the discharge coefficient (Cd) of labyrinth weirs with quarter-round crests. For this purpose, 454 laboratory data were used. The non-dimensional parameters of L/W, a, W/P, and Ht/P were considered as the input, and the non-dimensional parameter of Cd was regarded as the output in the models. In comparison with the other models, the performance of the MLP model with RMSE, R, and DC of 0.019, 0.985, and 0.971, respectively, was more acceptable and closer to the experimental data. Also, the data density plot and the violin plot showed that the dispersion and distribution of the probability of the estimated data to the MLP model with the data obtained from the laboratory have a very close and similar adaptation.


Introduction
Increasing the amount of flow rate in different structures was always a field of interest for researchers. Decreasing sedimentation in reservoirs (Zahabi et al. 2018) and the creation of an opening in a broad-crested weir body to increase the discharge coefficient ) are examples of improving the flow rate. The other vital structures that can control the flow rate are weirs. The volume of flow over the weirs depends on the length and shape of the crest of the weir. Many researches have been done on the effect of the hydraulic and geometric parameters on the C d and the amount of flow discharged from the weir. One of the effective ways to increase the weir length at a given width is to use weirs with nonlinear plans such as triangular, trapezoidal, circular, and parabolic. These weirs have been known as labyrinth weirs and are usually made in one cycle or several cycles. Through constructing this type of weirs, the volume of the flow through them increases, and a lower free height will be needed upstream in comparison with linear weirs. This issue is critical when they act as flood discharging structures and facilitate the flow of the flood (Crookston and Tullis 2012a).
Study on the labyrinth weirs hydraulics is conducted by the physical and numerical approaches. Crookston and Tullis (2012b) tested some configurations of arced labyrinth weirs and observed increased efficiency. Dabling et al. (2013) investigated the hydraulic performance of labyrinth weirs which consist of two crest elevations as an alternative to multiple-staged labyrinth weir layouts. Kabiri-Samani et al. (2013) performed a combined analytical and experimental investigation on a rectangular labyrinth weir. Their results showed that rectangular labyrinth weir represents an effective alternative and could be five times more efficient than corresponding traditional broad-crested weir. Carollo et al. (2017) studied the dimensionless stage-discharge relation for a sharp-crested triangular labyrinth weir. They found that the length magnification ratio affects the flow magnification ratio.
Recent research efforts have included numerical modeling and CFD as an additional design tool (Seo et al. 2016;Daneshfaraz et al. 2016;Daneshfaraz and Ghaderi 2017). Another way for numerical modeling is related to the use of soft computing techniques for predicting the hydraulic properties of weirs such as discharge coefficient (Azamathulla et al. 2016). In this regard, researchers used an artificial neural network (ANN), group method of data handling (GMDH), gene expression programming (GEP), and adaptive neuro-fuzzy inference system (ANFIS). Juma et al. (2014), using artificial neural network (ANN), analyzed the hydraulic properties of semicircle weirs. They showed that the results of artificial neural networks were in good agreement with laboratory results. Roushangar et al. (2017) investigated the determination of the C d of labyrinth and archery labyrinth weirs with the support vector regression method. Their results showed that the vector support regression method had high efficiency in determining the C d of labyrinth weirs. Karami et al. (2018) investigated the rectangular labyrinth weirs with supported vector machine models, artificial neural networks, and genetic algorithms. They compared the results of these models with the experimental data and found out the support vector machines represented better results than the other models.
The prediction of the C d of the labyrinth weirs has always been important for the researchers in this area; therefore, several methods including empirical, quasi-empirical, time series, and artificial intelligence models have been developed. Among these, artificial intelligent models by being inspired by nature have been able to estimate the parameters of natural phenomena with acceptable accuracy.
Reviewing the literature has shown that there have been limited studies conducted on artificial models for estimating the C d of labyrinth weirs with quarter-round crests. Therefore, in the present study, using the experimental data of Crookston and Tullis (2013), the performance of artificial neural networks (ANNs) and support vector machines (SVMs) with different kernels was examined for estimating the C d of labyrinth weirs with quarter-round crests.

Materials and methods
The dynamic behavior can be described by a set of equations known as the St. Venant equations (Daneshfaraz and Kaya 2008). The one-dimensional equation of flow on labyrinth weirs is a function of the total upstream head (h) in meters, weir's crest length (L) in meters and C d without dimension, which is obtained from Eq. 1 (Tullis et al. 1995).
Using the dimensional analysis method and considering the geometric, kinematic, and dynamic parameters, the effective parameters on the C d in labyrinth weirs included the total upstream head (h), inside apex length (A), outside apex length (D), centerline length of the sidewall (L c ), number of cycles (N), the whole width of the spillway (W), the walls' angles (a), the weir's height (P), the wall thickness (t w ), and the shape of the weir's crest (L c = N (2l c + A + D). Crookston and Tullis (2013) conducted studies on labyrinth weirs with quarter-round crests; the effective parameters in them can be seen in Fig. 1.

Artificial neural networks
Artificial neural network (ANN) is a nonlinear mathematical model that is able to simulate arbitrarily complex nonlinear processes, which relate inputs and outputs of any system. In many complex mathematical problems that lead to solving complex nonlinear equations, multilayer perceptron networks are common types of ANN widely used by researchers (Parsaie 2016;Moazamnia et al. 2019). Crookston and Tullis (2013) Multilayer perceptron (MLP) network is the most commonly used neural network model applied in water engineering issues; for training, this network, a back-propagation learning algorithm which is a learning method with an observer, is used. The purpose of training a neural network is to arrange the network parameters (weights and biases) by providing training patterns, in a way that by representing the same patterns, the resulted error between the optimal response and network is minimized. Generally, in a multilayer perceptron network, there are two types of signals, i.e., signals moving in the going path (from the inner layer to the outer layer) and the other are the return signals (from the outer layer to the inner layer) which are known as the functional signals and error signals, respectively. Arranging the parameters in the multilayer perceptron network is performed by the error signal and input signal. Determining the number of layers and neurons existing in them is one of the most important issues in modeling with artificial neural networks. Tokar and Johnson mentioned sigmoid stimulus and hyperbolic tangent functions as the most commonly used stimulus functions in the back-propagation learning algorithm (Ghorbani et al. 2013).

Fig. 1 A view of a labyrinth weir investigated by
Radial basis function (RBF) network, like the MLP neural networks model, is another type of neural networks in which the processor units focus on a certain position while processing. This focus is modeled through radial functions. Regarding the overall structure, RBF neural networks are not much different from MLP networks; just the kind of processing that neurons do on their inputs is different. However, RBF networks often have faster learning and preparation processes. In fact, because of the concentration of neurons on a particular functional range, it is easier to adjust them. There are several types of radial basis functions, but the most commonly used is the Gaussian function. Figure 2 shows a view of a multilayer perceptron network and a radial neural network (Ghorbani et al. 2016). In the present study, MLP and RBF models have been used to predict the C d of the labyrinth weirs with quarter-round crests.

Support vector machines
Support vector machines operate based on data mining algorithms and are like other artificial intelligent methods. The first application of this method in water issues which was presented by Dibike et al. (2001) was simulating the rainfall runoff. Later, it was used in different fields of hydrology (e.g., Nadiri et al. 2017) and Hydraulics (e.g., Sadeghfam et al. 2019). Support vector machines are an efficient learning system based on the theory of optimization that uses the inductive principle of minimization of structural errors and lead to a general optimal response.
The SVM algorithm operates through training and testing like most artificial intelligent methods, but unlike the other artificial intelligent methods, instead of reducing the computational errors, it considers the operational risk of incorrect division as the target function and obtains its optimal value. Figure 3 represents the structure of the vector machine.
In the regression model of SVM, a function related to the dependent variable of y which itself is a function of several independent variables of x is estimated. Similar to the other regression issues, it is assumed that the relationship between the independent and dependent variables is determined by an algebraic function such as f(x) along with some disturbance (tolerance factor ε) (Eq. 2).
where w is a weight vector, b is biased, and ∅ is also a kernel function, and then, the purpose is to find a functional form for f(x). This is accomplished by calibrating the SVM model by a series of samples (calibration set). This process involves the sequential optimization of the error function. Depending on the definition of this error function, two types of SVM model have been defined.
( SVMs are a set of related supervised learning methods used for classification and regression: SVM regression of type 1 (also known as ε-SVM regression) and SVM regression of type 2 (also known as υ-SVM regression). It is worth noting that in this study, the regression model of ε-SVM was used to predict the discharge coefficient of labyrinth weirs with quarter-round crests because of its extensive application in regression studies. Support vector machines change the dimensions of the problem through kernel functions for solving nonlinear problems. Applying kernel for SVM depends on the amount of training data and the dimensions of the feature vector. In other words, considering these parameters, a kernel function that can solve the problems of inputs should be selected. Practically, four types of linear kernels including linear, polynomial, sigmoid, and radial basis function (RBF) are used (Kavzoglu and Colkesen 2009;Baofeng and et al. 2008). The equations used in each of them have been given below: In the present study, the artificial neural networks (ANNs) and SVM models were used to estimate the amount of C d of the labyrinth weirs with quarter-round crests with four nondimensional parameters of H t /P, L/W, W/P, and α. The data existing in the laboratory were taken, and the total number of the generated data was 454.
In the applied models, four non-dimensional parameters of H t /P, L/W, W/P, and α were introduced as the input, and the non-dimensional parameter of C d was considered as the output. In the applied models, 75% of the total available data were considered for the training period, and 25% of them were used for the testing period. In this study, STATISTICA 12 software was used to estimate the C d and the value of the R, DC, and RMSE is determined.

Evaluation criteria
Three statistical indicators were used for assessing the ability and accuracy of ANNs and SVM models in estimating the C d . The assessment criteria for estimating the parameter of the discharge coefficient included the correlation coefficient between the observational estimated values (R), root-mean-square error (RMSE) and the linear correlation between the predicted values and the observations (DC); each of them was calculated from Eqs. 8, 9, and 10, respectively. The model which had R and DC close to 1 and the root-mean-square close to zero was considered the better model.
In these equations, O i were the values obtained from the observational values (extracted from the laboratory), P i were the values obtained from the predictive models' method, Ō were the mean values of the observed values, P were the

Fig. 3 Simple composition of SVM
mean values obtained from the predictive models' method, and n was the number of data.

Results and discussion
The C d of the labyrinth weirs with quarter-round crests was analyzed through the results of the ANNs and SVM models.
In the present study, Crookston and Tullis (2013) laboratory data were used to evaluate and compare the results obtained from the models. The non-dimensional parameters of H t /P, L/W, W/P, and α were considered as the input, and the non-dimensional parameter of C d was considered as the output in the models used in this research. In Table 1, the statistical parameters of the dataset have been shown for the training and testing ranges.
The multilayer perceptron (MLP) network and radial basis function (RBF) neural networks with hidden layers and different neurons were used for modeling the C d of labyrinth weirs with quarter-round crests.
In this research, a hyperbolic tangent function which has been the most useful form of multilayer perceptron network stimulus functions was used to construct the output layer of the artificial neural networks. Training the multilayer perceptron networks was done through the training back of propagation learning algorithm which is called Lavenberg-Marquart algorithm because of its faster convergence in network training. Also, the Gaussian function was used for the radial basis neural network.
In modeling the C d , the neural network had four neurons in the input layer (H t /P, L/W, W/P, and α) and one neuron in the output layer (C d ). The value of the correlation coefficient between the observed and estimated values in the training and testing data for the estimated parameters indicated the high capacity of the designed neural network to estimate the discharge coefficient of the labyrinth weirs with quarterround crests. Various models were evaluated. Finally, the appropriate models of MLP and RBF were calculated based on the statistical parameters according to Table 2. Table 3 is presented in order to evaluate the efficiency of the method used to estimate the C d in labyrinth weirs with quarter-round crests. According to Table 3, it can be claimed that in the present study, the accuracy of the multilayer perceptron (MLP) neural network is greater than the radial basis function (RBF) neural network for estimating the C d of the labyrinth weirs with quadrantal crests.
In Fig. 4, the distribution diagram of the observational estimated values of the training and testing stage of the multilayer perceptron (MLP) network model and the radial basis function (RBF) neural network has been shown. As can be observed in Fig. 4, most points are located on or near the line of the bisector, and this shows the acceptability of both models in estimating the amount of C d . However, the multilayer perceptron (MLP) network model provided very closer results to the results of the observed values; therefore, it had a very high accuracy in estimating the considered parameter, i.e., the amount of C d .
In the present study, the performance of the support vector machines (SVMs) in estimating the C d of the labyrinth weirs with quarter-round crests was investigated. Considering the point that choosing the input models in artificially intelligent systems can affect the accuracy of the results in SVM modeling. It was tried to use the inputs of the neural networks' model, that is, the parameters of (H t /P, L/W, W/P, and α) in the input layer, and a neuron in the output layer (C d ) in order to assess the performance of ANNS in comparison with SVM.
To select the suitable kernel function for the support vector machine, the C d model with different kernels was assessed. According to Table 4, the results showed that the RBF kernel function with R, RMSE, and DC of 0.978, 0.027, and 0.956, respectively, performed better in predicting the C d . The sigmoid kernel function with R, RMSE, and DC of 0.697, 0.211, and 0.185, respectively, had the weakest performance. Also, for finding the optimum parameters of the kernel function, the trial-and-error method was used, and by testing different values, the optimal value of these parameters was selected. In order to do so, for the constant value of γ, first the optimal values of ε and c were obtained, and then, the value of γ was changed, and by calculating the statistical parameters, its optimum value was calculated. In Fig. 5, the distribution diagram of the observational estimated values in the training and testing stages of the support vector machine was shown in the best kernel state (RBF kernel). As shown in Table 4, the R and the DC were 0.978 and 0.956, respectively, and the RMSE was 0.027 at the testing stage, and it was chosen as the best kernel mode for the SVM model.
In Fig. 6, data dispersion for the test period is shown using the MR linear and MR nonlinear, respectively. In Table 5, the MR linear and MR nonlinear equations are also shown. As can be seen, these equations have almost the same results. It should be noted that in Table 5, α unit is radians.  According to Figs. 4, 5, and 6, MLP model has estimated very closely comparable results with respect to observational values compared to other models and therefore has very high accuracy in estimating the desired parameter (C d ). Figures 7 and 8 show the density plot and violin plot in the test period for observational data from laboratory tests  and ANN, SVM, MR linear and MR nonlinear. In this study, the Wolfram Mathematica software has been used to draw the density plot and violin plot. Figure 7 shows the density chart of the rectangular box in which the distribution of points is observed for observational and estimated data. According to Fig. 7, it can be seen that the artificial neural network model has a very close adaptation to observational data. Figure 8 also shows the violin plot of the probability distribution function for the observed and estimated data. According to the violin plot, it is clear that the artificial neural network model has similar results to observational data. For observational and estimated data, with the above methods, the probability values for maximum, 75%, 50%, 25%, and minimum values are obtained,

Conclusion
In the present research, ANN S , SVM, MR linear and MR nonlinear models were used to estimate the C d of the labyrinth weirs with quarter-round crests. The values of the C d were obtained from Crookston and Tullis (2013)'s laboratory studies. Then, the estimated values C d found for the mentioned models were compared using evaluation criteria. It should be noted that random sampling from the total data of 454 for considering 25% and 75% as testing and training data, respectively, was done in a way that after repeating several random choosing among the total available data, the data concerning the conditions with the highest R and the least RMSE for the estimation process could be used in the artificial neural network (ANN) model. The results of this study showed that both artificial intelligent models had better accuracy in estimating C d . However, the multilayer perceptron (MLP) network model with R, RMSE, and DC of 0.985, 0.043, and 0.8729, respectively, had a remarkably higher accuracy to the other models.

Compliance with ethical standards
Conflict of interest The authors declare that they have no conflict of interest.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creat iveco mmons .org/licen ses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.