## 5 Discussion  
This study employed a wireless IoT framework where the data are collected automatically by sensors and those data are transmitted to the AWS cloud. The AWS cloud infrastructure is handled by Terraform. Telegraf and Grafana are used to preprocess the data and visualize them. On the other hand, an ensemble ML model is also proposed for predicting the water quality from those data, which will also run in the AWS cloud and classify those data in real time. Previously, many authors have suggested an IoT-based framework for water quality prediction, such as [PERSON] et al. [37], who proposed an Arduino-based water quality prediction system, but this system was not fully wireless and  
Figure 7: Grafana dashboard for monitoring and visualization of water quality.  
there was no visualization system. On the other hand, [PERSON] et al. [9] proposed an IoT-based cloud framework for water quality prediction, but there was no visualization method for the predictions or for the parameters. This study also employed two multi-regional datasets to develop a precise ensemble learning algorithm. Before proposing the ensemble algorithm, seven standalone learning algorithms (LR, SVM, DT, KNN, RF, GNB, HGB, and XGB) were evaluated separately on dataset 1 after properly adjusting their parameters using the grid search cross-validation (GridSearchCV) technique. Previously, the predictive strength of these individual algorithms was examined by researchers [14,38] for indexing water quality in various datasets. The outcomes of the previously conducted studies [14,38], particularly the study of [PERSON] et al. [14], illustrate that the standalone algorithms perform ordinarily while predicting the accurate class due to inaccurate parameters.  
In the current study, the GridSearchCV approach improved the performance of all of the standalone algorithms shown in Figure 4; more specifically, the improvement in the LR and SVM algorithms was the most significant. In a similar study [14], the authors reported that the LR and SVM algorithms achieved accuracies of 64.73% and 93.68%, respectively. In contrast, this study demonstrated improved accuracies of 70.15% for LR and 96.64% for the SVM. Combining the top-performing algorithms can considerably improve the classification accuracy to a greater extent. These findings also indicate that after finely tuning and merging the RF, XGB, and HGB algorithms, the ensemble algorithm outperformed the standalone algorithms, with an accuracy of 99.8%. Considering that 75% of water comes from groundwater [26] and the fact that a massive quantity of data is needed for WQI, this study included groundwater data samples collected from nested and line wells in Bangladesh to validate the proposed algorithm.  
The applicability of the proposed technique extends beyond water quality classification, demonstrating potential utility in water resource management and environmental damage reduction. The proposed framework can be useful in different ways, which are outlined below:  
* Smart agriculture: In agricultural settings, IoT-based water quality monitoring can help with efficient water usage, ensuring that crops receive clean water and reducing the risk of soil and crop contamination.
* Data-driven policy making: Comprehensive data analysis can assist decision-makers in improving rules and regulations based on accurate and real-time data, ensuring better management of water resources.
* Scientific research and innovation: Comprehensive data collection can support scientific research, bringing innovative ideas and perspectives to water treatment technologies, pollution control methods, and environmental sustainability practices.