## 3 Research Methodology
### Data Preprocessing  
The same four features from dataset 2 were chosen to evaluate the proposed model, as the training dataset contained only four features. After selecting them, we computed WQI for 316 data points. WQI is determined by aggregating the values of numerous water  
\begin{table}
\begin{tabular}{l l l l} \hline \hline
**Monitoring Event** & **Type of Water** & **Wet Season** & **Dry Season** \\ \hline Well Nests & Groundwater & 151 & 133 \\ \hline Line Wells (Up to 100 m) & Groundwater & 430 & 190 \\ \hline Line Wells (Up to 30 m) & Groundwater & - & 53 \\ \hline Surface Water & Surface water & 95 & 44 \\ \hline Total & - & 676 & 420 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Number of water samples analyzed.  
Figure 3: Proposed ensemble-based ML with hyperparameter optimization.  
quality parameters into a single value using the WAI method. For WQI, we need the standard values of the parameters, and for this purpose, we followed the Environment Conservation Rules (1997) [33]. The process of WQI using the WAI method typically involves the following steps:  
1. Select the water quality parameters for WQI; for instance, the selected parameters in this study are pH, DO, CODMn, and NH3-N.
2. Assign weighting factors to each parameter based on their relative importance.
3. Normalize the values of each parameter according to a scale of 0 to 1.
4. Multiply the normalized values of each parameter by their corresponding weighting factors.
5. Sum the weighted values of all the parameters for WQI.  
Here is a brief explanation of how we can use the WAI for WQI.
* Calculation of the sub-index of quality rating (\(q_{n}\)): Let \(n\) denote the water quality parameters, and let \(q_{n}\) denote the quality rating or sub-index corresponding to the \(n\)th parameter, where \(q_{n}\) is a number representing the relative value of this parameter in the tainted water with regard to its allowable standard value. The following equation may be used to obtain the \(q_{n}\) value of \[q_{n}=\frac{100[(V_{n-V_{i_{0}}})]}{S_{n-V_{i_{0}}}}\] (2) Here, \(q_{n}\) = the quality rating for the \(n\)th water quality parameter. \(V_{n}\) = the estimated value of the \(n\)th parameter of a given sample. \(S_{n}\) = the standard permissible value of the \(n\)th parameter. \(V_{i0}\) = the ideal value of the \(n\)th parameter in pure water. All the ideal \(V_{i0}\) values are taken as zero (0) for drinking water for all other parameters [35].
* Calculation of the unit weight (\(W_{n}\)): It is the suggested standards (\(S_{n}\)) that play a negative role in the \(W_{n}\) calculations for the different water quality measures. \[W_{n}=\frac{K}{S_{n}}\] (3) Here, \(S_{n}\) = the standard value for the \(n\)th parameter; \(K\) = a constant for proportionality.
* Calculation of WQI: Using this formula, we can determine the \(WQI\): \[WQI=\frac{\sum q_{n}W_{n}}{\sum W_{n}}\] (4)
* WQI assessment: There are 5 tiers of WQI. The five categories of water quality according to the mathematical WQI technique are shown in Table 5.  
In this research's sample data points, only 5 classes are found: 1, 2, 3, 4, and 5.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**WQI (Range)** & **Water Quality Status** & **Possible Usage** \\ \hline
0–25 & Excellent & Mainly drinking \\ \hline
26–50 & Good & Drinking, irrigation, and industrial \\ \hline
51–75 & Poor & Irrigation and industrial \\ \hline
76–100 & Very poor & Only irrigation \\ \hline Greater than 100 & Unsuitable for drinking or fish culture & Proper treatment needed before use \\ \hline \hline \end{tabular}
\end{table}
Table 5: WQI ranges [36].