Exploring Machine Learning Models in Predicting Irrigation Groundwater Quality Indices for Effective Decision Making in Medjerda River Basin, Tunisia

: Over the last years, the global application of machine learning (ML) models in groundwater quality studies has proved to be a robust alternative tool to produce highly accurate results at a low cost. This research aims to evaluate the ability of machine learning (ML) models to predict the quality of groundwater for irrigation purposes in the downstream Medjerda river basin (DMB) in Tunisia. The random forest (RF), support vector regression (SVR), artiﬁcial neural networks (ANN), and adaptive boosting (AdaBoost) models were tested to predict the irrigation quality water parameters (IWQ): total dissolved solids (TDS), potential salinity (PS), sodium adsorption ratio (SAR), exchangeable sodium percentage (ESP), and magnesium adsorption ratio (MAR) through low-cost, in situ physicochemical parameters (T, pH, EC) as input variables. In view of this, seventy-two (72) representative groundwater samples have been collected and analysed for major cations and anions during pre-and post-monsoon seasons of 3 years (2019–2021) to compute IWQ parameters. The performance of the ML models was evaluated according to Pearson’s correlation coefﬁcient (r), the root means square error (RMSE), and the relative bias (RBIAS). The model sensitivity analysis was evaluated to identify input parameters that considerably impact the model predictions using the one-factor-at-time (OFAT) method of the Monte Carlo (MC) approach. The results show that the AdaBoost model is the most appropriate model for predicting all parameters (r was ranged between 0.88 and 0.89), while the random forest model is suitable for predicting only four parameters: TDS, PS, SAR, and ESP (r was with 0.65 to 0.87). Added to that, this study found out that the ANN and SVR models perform well in predicting three parameters (TDS, PS, SAR) and two parameters (PS, SAR), respectively, with the most optimal value of generalization ability (GA) close to unity (between 1 and 0.98). Moreover, the results of the uncertainty analysis conﬁrmed the prominent superiority and robustness of the ML models to produce excellent predictions with only a few physicochemical parameters as inputs. The developed ML models are relevant for predicting cost-effective irrigation water quality indices and can be applied as a DSS tool to improve water management in the Medjerda basin.


Introduction
Water is a critical input for agricultural production and plays an important role in food security [1]. Due to population growth, urbanization, and climate change (CC), competition for water resources has excessively increased, with adverse effects on agriculture. In particular, groundwater resources rapidly depleted in many parts of the world, especially in the Mediterranean region, notably Tunisia, referenced as one of the most responsive regions to CC and a primary "Hot-spot" [2,3]. This is an emerging threat to agriculture-led rural development. To achieve sustainable development goals (SDGs) related to the efficient use of water as well as eliminating hunger, it is crucial to improve water management, rationalize the water irrigation [4,5] uses and improve the tools of groundwater quality assessment. Indeed, the suitability of groundwater for irrigation purposes depends on the nature of the mineral elements present in water and their impacts on soil and crops [6,7]. It is based on the concentration of cations and anions present in the groundwater. Quality indices such as the sodium adsorption ratio (SAR), residual sodium carbonate (RSC), magnesium adsorption ratio (MAR), Kelly ratio (KR), and percentage of sodium (%Na) are frequently used in assessing the suitability of waters for irrigation [8][9][10]. Furthermore, one of the main challenges of qualitative assessment methods is their subjectivity, as they require expert knowledge in assigning weights of variables for calculating the index score, which means that the actual result is not clear [11,12]. However, some parameters require a sampling protocol, laboratory analysis, and at a larger scale, testing and data management [13] which increase the cost and study time of water quality assessment and affects the decision-making on water quality management planning. To cope with these issues, it is crucial to develop a powerful and cost-effective approach for quick and accurate assessment of irrigation water quality. Thus, several contemporary studies have opted for a non-physical tool, successfully predicting groundwater quality using 'Machine Learning' models [14,15]. The ML technique is a promising and capable multi-functioning approach in all scientific fields [16,17]. Globally, several researchers have applied ML techniques in various water research studies. They were applied [18,19] for nitrate groundwater contamination [20,21], Manganese removal prediction [13], a flood susceptibility study [22], pollution source identification in water supply network [23], wastewater heavy metal removal [24], heavy metal pollution prediction [25], water level forecasting [26], and, in the last decades, artificial intelligence (AI) techniques have been investigated and showed great ability to predict and monitor water quality [15,27]. These techniques include machine learning (ML), deep learning (DL) and artificial neural networks (ANN).
For example, ML models (supervised machine learning, gradient boosting, and multilayer perceptron) have been studied by [28,29], who demonstrated the relevance of this technique in predicting water quality [30,31] for drinking use. The support vector machine (SVR) model was applied by [12] to predict the water quality index that showed its accurate prediction. The authors of [32] have compared deep learning (DL) models with three other ML models: random forest (RF), eXtreme Gradient Boosting (XGBoost), and ANN to predict groundwater quality.
However, few research studies have applied AI models to predict irrigation water quality. Recently, the ANN model was used by [33] to predict the suitability of groundwater for irrigation purposes in India using physicochemical parameters as input variables. Similarly, [15] predicted groundwater quality in Morocco using ANN, AdaBoost, Random Forest (RF), ANN, and support vector regression (SVR) models based on irrigation water quality indices as inputs. It is important to note that all published studies have proved the good performance of ML models in the prediction of the suitability of groundwater quality for irrigation purposes using few datasets of physicochemical parameters measured in situ or by smart sensor technologies.
This study is performed for the lower and middle sub-basins of the Medjerda catchment known as the basin downstream from the Sidi Salem dam (DMB). This basin is part of the largest watershed of Tunisia, where it supplies about half of the country's drinking water. The DMB basin, subject of this study, is essentially agricultural, where irrigation water supply depends on surface water in conjunction with groundwater resources. In recent decades, the study area has experienced water scarcity problems due to the increased frequency of droughts that have led to the increased exploitation of groundwater resources, mainly by the agricultural and agro-industrial sectors [34,35]. Nevertheless, despite the importance of groundwater in the Medjerda basin, there is currently a huge lack of data regarding its quality that undermines the ability of decision makers and users to manage it properly. The few studies that have been conducted are limited geographically and, in a time, where few groundwater sampling campaigns and analyses were conducted, and they are therefore insufficient to fill the existing data gap and to give a real time information about suitability of groundwater use. Thus, improving the water quality evaluation process based on non-cost data using an objective tool with reliability and flexibility in its decision-making capacity for water management and planning is essential in the DMB basin.
Against this backdrop, the main objectives of this research are: (i) to evaluate the effectiveness of machine learning (ML) models to predict the suitability of groundwater for irrigation purposes in the DMB basin using four ML models (random forest, support vector regression (SVR), ANN, and adaptive boosting (AdaBoost)), (ii) to evaluate the accuracy of the implemented models, and (iii) to analyse the uncertainty and sensitivity of the tested models. Concerning the scientific interest, this study is original, as no previous similar studies were carried out in the pilot area using machine learning methods. Then, the focus of this study was to test the performance of the novel approach and to provide spatial information and guidance to support decision-making processes concerning groundwater management in the Medjerda basin.

Study Area
The DMB basin is located in the northern part of Tunisia, it expands from the "Sidi Salem" dam to the outlet of the river into the Mediterranean Sea. It is situated between 4,117,516-4,040,248 m in the north and 527,822 m-613,659 m in the east (zone 32 North of the east of the Universal Transverse Mercator (UTM) coordinate system) ( Figure 1). It covers a total geographical area of about 1773 km 2 . The average annual precipitation calculated between the period of 1991 and 2020 is about 448.6 mm/year.
From the geological framework, the study area is a subsidence zone belonging to the Tellian domain. It consists of a Quaternary depression limited by the nappes zone in the north [36,37] and the diapirs zone or Triassic province in the south [38,39]. The sedimentary distribution of the basin is essentially controlled by two NE-trending master faults, which are associated with outcrops of Triassic evaporites. From west to east, there is the El Alia-Teboursouk fault (ETF) and the Tunis-Elles fault (TEF) [40]. The Lithostratigraphy of the study area shows geological formations ranging from Triassic to late Quaternary. The Triassic outcrops have often-abnormal contact with Jurassic and Cretaceous outcrops in several localities. The thick lithostratigraphic sequences formed by the Cretaceous, Eocene, Miocene, Pliocene, and Quaternary deposits host the shallow and deep aquifers of the study area such as the aquifer of Bled Guenima, the aquifer of the Anti-Pliocene Medjerda, the plio-quaternary aquifer of Medjerda, the Campanian limestone aquifer of Medjerda, Medjerda aquifer of marls, and Barremian limestones. The alluvial aquifers known as the aquifer of the middle valley of the Medjerda, the aquifer of the lower valley of the Medjerda and the aquifer of Ousja Ghar El Meleh (OGM) are hosted in the colluvial series of the mountains and the alluvial fillings of the deltaic plain. The groundwater of DMB aquifers is primarily used for irrigation and agroindustry and it knew, in last years, severe exploitation, especially in the drought seasons. Moreover, they suffer from salinization, largely caused by natural processes such as evaporation, water-rock interaction, saltwater intrusion, and up-coning of saline waters from deep layers in addition to anthropogenic causes related to irrigation return flow [35,41,42]. The hydromorphic nature of soils at the level of DMB is a rather important problem, observed at the level of irrigated areas of Kalâat El Andalous accompanied by drainage that worsens it, noting, moreover, the clogging and stagnation at the level of Garaâ. This phenomenon enhances the problem of salinity of groundwater due to the excessive use of chemical fertilizers at the level of irrigated areas. Moreover, the coastal aquifer of OGM is affected by saltwater intrusion due to the communication between the lagoon of Ghar El Melh and the sea [30]. Saline groundwater used in irrigation adversely affects soil as well as crop yields. The most harmful associated effects on the irrigated areas are sodification, salinization, and alkalinization, which may alter soil structure [43,44]. Consequently, the quality of groundwater is deteriorated, and it is crucial to evaluate its suitability, especially for irrigation purposes [45,46].

Study Area
The DMB basin is located in the northern part of Tunisia, it expands from th Salem" dam to the outlet of the river into the Mediterranean Sea. It is situated b 4,117,516-4,040,248 m in the north and 527822 m-613,659 m in the east (zone 32 N the east of the Universal Transverse Mercator (UTM) coordinate system) ( Figure 1 vers a total geographical area of about 1773 km 2 . The average annual precipitation lated between the period of 1991 and 2020 is about 448.6 mm/year.

Methodology and Datasets
The methodology adopted in this work is based on five steps ( Figure 2): (i) data development (data checking reliability and data exploration); (ii) development of machine learning models (ANN, AdaBoost, SVR, and RF) based on the training datasets; (iii) validation of the models performance based on the validation datasets; (iv) generalization ability; (v) uncertainty and sensitivity analysis of the performed models. This allowed us to evaluate whether the developed models are useful to predict irrigation groundwater quality parameters to help farmers and decision makers to manage irrigation strategies.     The input data for the used models are the results of physico-chemical analyses of groundwater taken from the DMB basin. It is important to respect the standards of sampling and analysis to have reliable data to be used as input variables of the ML models. In this study, groundwater samples were collected in September 2020, during the dry season, to have water samples less affected by the dilution processes and that present the highest concentrations of solutes during a year. A total of 72 groundwater samples were collected from surface wells and piezometers. The samples were analysed (Figure 1) at the "LandcareMed" laboratory of water and soil analysis at the Higher School of Engineers of Medjez El Bab (ESIM) by adopting the standard procedures [46,47]. The measurement of filtrate dry residue or TDS (total dissolved salts) was performed by evaporating 100 mL of groundwater sample at 105 • C for 24 h. Alkalinity was analysed by titration with 0.1 HCl acid. Measurement of major elements, cations (Na + , NH 4+, K + , Mg 2+ , and Ca 2+ ) and anions, (Cl − , NO 3 − , SO 4 2− , F − , Br − ) was performed by means of ion chromatography system. Table 1 summarizes the statistical analysis of the groundwater samples analysis. • Irrigation water quality Indices (IWQ) Irrigation water chemistry varies depending on its source, reservoir aquifer lithology, and climatic trends. Poor irrigation water quality adversely affects plant growth, agricultural production, soil deterioration, and human health. Generally, the assessment of groundwater suitability for irrigation purposes is evaluated through various agricultural water quality indicators such as percent sodium (%Na), sodium adsorption ratio (SAR), Kelley ratio (KR), magnesium hazard (MH), residual sodium carbonate (RSC), residual sodium bicarbonate (RSBC), permeability index (PI), and potential salinity (PS). In this study, we focus on SAR, PS, TDS, ESP, RSC, and MAR parameters which are calculated according to Table 2. Table 2. Irrigation water quality indices (IWQ).

Index Formula Description
The TDS is the sum of the ion concentrations in the water.
SAR (sodium adsorption ratio) is a measure that determines the degree of hazard to crops by measuring the alkali/sodium risk.
The potential salinity or Doneen is used for risk assessment of cations (calcium, sodium, and magnesium) and bicarbonates present in water that can affect soil permeability if used for long-term irrigation.
The percent exchangeable sodium parameter (ESP in %) is used to evaluate the effect of sodium on soil texture.
Residual sodium carbonates RSC indicate excess bicarbonate and carbonate in the irrigation water The excess of the concentration of magnesium, compared with the sum of the concentration of calcium and magnesium in water, affects the quality of soils that can translate into low crop yield.

Data Pre-Processing and Explanatory Data Analysis (EDA)
Data pre-processing and EDA are the most important part of the machine learning project. It is the operation that transforms raw data into clean data ( Figure 3).
The verification of the reliability of physicochemical and IWQ datasets was performed using the ionic balance, the ionic scatter plot, and the boxplot.
Firstly, the data cleaning processing was performed to correct mistakes and errors in the quality dataset by checking the accuracy of physico-chemical datasets.
As a first step, the reliability of the analytic procedures used was checked using the ionic balance (IB). Water samples whose IB exceeds 5% were eliminated.
Then, the elaborated scatter plot between the sum of anions and cations (Figure 4) was built and shows a very good correlation (R 2 = 0.98), which confirms the reliability of the used data. Secondly, the IWQ were calculated, (Table 3), and their accuracy was checked using correlation matrix. The box plot of the distribution of IWQ and physicochemical variables ( Figure 5) was used to screen the outliers' values for a group of variables. Only few outliers were detected for the majority of variables. Thus, 69 samples were retained and normalized to an interval of 0 to 1 to improve the prediction performance by reducing the influence of extreme and lower values.
Finally, the dataset of computed Irrigation water quality parameters (IWQ) was divided into two sub-sets for model training and model validation (80:20).

Machine Learning Modelling
The ML models were developed in the Jupyter Lab using the open-source tool of the anaconda platform (www.anaconda.com/products/individual, accessed on 8 November 2021) to perform the python package of data science and machine learning.

•
Artificial Neural Network (ANN) ANN is commonly used as an ML model in groundwater modelling [53]. It is a wellestablished and long-standing machine learning technique that is designed to evaluate the

Machine Learning Modelling
The ML models were developed in the Jupyter Lab using the open-source tool of the anaconda platform (www.anaconda.com/products/individual, accessed on 8 November 2021) to perform the python package of data science and machine learning.

•
Artificial Neural Network (ANN) ANN is commonly used as an ML model in groundwater modelling [53]. It is a well-

Machine Learning Modelling
The ML models were developed in the Jupyter Lab using the open-source tool of the anaconda platform (www.anaconda.com/products/individual, accessed on 8 November 2021) to perform the python package of data science and machine learning.
ANN is commonly used as an ML model in groundwater modelling [53]. It is a wellestablished and long-standing machine learning technique that is designed to evaluate the processes (represented by the data) that have high complexities and reduced availability of information for the purpose of regression [54]. In this study, a feed forward multilayer perceptron (MLP) architecture was used for training the ANN committee model. A MLP, which is a specific case of ANN, consists of an input layer, one or more hidden layers, and an output layer [55,56]. The authors of [57] have stated as follows: It consists of a weighted input layer, hidden layers, and an output layer. These layers are interconnected by neurons. Hence, designing ANN requires the transformation from the jth to the (j + 1)th layer through an activation function (f ) and so on until the target layer [57]. The iterative training process is repeated for the layers until good preliminary performance.
In this study, only three layers were developed to obtain an output y i following the Equation (3): with N, x i , y j , b j and w ij showing the number of nodes in the previous layer, the ith nodal in the previous layer, the jth nodal in the present layer, the bias of jth nodal in the present layer, and a weight connecting x i and y j [58].

• Adaptive boosting model (AdaBoost)
AdaBoost is an ensemble learning algorithm developed by [46]. It can be used in combination with many other types of learning algorithms to improve ability.
It integrates multiple weak learners into an individual strong learner and initializes an equal weight for all datasets. Then, the weights of the samples misclassified by the previous weak learner are improved. Finally, the samples with the updated weights are used to train the next weak learner. With this approach, new learners are trained to decrease the weighted error produced by previous learners (Figure 6). In this study, only three layers were developed to obtain an output following the Equation (3): with N, , , and showing the number of nodes in the previous layer, the i th nodal in the previous layer, the j th nodal in the present layer, the bias of j th nodal in the present layer, and a weight connecting and [58].

Adaptive boosting model (AdaBoost)
AdaBoost is an ensemble learning algorithm developed by [46]. It can be used in combination with many other types of learning algorithms to improve ability.
It integrates multiple weak learners into an individual strong learner and initializes an equal weight for all datasets. Then, the weights of the samples misclassified by the previous weak learner are improved. Finally, the samples with the updated weights are used to train the next weak learner. With this approach, new learners are trained to decrease the weighted error produced by previous learners (Figure 6). •

Support vector machine
The SVM is a machine learning algorithm [59] based on statistical learning theory. It is extensively used in resolving issues related to classification (SVC) and regression (SVR) which also diminishes the algorithm over-fitting [60].
For an observational data set (Ds) = ( , ) =1 , the optimal function is the minimization of the function (4) (subject to 5). Hence, the loss functions such as ε-insensitive, quadratic, and Hubber methods can be used [44].
with and * as the lower and upper constraints on the output with ω, b, and C representing weight, basis vectors, and the prespecified value to penalize •

Support vector machine
The SVM is a machine learning algorithm [59] based on statistical learning theory. It is extensively used in resolving issues related to classification (SVC) and regression (SVR) which also diminishes the algorithm over-fitting [60].
For an observational data set (Ds) D s = (x i , y i ) n i=1 , the optimal function is the minimization of the function (4) (subject to (5)). Hence, the loss functions such as ε-insensitive, quadratic, and Hubber methods can be used [44].
with εi and εi * as the lower and upper constraints on the output with ω, b, and C representing weight, basis vectors, and the prespecified value to penalize the training error, while ∅(x) is a Kernel function (k) (polynomial, radial basis, and linear functions).
In this study, a radial basis function (RBF) was adopted as Kernel function.
The random forest algorithm proposed by [45] is a general-purpose classification and regression method. It builds an ensemble of weighted average of decision trees in training by swapping and changing the covariates to improve the prediction performance.
In this study, the k-fold (k = 5) cross-validation method was used during the learning process to further prevent model overfitting [61]. The optimal architectures, functions, and hyperparameters of each model were determined by trial-and-error analysis based on their evolution during the training process. All models' parameters used for prediction of IWQ parameters are summarized in the Table 4. This step consists of evaluating the developed models. During it, their robustness is tested in order to assess if the results obtained can be trusted.
In this study, three statistical criteria were used to validate the above models (Table 5): (i) Pearson's correlation coefficient ® , (ii) the root mean square error (RMSE), and (iii) the relative bias (RBIAS). Table 5. Statistical criteria to validate the models.

Designation Formula Description
Pearson's correlation coefficient (r) Good performance in the testing phase is believed to be evidence for an algorithm's practical plausibility, where this performance provides an evaluation of the model's generalization capability. Achievement of this objective is typically measured by the generalization ability (GA) of the models [52]. The author of [62] defined GA in groundwater level prediction by: GA = RMSE pendant la phase de validation RMSE pendant la phase d apprentissage.
GA values equal to unity indicate that the ML model is perfect. If the GA is less than unity, the models are under-trained, while if it is greater than unity, the models are over-trained.

• Uncertainty and Sensitivity Analysis
In this study, uncertainties of the fitted models were assessed by comparing the observed and simulated values and calculating the standard error and confidence Bound as explained in Equations (8) and (9) with ei = X 0i − X pi , z is the z-score of the confidence level (for 95%, it is about 1.96), and e is the mean prediction error. Finally, the model sensitivity analysis was [63,64] performed to identify input parameters that considerably impact the model predictions of IWQ. This analysis was performed using the one-factor-at-time (OFAT) method based on the Monte Carlo approach, which is used to estimate the possible outcomes of an uncertain event [65,66]; an input variable was generated randomly while keeping other variables constant. Then, the absolute value of the difference in RMSE (|∆RMSE|) was calculated to assess the impact of each input variable. Therefore, the sensitivity of the model to an input increases the absolute value of the difference in RMSE.

Statistical Analysis
For further exploration of the variables, a correlation matrix analysis and an assessment of the importance of the input variables [66] were performed.
The correlation matrix is performed since it illustrates the importance of each parameter independently and their effect on the hydrochemistry [67,68]. If the values of (r) are +1 or−1 in the Pearson's correlation matrix, they are treated as strong correlation coefficients values and signify total correlation. If the values are closer to zero, it means there is no significant interaction between two variables at the p < 0.05 level [19,55]. If r is bigger than 0.7, the parameters are highly correlated, and if r is between 0.4 and 0.7, the parameters are moderately correlated. In this study, a correlation matrix is used to consider the correlation between chemical parameters and IWQ values. The results reported in Figure 7 show that electrical conductivity (EC) has a high correlation with TDS (r = 0.99), PS (r = 0.99), and SAR (r = 0.86)), while it has a low correlation with ESP (r = 0.30) and MAR (r = 0.05) indices. The pH has low correlations with all parameters. The temperature has the lowest correlations with all parameters. These results show that electrical conductivity (EC) is a more correlated input variable with the predicted parameters than pH and temperature. Nevertheless, high correlations do not imply causality since complex combinations of the features can have influences on the target variable. According to [15], the lowest correlations between T, pH, and EC prove that these parameters are separable and non-redundant and, therefore, are useful for improving the predictive accuracy of machine learning. tions of the features can have influences on the target variable. According to [15], the lowest correlations between T, pH, and EC prove that these parameters are separable and non-redundant and, therefore, are useful for improving the predictive accuracy of machine learning.

Implementation and Evaluation of Models
This study included the results of performing four different methods of predicting the irrigation water quality parameters (IWQ). The models used were as follows: artificial neural network (ANN), adaptive boosting (AdaBoost), support vector machine for regression (SVR) and random forest (RF). Three metric criteria were used to validate the above models: Pearson's correlation coefficient (r), RMSE, and RBIAS.
The results of the training and validation processes of the developed models are illustrated in figures 8 and 9, respectively.
The results of the training process reveal that the SVR model has significant values of RBIAS and RMSE compared with the other models for predicting the TDS parameter. The ANN, RF, and AdaBoost models revealed high accuracy in predicting the TDS parameter during the learning process with values of r equal to 0.94, RMSE equal to 500.07 mg L −1 , and RBIAS of 1% on average. It showed that all developed models performed very

Implementation and Evaluation of Models
This study included the results of performing four different methods of predicting the irrigation water quality parameters (IWQ). The models used were as follows: artificial neural network (ANN), adaptive boosting (AdaBoost), support vector machine for regression (SVR) and random forest (RF). Three metric criteria were used to validate the above models: Pearson's correlation coefficient (r), RMSE, and RBIAS.
The results of the training and validation processes of the developed models are illustrated in Figures 8 and 9, respectively.
The results of the training process reveal that the SVR model has significant values of RBIAS and RMSE compared with the other models for predicting the TDS parameter. The ANN, RF, and AdaBoost models revealed high accuracy in predicting the TDS parameter during the learning process with values of r equal to 0.94, RMSE equal to 500.07 mg L −1 , and RBIAS of 1% on average. It showed that all developed models performed very well with average correlation coefficients of 0.90, RBIAS less than 3% in absolute value, and average RMSE around 5 meq L −1 . Based on the training results (Figure 8), the four models perform satisfactory for the prediction of the sodium absorption ratio (SAR) and the percent exchangeable sodium (ESP). In fact, the correlation coefficients are 0.61 and 0.62, respectively. Similarly, the coefficients RMSE and RBIAS proved acceptable results for the two IWQs. As for the magnesium adsorption ratio (MAR), two of the statistical parameters (RBIAS and RMSE) showed that all models performed it moderately well, and only AdaBoost has a good person's coefficient (r). Hence, it was inferred that the AdaBoost model had a good performance in predicting all the IWQs parameters. However, random forest and artificial neural network models were unable to predict the MAR parameter. Overall, we can notice that there is no significant superiority between the ensemble models in the training process.
Sustainability 2022, 14, x FOR PEER REVIEW SVR models. However, RMSE showed an unacceptable performance for all models simulation of the TDS and MAR parameters, and RBIAS showed a lowest perfor for the SVR model for the simulation of the TDS and MAR parameters. When com the performance results, two of the simulated models (AdaBoost and RF) had low formance in the training process while the ANN and SVR models presented ver results during the two processes for the prediction of all IWQs parameters. All m except ANN for the SAR parameter, have RBIAS values less of than 6% in absolute indicating that the fitted models are unbiased.  The scatter plot ( Figure 10) shows the relationship between observed and simu variables over all IWQs parameters for all developed models. It identifies a better bution on the X = Y line for the random forest for all models. Moreover, it shows th predicted values are very close to the observed values for the AdaBoost model exce the MAR parameter. In fact, the accuracy of the models is satisfactory when the valu distributed on or uniformly across the two diagonals of the X = Y line, showing th errors obey the Gaussian distribution [15]. Even though the SVR and ANN m showed a satisfactory performance during the training phase, they failed to reprodu ESP parameter due to an RMSE which was very high (greater than 10%). Yet, the validation process, evaluation of generalizability, sensitivity, and uncertainty analysis are essential issues to evaluate the above models. Therefore, model validation was performed using same algorithm with twenty percent of the data that were simulated to assess the validation ( Figure 9) and generalization ability. The Pearson's coefficient values range from 0.65 to 0.94 for the four parameters TDS, PS, SAR, and ESP over ANN and SVR models. However, RMSE showed an unacceptable performance for all models for the simulation of the TDS and MAR parameters, and RBIAS showed a lowest performance for the SVR model for the simulation of the TDS and MAR parameters. When comparing the performance results, two of the simulated models (AdaBoost and RF) had lower performance in the training process while the ANN and SVR models presented very close results during the two processes for the prediction of all IWQs parameters. All models, except ANN for the SAR parameter, have RBIAS values less of than 6% in absolute value, indicating that the fitted models are unbiased.
The scatter plot ( Figure 10) shows the relationship between observed and simulated variables over all IWQs parameters for all developed models. It identifies a better distribution on the X = Y line for the random forest for all models. Moreover, it shows that the predicted values are very close to the observed values for the AdaBoost model except for the MAR parameter. In fact, the accuracy of the models is satisfactory when the values are distributed on or uniformly across the two diagonals of the X = Y line, showing that the errors obey the Gaussian distribution [15]. Even though the SVR and ANN models showed a satisfactory performance during the training phase, they failed to reproduce the ESP parameter due to an RMSE which was very high (greater than 10%). Therefore, it can be deduced that the SVR model has the weakest performance in predicting PS and SAR parameter, whereas the AdaBoost model has the best performance in predicting all parameters. After follows the ANN and the RF in predicting TDS, PS, and SAR parameters and TDS, PS, SAR, and ESP parameters, respectively. These results are in accordance with previous findings [15,69]. The researchers found that the AdaBoost model is superior to the support vector machine and artificial neural network models. To have useful models to predict new data sets, while avoiding errors, it is necessary to test its generalization capability. This way, once the model is developed, the end-users could Therefore, it can be deduced that the SVR model has the weakest performance in predicting PS and SAR parameter, whereas the AdaBoost model has the best performance in predicting all parameters. After follows the ANN and the RF in predicting TDS, PS, and SAR parameters and TDS, PS, SAR, and ESP parameters, respectively. These results are in accordance with previous findings [15,69]. The researchers found that the AdaBoost model is superior to the support vector machine and artificial neural network models. To have useful models to predict new data sets, while avoiding errors, it is necessary to test its generalization capability. This way, once the model is developed, the end-users could test it with any new dataset coming, for example, from real-time measurement sensors. Therefore, the stability of machine learning models in forecasting real-time water quality parameters is essential, especially when policy makers and researchers have strategies to develop this approach in irrigation water management [15]. In this study, the generalization ability to different input variables was evaluated. Figure 11 indicates that the ANN model for TDS model is overfitted while all other models are underfitted. However, the generalization ability of the random forest and AdaBoost model are weaker than the ANN and SVR models. test it with any new dataset coming, for example, from real-time measurement sensors. Therefore, the stability of machine learning models in forecasting real-time water quality parameters is essential, especially when policy makers and researchers have strategies to develop this approach in irrigation water management [15]. In this study, the generalization ability to different input variables was evaluated. Figure 11 indicates that the ANN model for TDS model is overfitted while all other models are underfitted. However, the generalization ability of the random forest and AdaBoost model are weaker than the ANN and SVR models.

Uncertainty and Sensitivity Analysis
The issue of uncertainties in conceptual models in water quality modelling is inevitable and has been discussed in many studies [42,45,70,71]. In this study, the uncertainty was analysed and showed that the SVR model has the highest (95%) confidence bound values, followed by the ANN, RF, and AdaBoost models ( Table 6).
The sensitivity of the model provides an overview of the impact of input variables on the output. This analysis is necessary to assess how the model acts according to shifts in input values (data quality, noise tolerance, etc.). Therefore, in this study, sensitivity analysis of built models ( Figure 12) was performed by simulating the models after adding a random Gaussian noise to the input variables (EC, pH and T).

Uncertainty and Sensitivity Analysis
The issue of uncertainties in conceptual models in water quality modelling is inevitable and has been discussed in many studies [42,45,70,71]. In this study, the uncertainty was analysed and showed that the SVR model has the highest (95%) confidence bound values, followed by the ANN, RF, and AdaBoost models ( Table 6). The sensitivity of the model provides an overview of the impact of input variables on the output. This analysis is necessary to assess how the model acts according to shifts in input values (data quality, noise tolerance, etc.). Therefore, in this study, sensitivity analysis of built models (Figure 12) was performed by simulating the models after adding a random Gaussian noise to the input variables (EC, pH and T). Sensitivities of the models to the inputs differ based on type of inputs, IWQs parameters and models. In fact, the results of sensitive analysis show that the models are more sensitive to: (i) electrical conductivity followed by temperature and pH, respectively for predicting TDS and MAR; (ii) pH for predicting ESP parameter; (iii) electrical conductivity followed by the pH and the temperature, respectively for predicting PS and SAR.
Moreover, the AdaBoost was found to be the most sensitive model since it has the highest values of the absolute value of the difference in RMSE. However, the overall results of the sensitivity analysis show that the models are quite stable in predicting IWQ.

Discussion
In this research, four models: random forest (RF), support vector regression (SVR), artificial neural networks (ANN), and adaptive boosting (Adaboost) were used to predict the irrigation water quality parameters (IWQ): total dissolved solids (TDS), potential salinity (PS), sodium adsorption ratio (SAR), exchangeable sodium percentage (ESP), and magnesium adsorption ratio (MAR) through low-cost in situ physicochemical [72,73] pa- Sensitivities of the models to the inputs differ based on type of inputs, IWQs parameters and models. In fact, the results of sensitive analysis show that the models are more sensitive to: (i) electrical conductivity followed by temperature and pH, respectively for predicting TDS and MAR; (ii) pH for predicting ESP parameter; (iii) electrical conductivity followed by the pH and the temperature, respectively for predicting PS and SAR.
Moreover, the AdaBoost was found to be the most sensitive model since it has the highest values of the absolute value of the difference in RMSE. However, the overall results of the sensitivity analysis show that the models are quite stable in predicting IWQ.

Discussion
In this research, four models: random forest (RF), support vector regression (SVR), artificial neural networks (ANN), and adaptive boosting (Adaboost) were used to predict the irrigation water quality parameters (IWQ): total dissolved solids (TDS), potential salinity (PS), sodium adsorption ratio (SAR), exchangeable sodium percentage (ESP), and magnesium adsorption ratio (MAR) through low-cost in situ physicochemical [72,73] parameters (T, pH, EC) as input variables. The performance of the tested models was evaluated according to Pearson's correlation coefficient (r), the root means square error (RMSE), and the relative bias (RBIAS). The model sensitivity was evaluated to identify [74] input parameters that considerably impact the model prediction using the one-factor-attime (OFAT) method of the Monte Carlo (MC) approach. In accordance with the reviewed literature, [30,69,75] the results show that the AdaBoost model is the most appropriate for predicting all parameters, with R ranged between 0.88 and 0.89, and that the random forest model is suitable for predicting only four parameters: TDS, PS, SAR, and ESP, with R ranged between 0.65 and 0.87. Added to that, as found by [22,76], this study identifies that The ANN and SVR models perform well in predicting three parameters (TDS, PS, SAR) and two parameters (PS, SAR), respectively, with most optimal value of generalization ability (GA) close to the unity.
Furthermore, MAR is the worst predictive parameter. This unproductive prediction accuracy is probably due to the low relationship between the EC and the pH used as input variables. Additionally, as explained by [7,9,22,27,29,61,74], the more significant the correlation between the input and output variables, the higher the performances of the models. Hence, the accurate prediction highly depends on the number of input variables and their impact.
In general, the methodology of the proposed models for prediction of the irrigation water quality parameters (IWQ) has proved its effectiveness. The effectiveness of ML models does not only depend on the accuracy of the prediction but also on the nature and number of predictors used. It is noteworthy that the use of physicochemical parameters such as EC, pH, and T could significantly enhances the performance of machine learning models [15,77]. Consequently, it is important to explore ML models for water quality index prediction using only physicochemical parameters as input variables without decreasing the efficiency of the models. Accordingly, this provides an incentive for decision makers to apply artificial intelligence for water quality planning and management.
However, the stability of the ML models in the forecasting of the IWQ parameters in real time is crucial, mainly when it is closely linked with the decision maker. Therefore, while ML models are fairly stable in forecasting the IWQ parameters, it should be highlighted that the selection of the models must be based on deeper sensitivity analysis by using smart technologies based on the Internet of Things (IoT) as a more secure and regular data alternative as explained by [60]. Moreover, the generalization of these models must be deeply studied because there are other variables that may interfere and influence water quality.

Conclusions and Future Trends
The key goal of this research is to evaluate the ability of machine learning (ML) models to predict the quality of groundwater for irrigation purposes in the downstream Medjerda river basin (DMB), in Tunisia. Therefore, Adaboost, random forest, ANN, and SVR models were developed and evaluated to predict TDS, PS, SAR, ESP, and MAR parameters using physico-chemical parameters as input variables. This study confirmed that the AdaBoost model is appropriate for predicting all parameters while the random forest model is suitable for predicting only four parameters: TDS, PS, SAR, and ESP.
Added to that, this study found out that the ANN and SVR models perform well in predicting 3 parameters (TDS, PS, SAR) and 2 parameters (PS, SAR) of 5 parameters, respectively. However, the SVR and ANN models showed better generalization ability than the AdaBoost and random forest models. Then, the sensitivity analysis showed that the developed models are less sensitive to the input variables used compared with the range of each predicted parameter. The ML models characterized by physical parameters are effective tools and should be recommended for predicting water quality parameters.
This research presents an effective use of machine learning models in forecasting the irrigation groundwater quality indices through low-cost data and can be used as a decision support systems (DSS) tool for sustainable water management in DMB. In fact, the traditional simulation modelling approaches are dependent on datasets that involve a large amount of unknown or unspecified input data and generally consist of high-cost time-consuming processes. Therefore, setting up a DSS based on machine learning models will boost the efficient use of water and rationalize its use by all water stakeholders at watershed level.

Data Availability Statement:
The study did not report any data.