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 (Daneshfaraz et al. 2019) 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 Cd 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 Cd 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 Cd 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.

Moreover, support vector machines have been extensively used in various fields (Zhou et al. 2015; Nadiri et al. 2018; Sadeghfam et al. 2019; Azimi et al. 2019).

The prediction of the Cd 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 Cd 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 Cd 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 Cd without dimension, which is obtained from Eq. 1 (Tullis et al. 1995).

$$Q = \frac{2}{3}C_{d} \sqrt {2g} L_{c} h^{1.5}$$

Using the dimensional analysis method and considering the geometric, kinematic, and dynamic parameters, the effective parameters on the Cd in labyrinth weirs included the total upstream head (h), inside apex length (A), outside apex length (D), centerline length of the sidewall (Lc), number of cycles (N), the whole width of the spillway (W), the walls’ angles (a), the weir’s height (P), the wall thickness (tw), and the shape of the weir’s crest (Lc = N (2lc + 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.

Fig. 1
figure 1

A view of a labyrinth weir investigated by Crookston and Tullis (2013)

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).

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).

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 Cd of the labyrinth weirs with quarter-round crests.

Fig. 2
figure 2

A simple composition of a MLP and b RBF neural networks

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.

Fig. 3
figure 3

Simple composition of SVM

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).

$$f(x) = W^{T} \cdot \phi (x) + b$$
$$y = f(x) + {\text{noise}}$$

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:

$$K(x,\,x_{j} ) = (x \cdot x_{j} )$$
$$K(x,X_{j} ) = (1 + (x,X_{j} ))^{d}$$
$$K(x,X_{j} ) = \tanh ( - a(x,X_{j} ) + c)$$
$$K(x,x_{j} ) = \exp \left( {{{ - \left\| {x - x_{i} } \right\|^{2} } \mathord{\left/ {\vphantom {{ - \left\| {x - x_{i} } \right\|^{2} } {\sigma^{2} }}} \right. \kern-0pt} {\sigma^{2} }}} \right)$$

In the present study, the artificial neural networks (ANNs) and SVM models were used to estimate the amount of Cd of the labyrinth weirs with quarter-round crests with four non-dimensional parameters of Ht/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 Ht/P, L/W, W/P, and α were introduced as the input, and the non-dimensional parameter of Cd 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 Cd 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 Cd. 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.

$$R = \frac{{\sum\nolimits_{i = 1}^{n} {(O_{i} - \bar{O}} )(P_{i} - \bar{P})}}{{\sqrt {\sum\nolimits_{i = 1}^{n} {(O_{i} - \bar{O}} } )^{2} \sum\nolimits_{i = 1}^{n} {(P_{i} - \bar{P})^{2} } }}$$
$${\text{RMSE}} = \sqrt {\frac{{\sum\nolimits_{i = 1}^{n} {(P_{i} - O_{i} )^{2} } }}{n}}$$
$${\text{DC}} = 1 - \frac{{\sum\nolimits_{i = 1}^{n} {(P_{i} - O_{i} )^{2} } }}{{\sum\nolimits_{i = 1}^{n} {(P_{i} - \bar{P})^{2} } }}$$

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, \(\bar{O}\) were the mean values of the observed values, \(\bar{P}\) were the mean values obtained from the predictive models’ method, and n was the number of data.

Results and discussion

The Cd 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 Ht/P, L/W, W/P, and α were considered as the input, and the non-dimensional parameter of Cd 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.

Table 1 Range of dataset used for training and testing of models

The multilayer perceptron (MLP) network and radial basis function (RBF) neural networks with hidden layers and different neurons were used for modeling the Cd 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 Cd, the neural network had four neurons in the input layer (Ht/P, L/W, W/P, and α) and one neuron in the output layer (Cd). 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 quarter-round 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 2 The results of the simulation of the Cd of the labyrinth weirs with quarter-round crests

Table 3 is presented in order to evaluate the efficiency of the method used to estimate the Cd 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 Cd of the labyrinth weirs with quadrantal crests.

Table 3 The evaluation of the accuracy of the artificial neural networks model in estimating the Cd

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 Cd. 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 Cd.

Fig. 4
figure 4

Distribution diagram of the observational-computational values in training and testing stages of MLP and RBF models

In the present study, the performance of the support vector machines (SVMs) in estimating the Cd 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 (Ht/P, L/W, W/P, and α) in the input layer, and a neuron in the output layer (Cd) in order to assess the performance of ANNS in comparison with SVM.

To select the suitable kernel function for the support vector machine, the Cd 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 Cd. 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.

Table 4 Statistical parameters of the SVM model with different kernels

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.

Fig. 5
figure 5

Distribution diagram of the observational estimated values of the training and testing stage of SVM-RBF

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.

Fig. 6
figure 6

Distribution diagram of the observational estimated values

Table 5 The MR linear and MR nonlinear equation for obtaining the Cd

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 (Cd).

Figures 7 and 8 show the density plot and violin plot in the test period for observational data from laboratory tests (Crookston and Tullis 2013) 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, respectively (0.802, 0.618, 0.534, 0.409, and 0. 204), (0.813, 0.625, 0.554, 0.414, and 0. 227), (0.838, 0.607, 0.549, 0.477, and 0. 150), (0.694, 0.564, 0.479, 0.411, and 0. 261), and (0.691, 0.562, 0.481, 0.405, and 0. 247).

Fig. 7
figure 7

Density plot for data in the test period for observational and estimated data

Fig. 8
figure 8

Violin plot for data in the test period for observational and estimated data

The statistical criteria have shown that the multilayer perceptron (MLP) network model had higher accuracy compared with SVM, MR linear and MR nonlinear. It has also been observed that the MLP provided very similar results to the experimental values in predicting the amount of the discharge coefficient (Table 6).

Table 6 ANN, SVM, MR linear, and MR nonlinear results for the test period


In the present research, ANNS, SVM, MR linear and MR nonlinear models were used to estimate the Cd of the labyrinth weirs with quarter-round crests. The values of the Cd were obtained from Crookston and Tullis (2013)’s laboratory studies. Then, the estimated values Cd 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 Cd. 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.