Skip to content

Original Research

Frontiers in Environmental Chemistry ·

Volume 7 - 2026 | https://doi.org/10.3389/fenvc.2026.1892651

Closed-loop AI-integrated smart nanomaterial sensor-separation platform for real-time detection and adaptive capture of emerging pollutants in water systems

  • R Yasir Abdullah1*corresponding author
  • U Barakkath Nisha2
  1. 1Department of Artificial Intelligence and Data Science, Dr. Mahalingam College of Engineering and Technology, Pollachi, Tamil Nadu, India
  2. 2Department of Computer Science and Engineering, Dr. Mahalingam College of Engineering and Technology, Pollachi, Tamil Nadu, India
Article metrics0 viewsView details

Abstract

Selective absorption of pollutants can be attained using smart nanomaterials despite the fact that most of the conventional methods of treating water separate the sensing process from the actual remediation. This work proposes a new approach where smart nanomaterials are used in sensing water quality using artificial intelligence in a closed-loop system while estimating adsorption capacity. The system architecture includes two interrelated modules. In Module I, contamination states are classified using seven physicochemical sensing features, namely, pH, conductivity, turbidity, total dissolved solids, temperature, responsiveness due to flow effects, and signal-related variables from sensors. The other module, Module II, estimates the performance of adsorption using 24 adsorption related descriptors such as nanomaterial dosage, contact time, concentration, chemical properties, and others. Explainable AI algorithms that were based on SHapley Additive exPlanations (SHAP) helped interpret classification results and adsorption capacity. This approach yielded an accuracy of 90.96%, a precision of 94.39%, recall of 85.97%, an F1 score of 87.90%, and a macro-averaged AUC of 0.979. When evaluated against HydroShare’s Indian water body data set, external validation resulted in a DS-1 reference accuracy retention of 96.0% under similar sensing conditions, suggesting robust geographic generalization capabilities. Adsorption modeling returned an R-squared value of 0.986 for Pb(II), 0.993 for diclofenac, and 0.994 for ibuprofen. Closed-loop simulations cut adsorbent. The findings indicate that smart sensing, physics-based adsorption modeling, explainable AI, and adaptive remediation control can achieve considerable gains in the accuracy of contaminant detection, energy-efficient adsorption process, and intelligent water treatment strategy design. This approach can be viewed as a scalable, statistically supported, and interpretable framework for AI-enabled nanomaterial-based water purification systems.

Keywords

1 Introduction

Water contamination remains a major environmental and public-health challenge. Industrialization has been a very quick process, along with the growth of industries related to medicines, textiles, and agriculture practices, resulting in a distinct array of chemical pollutants that continually exceed the threshold limit of the treatment plants. These include heavy metals like lead and cadmium, artificial textile dyes like methylene blue, and pharmaceutical contaminants like broad-spectrum antibiotics like ciprofloxacin. Emerging pollutants differ from classical pollutants in that they are biologically toxic even at low levels, highly recalcitrant to biological treatment processes, and progressively accumulate within aquatic food chains, causing endocrine disruption, renal disorders, and global antimicrobial resistance trends (Aziz and Kareem, 2023). This emerging issue has caught global attention; specifically, UN Sustainable Development Goal 6 aims for universal access to clean water and sanitation by 2030, which continues to be threatened by the absence of significant strides in both contaminant identification and adaptation in treatment methods (Laishram et al., 2025).

Smart nanomaterials can be considered one promising solution to address some aspects of the problem described above. Adsorbents engineered from such materials as biochar, metal-oxide nanocomposites, and modified carbon architectures possess an impressive combination of high surface area, customizable surface properties, and a high affinity to ionic and organic contaminants that allows them to achieve very high efficiency in removal of contaminants (Aziz and Kareem, 2023). In addition to their application in environmental purification, certain types of nanomaterials can serve as transducers of a signal in electrochemical and optical sensors to allow trace detection of contaminants by measuring impedance, fluorescence, and surface-enhanced Raman scattering signals. It is worth noting that despite this double functionality of smart nanomaterials, the two capabilities have not yet been used together in one technological process (Sivaranjanee et al., 2024).

Simultaneously, developments in the field of machine learning have created additional opportunities for water quality management. Today, there are wireless sensor networks that utilize probes for measuring pH, turbidity, conductivity, total dissolved solids, temperature, and oxidation reduction potential in real time, and the use of classification algorithms has allowed for high-level identification of the type and extent of contamination (Singh and Walingo, 2024). In terms of adsorption control, gradient boosting decision trees, random forest models, and stacked machine learning architectures can predict adsorption efficacy with high precision when used to process data from large adsorption experiments on biochar (Haider Jaffari et al., 2023). Application of explainable artificial intelligence approaches and SHapley Additive exPlanations, in particular, has enabled increased reliability and scientific credibility of the models through detection of which physical and chemical properties affect predictions the most (Makumbura et al., 2024; Nasir and Li, 2024).

Despite these advances, there remains a crucial gap in current water-treatment practice. The detection system and the remediation system function independently and sequentially as before. Sensors detect pollution, report an event, and the treatment system performs its function according to set and constant parameters tuned based on historical data rather than current situations. While the delay involved in performing the process is a purely practical problem, it also poses a significant problem when dealing with dynamic situations where more than one pollutant is present in the water at varying concentrations. Static dosing is inefficient for these dynamic conditions and will lead to unnecessary usage of the adsorbent during times of low pollution, while insufficient amounts of adsorbents will be used during high pollution levels.

The novelty of the current study is not in the use of ensemble learning methods, SHAP, or adsorption modeling separately, as they have already been used independently in research on water quality classification and adsorption capacity estimation. What makes the proposed study different from previous approaches is the closed loop reasoning in which sensing information serves as a source to estimate nanomaterials’ adsorption capacity and adjust dosages and times according to physics-based limitations. Unlike existing water-quality classifiers and adsorption models, in this architecture, sensor outputs do not serve as mere classifications but as input parameters for further estimating adsorption capacities and adjusting parameters accordingly within the limitations set by physics.

From these identified gaps, it follows that the fundamental hypothesis tested by this work is that integrating multi-sensing parameters with physics-informed adsorption prediction using a feedback-controlled artificial intelligence paradigm would enhance the capabilities of contaminant-state identification and adaptive remediation when compared to either the former alone or the latter alone. The specific hypotheses proposed are: (i) the stacked learner approach, using the harmonized water quality sensing dataset, will achieve robust classification of the pollution states, with good generalization across datasets; (ii) a physics-informed regression model, with the properties of non-negative output values, maximum capacity constraints, and pseudo second-order kinetics, will outperform baseline models for prediction of pollutant capture efficiency; and (iii) a feedback-controlled algorithm, adjusting the dose and time of contact between the nanomaterial and the pollutants, will enable reduction in adsorbent dosage and contact time while still achieving the desired level of removal efficiency. In this work, the metal lead is selected as an example of heavy metals, owing to its persistent nature and toxicity, while diclofenac and ibuprofen are selected as examples of emerging organic contaminants.

Investigation on the frontiers of intelligent nanomaterials, water quality sensing, and machine learning has progressed rapidly in recent years and produced an extensive but scattered literature. Investigations into this field often fall within one of three separate categories: contaminant sensing via sensors, modelling the adsorption characteristics, or optimizing the process control operation. While significant advances have been made in all of these domains, very few investigations have tried to integrate more than two aspects of these categories in their approach, and even fewer have done so by integrating feedback control systems and machine learning models. It is therefore important to comprehend where a particular study fits into this picture before evaluating its significance.

Water quality monitoring using Wireless Sensor Networks (WSNs) and Machine Learning (ML) classifiers has been one of the most active research areas to date. Singh and Walingo (2024) conducted an extensive review of the IoT-based sensor architecture used for water quality monitoring and showed that deploying WSN with pH, turbidity, conductivity, and temperature sensors is feasible for continuous monitoring through a distributed network and comes with relatively low costs. It was shown that laboratory-based traditional techniques are no longer appropriate due to their inability to meet the high resolution required for detecting contamination in a dynamic environment. In a further study, Ramya et al. (2024) evaluated fourteen machine-learning classifiers for river water-quality monitoring using nineteen analytical water-quality parameters. Their results showed that Gradient Boosting achieved the strongest classification performance, with 99.64% accuracy, 0.95 precision, 0.96 recall, and 0.95 F1-score. The integration of SHAP and Local Interpretable Model-Agnostic Explanations (LIME) further confirmed the growing role of explainable AI in water-quality classification, although the study did not connect classification output with adsorption-based remediation control.

The work by Makumbura et al. (2024) incorporated explainability in the classification process by applying the XGBoost, Random Forest, and LightGBM classifiers with the SHAP model on the river water quality dataset, where they found that the most dominant factors were Chemical Oxygen Demand and Biochemical Oxygen Demand, while conductivity and pH had secondary roles in the prediction process. Similarly, Abdullah Al Mamun Hridoy et al. (2025) combined classification and WQI regression using advanced machine-learning models and SHAP interpretation, achieving 99.65% classification accuracy and R2 = 0.9685 for WQI prediction, but their framework also remained limited to water-quality assessment without nanomaterial-assisted adsorption prediction or closed-loop treatment control.

In the field of adsorption, the use of machine learning in predicting the efficiency of nanomaterials and biochar adsorption is one of the most technically advanced contributions to date. Haider Jaffari et al. (2023) created a dataset comprising of 3,757 points of experimental data collected from batch adsorption experiments on twelve classes of emerging contaminants using 24 input parameters. Ten tree-based methods were analysed, and both ExtraTrees and XGBoost showed the best predictive power, while SHAP partial dependence plots confirmed that contact time and concentration of contaminants at the beginning were the key factors for prediction. This dataset forms a primary training source for the regression module in the present work, and the mechanistic interpretations reported therein provide a benchmark against which the SHAP outputs from the current closed-loop system can be directly compared. Liu et al. (2024) coupled machine learning with pseudo-second-order and Freundlich theoretical models to compare key biochar properties controlling adsorption kinetics for emerging contaminants, finding that the hybrid physics-informed approach improved prediction reliability under extrapolation conditions compared with data-driven models alone. Laishram et al. (2025) provided an updated synthesis of biochar adsorption research showing that machine learning optimisation of biochar production and deployment has the potential to improve removal efficiency by over twelve percent on average across pollutant classes. Aziz and Kareem (2023) provided an in-depth study on the mechanism of biochar adsorption for heavy metals, demonstrating high rates of effectiveness above ninety percent for lead and cadmium through optimized conditions, with pH and surface area being the most important properties of the material used.

Thirdly, there is literature on the topic of using AI to optimize processes and adaptive controls in water treatment processes. In their 2024 literature review on the use of AI technologies in wastewater treatment plants, Nagpal et al. (2024) stated that intelligent process control could lead to substantial reduction in energy and chemicals used in the treatment process when prediction models are combined with operational setpoint modification. The authors characterized the prediction-optimization-control loop as the characteristic framework of future generation smart water systems and also highlighted the lack of field validation for closed-loop operations as the key challenge facing current researchers in the field. These sentiments were also echoed in another review of physics-based AI models in wastewater treatment published in 2026 (Yiting et al., 2026). Yiting et al. (2026) suggested that the combination of prediction models and optimization and control frameworks should be the primary focus of future researchers in the field.

Other recent studies also provide evidence on the applicability of smart carbon-based nanomaterials for pollutant sensing and cleanup. Specifically, the application of fluorescence-based techniques for antibiotic detection was described by Sardar et al. (2026), who emphasized selectivity, sensitivity, low-cost nature, and applicability to aqueous samples of carbon nanodots; this paper proved the contribution of nanotechnology into developing smart sensor systems for continuous assessment of water quality. Additionally, Noori et al. (2025) presented their results on the environmentally friendly synthesis of magnetized biochar from iron-containing waste materials such as sludge and used coffee grounds for Pb ion removal from ground water. Therefore, it is possible to conclude that sensing and adsorption based on nanomaterials have made considerable progress as independent processes but continue to be considered separately in many projects without any integration into AI-supported control systems.

Table 1 brings out the research studies carried out in terms of methodology covered, pollutant type, machine learning model applied, performance results generated, application of any Explainable AI approach, and the use of adaptive control/feedback systems of any kind. The observation from Table 1 reveals clearly that even as all the above components have been explored independently with increased levels of depths, no such study has tried integrating all these five components into a holistic approach, which is exactly what we propose in our current study. Unlike classification-based water quality contamination detectors alone, the framework developed here goes further by translating classification outcomes into adsorption control decisions. Unlike adsorption control systems that assume the knowledge of pollutant nature and treatment condition beforehand, the framework proposed here relates the sensing outcome of pollution state to adsorption capacity estimation and dosage and contact time optimization. Hence, the advantage of the framework proposed is not merely a reduction in prediction error of each individual module.

TABLE 1. Related studies on AI-assisted water quality monitoring and nanomaterial adsorption prediction.

ResearchFocusML methodBest reported metricXAI usedAdaptive controlKey limitation
Haider Jaffari et al. (2023)Adsorption predictionExtraTrees, XGBoost, RFR2 = 0.98SHAP, PDPNoNo sensing integration
Makumbura et al. (2024)Water quality predictionXGBoost, RF, LightGBMR2 = 0.992 (XGBoost)SHAPNoNo adsorption
Singh and Walingo (2024)WSN-based monitoringIoT with ML classifiersReal-time classification demonstratedNoNoClassification only
Ramya et al. (2024)River water-quality classificationGradient boostingGradient boosting achieved 99.64% accuracySHAP and LIMENoNo adsorption-prediction module
Liu et al. (2024)Biochar adsorption kineticsML + pseudo-second-order modelImproved extrapolation vs. standalone MLNoNoNo sensing input
Laishram et al. (2025)Biochar adsorption reviewML-optimised biochar design12.7% efficiency improvement via MLNoNoNo integrated sensing or control
Aziz and Kareem (2023)Heavy metal biochar adsorptionMechanistic analysis>90% removal efficiencyNoNoNo ML prediction model
Nagpal et al. (2024)AI in wastewater treatmentReview across ANNs, RF, LSTMOperational efficiency gains documentedPartialReview onlyNo closed-loop platform
Abdullah Al Mamun Hridoy et al. (2025)Water-quality classification and WQI predictionLightGBM and XGBoostAchieved up to 99.65% classification accuracySHAPNoNo nanomaterial adsorption module
Nasir and Li (2024)WWTP sludge predictionRF, XGBoost with XAIHigh prediction accuracy with XAISHAP, LIMENoNo pollutant detection
Yiting et al. (2026)AI for smart WWTPsPhysics-informed neural networksClosed-loop framework proposedPartialProposed, not validatedNo experimental validation of closed loop

The picture that emerges from the related literature is one of a field that has built strong individual tools but has not yet connected them. Classification models are not talking to remediation systems. Adsorption prediction engines are not receiving real-time sensor inputs. Explainability frameworks are applied after the fact rather than embedded in operational decision loops. The present study is designed to close each of those gaps within a single coherent architecture, producing a platform where every module informs every other in continuous operation.

3 Methods

3.1 Framework and closed-loop system architecture

The platform proposed in this study departs from the prevailing practice of treating contamination detection and remediation as sequential, manually coupled operations. Instead, it embeds both functions within a single continuously operating control architecture in which each module informs the next and effluent quality data return to update upstream decisions in real time. This section describes the theoretical basis and structural design of that architecture, which is organised into three hierarchical tiers as shown in Figure 1. The first tier is the nano-sensor layer, responsible for acquiring a seven-dimensional physicochemical signal vector from the water stream. Each sensor parameter was selected on the basis of its established sensitivity to a distinct mechanism of chemical contamination. Conductivity responds proportionally to dissolved ionic species and is therefore a direct proxy for heavy metal concentration and salt-based contamination. The turbidity factor represents particulate loading via an optically-measured backscattering effect that differentiates solid particles from dissolved chemicals. The pH is indicative of the acid-base composition of the sample and changes notably when there is a presence of acidic or alkaline industrial waste, acidic cleaners, and certain medicinal compounds. Total Dissolved Solids and Oxidation-Reduction Potential offer complementary measurements related to electrochemistry, with the latter being highly sensitive to oxidizing/reducing compounds including chlorine ions. The water temperature and the starting concentration of the pollutant C0 complete the list of attributes, the former taking into account variations in the response of the sensor to temperature changes, and the latter offering a quantifiable indicator of loading. Together, the seven factors are combined into a vector x used in the classification algorithm via a multi-sensor data collection module.

Architecture of the closed-loop AI-integrated smart nanomaterial sensor-separation platform for real-time pollutant detection, adsorption prediction, adaptive remediation, and treated-water verification.
Figure 1. Architecture of the closed-loop AI-integrated smart nanomaterial sensor-separation platform for real-time pollutant detection, adsorption prediction, adaptive remediation, and treated-water verification.

The second layer consists of a double-module artificial intelligence (AI) engine. The first of these two modules, the contaminant classification module, uses the input vector x and generates a class label as well as the corresponding probability score for that particular class. The sending of a triggering signal to the remediation actuator depends onwhere y ^ is the predicted contamination class, K is the set of contamination classes, x is the sensor feature vector, P (y=k∣x) is the posterior probability of class k and τ *conf* is the confidence threshold below which the system requests an additional sensing cycle rather than triggering remediation. This would prevent a false positive response in case of uncertain or transition states of contamination. After sending the classification response signal, the regression unit would process the classification of contamination together with the 24-dimensional adsorption descriptor vector z and provide. The adsorption-capacity estimate is computed using Equation 2.where q ^ e is the predicted adsorption capacity in mg/g, z∈R24 is the descriptor vector encoding nanomaterial dosage, BET surface area, contact time, initial pollutant concentration, solution pH, ionic strength, and biochar pyrolysis properties, g (⋅) is the trained ensemble regression function, and θ represents the learned model parameters. The physics-informed constraint layer ensures that q ^ e ≥ 0 and that predicted values remain consistent with the theoretical maximum capacity derived from Langmuir isotherm theory for the given adsorbent-pollutant pair. The third tier is the adaptive remediation actuator, which translates regression outputs into operational commands. Optimal nanomaterial dosage D* is determined by solving a resource-constrained optimisation. The dosage optimization problem is formulated using Equation 3.where *D* * is the adsorbent dosage in g/L, D is the maximum allowable dosage, η ^ D , t is the predicted removal efficiency as a function of dosage and contact time, and η target. η is the minimum acceptable removal efficiency, set at 95% in this study. Contact time t is adapted in parallel by identifying the minimum time at which the pseudo-second-order kinetic model predicts that the target η ^ is reached, Negative dosage has no physical meaning in adsorption operation; therefore, the search domain is constrained to D ≥ 0. If an unconstrained optimization routine produces a negative value, it is rejected as physically invalid.

y ^ = arg max k ∈ K P y = k ∣ x , if ⁡ max k ∈ K ⁡ P y = k ∣ x ≥ τ c o n f (1)

q ^ e = g z ; θ (2)

D * = min D ∈ ⌈ 0 , D Max ⌉ D subject to η ^ D , t ≥ η target (3)

The 95% threshold of removal efficiency for proving the concept of operation was chosen as a conservative approach but not as a standard to be followed universally. This value was chosen in order to check whether the feedback control algorithm will provide a high level of pollutant removal at lower costs, as in terms of both adsorbent consumption and contact time required. In practical implementation of the developed feedback control system, this threshold can vary depending on particular discharge standards for pollutants, influent pollution level, adsorbent cost, among other factors. First, the initial adsorbent dose was estimated based on the classification of contaminants. Then, the capacity of adsorption process and removal efficiency were predicted. Subsequently, if target efficiency was not achieved, the algorithm increases the dose of the adsorbent by ΔD.

Figure 1 shows the full loop from smart sensing to detection, prediction of adsorption, and intelligent remediation. In the smart sensing layer, input water undergoes transformation into a sensor vector by means of the nano-sensor’s response and signal acquisition. The AI detection layer performs pre-processing of the vector, followed by classification of the pollutant status and confidence-based decision routing. For correct confidence, adsorption features are then provided to the regression model, which in turn computes the constraint layer for estimating the feasibility of adsorption. The remediation layer controls the dosage and duration of adsorption prior to capturing the pollutants and their confirmation.

3.2 Multi-source dataset integration and data engineering

The development of a dependable system of machine learning for contamination detection and intelligent treatment involves much more than just one high-quality data set, since the characteristics of water quality in real life depend on many parameters, such as geographically and seasonally diverse water contamination processes and water treatment techniques, which cannot be accounted for by one particular experiment. In order to overcome the problem, this research utilizes six different data sets that were made publicly available as a result of sensing experiments, open water body analysis, and biochar adsorption experiments. Each of those data sets plays a particular and distinctive role in either the classification or the regression module.

3.2.1 Dataset harmonization and leakage prevention

To avoid potential artificial boosting due to the incompatibility of the data sources, the datasets from sensing and adsorption studies were not concatenated to a unified feature matrix but underwent two separate pipelines. DS-1 to DS-4 served as inputs only for the classification model based on water quality sensing features. At the same time, DS-5 and DS-6 were exclusively used for predicting the adsorption capacity. Feature harmonization consisted of using only semantically meaningful variables such as pH, conductivity, turbidity, total dissolved solids, temperature, flow response features, and sensing signal features in Module I. Datasets with varying labeling approaches were not forced to have similar labels but were employed only as benchmark datasets or for external validation of Module I (DS-2 and DS-3) or geographical validation of Module I (DS-4). In Module II, adsorption features were transformed depending on experimental conditions such as dosage, contact time, initial concentration, solution pH, temperature, adsorbent properties, and material composition features. Target equivalents such as adsorption capacity, removal capacity, uptake, qe, and qmax were eliminated from input features in order to prevent target leakage. Parameters for normalization, imputation, and feature selection were estimated using only training partitions.

The diagram below shows how six data sets are processed by two distinct pipelines before being used in two AI modules. The dual-dataset-based processing model is depicted in Figure 2 that facilitates the link between the sensing-based contamination classification process and adsorption-based remediation prediction. DS-1 to DS-4 represent the sensing dataset pipeline, in which the steps include cleaning, treating the missing value, scaling, balancing class, and feature selection for the formation of classification inputs for Module I. The pollution detector predicts pollution class and the corresponding severity score to drive the control block in the closed loop. Simultaneously, DS-5 to DS-6 feed the adsorption dataset pipeline, where the adsorption data undergoes the processes of cleaning, filtering, standardization, and reduction by means of selecting descriptors for inputting into Module II.

Dual-dataset AI pipeline integrating sensing-based contamination classification and adsorption-based remediation prediction for closed-loop water-treatment control.
Figure 2. Dual-dataset AI pipeline integrating sensing-based contamination classification and adsorption-based remediation prediction for closed-loop water-treatment control.

The main sensing dataset, referred to as DS-1 in this paper, was collected from a wireless sensor network monitoring drinking water under ten different contamination experiments (Singh and Walingo, 2024). The sensors detecting pH, turbidity, flow rate, and conductivity were contaminated with soil, chlorine, salt, washing powder, vinegar, and their combinations, resulting in a labelled multi-parameter time series data. This will serve as the basis for training the contamination classifier. DS-1 contains the class ground truth that is used to evaluate the rest of the sensing datasets. Two secondary sources will supplement the main source in this paper. DS-2 represents the UCI water quality prediction dataset containing 705 observations and 984 KB of multi-parameter physicochemical data, useful for regression sub-task and feature profiling when tuning the hyperparameters of the algorithm. DS-3, on the other hand, is the Kaggle water potability dataset containing 3,276 entries over ten physicochemical parameters and used for classification benchmarking to derive the lower bound. Collectively, both sources contribute more features without introducing redundant class labels to the classifier pipeline.

DS-4 is the Hydroshare Aqua attributes data set consisting of 1,360 instances of water quality measurement data collected from Indian river, reservoirs and lake monitoring sites in different geographical locations and times of year. This particular data set is used only to conduct generalization testing for the machine learning classification algorithm based on completely independent data obtained under field conditions in an altogether different region. In the adsorption scenario, DS-5 represents the major training data for the regression algorithm. Containing 3,757 entries of adsorption capacity experiments carried out on twelve categories of emerging contaminants using biochar material, this particular set was sourced from a GitHub repository (Haider Jaffari et al., 2023). The 24-dimensional input vector consists of three variables of biochar synthesis, three material attributes, six elements of chemical composition, and twelve experimental conditions such as pH, concentration of pollutant, contact time, temperature, and dosage. DS-6, located in the same repository, includes 1,519 entries for measuring adsorption capacity of Pb (II) metal and represents an external testing set for the regression algorithm. Two pre-processing chains are strictly segregated to ensure that there is no cross-contamination of the features distribution for sensors and adsorbers’ input data. As far as the classification chain is concerned, the min-max normalisation method is employed on all the sensor parameters. Min-max normalization for the classification pipeline is performed using Equation 4.where x represents the value sensed by the raw data sensors for the specific feature, x max and x min are the minimum and maximum values of that feature, respectively, as per the observations in the training dataset, and x norm ∈ [0,1] represents the output after normalisation. Missing data points are imputed using k-nearest neighbours with k = 5. The class imbalance in DS-1 is balanced using Synthetic Minority Oversampling Technique (SMOTE). Class imbalance could have introduced systematic bias in the classifiers towards contamination classes. In the regression pipeline, adsorption features are normalised using z-score transformation. Adsorption features in the regression pipeline are standardized using Equation 5.

x norm = x − x min x max − x min (4)

x std = x − μ σ (5)

Here, μ stands for the average value of the descriptor, while σ is the standard deviation obtained from the training data set DS-5. The aforementioned normalization procedure is more appropriate to apply on adsorption data than the min-max one since the latter contains extreme values due to real-life high concentration/temperature experiments. Outlier detection uses Isolation Forest with a contamination rate of 0.05, removing anomalous records without discarding legitimate boundary-condition data. Feature selection is performed independently for each pipeline using mutual information scoring. Mutual-information-based feature selection is calculated using Equation 6.where X is a candidate input feature, Y is the target variable (contamination class label or adsorption capacity), p (x, y) is the joint probability of observing the feature value x and target value y simultaneously, and p(x) and p(y) are the respective marginal probability distributions. Higher values of I(X;Y) indicate stronger statistical dependence between the feature and the target. Features with negligible mutual information scores are removed before recursive feature elimination with cross-validated scoring produces the final optimised feature subsets that enter Module I and Module II without overlap.

I X ; Y = ∑ x ∈ X ∑ y ∈ Y p x , y log p x , y p x p y (6)

3.3 Methodology: dual-module AI engine with explainability

The contaminant classification model, or Module I, is constructed through the application of the stacked learning architecture, whereby four base classifiers, namely, Random Forest, Gradient Boosting, Support Vector Machine, and K-Nearest Neighbors, are considered. As for the methodological framework underlying the research process, it should be noted that two architectural AI models that function in a sequential order in the closed-loop framework, as outlined in Section 3.1, are employed. They include the contaminant classification module and the adaptive adsorption regression module. The reason why this separation is required is due to their different data sources, optimization goals, evaluation metrics, and explainability methods. This structure also makes it possible to trace each module clearly to the research objectives stated in the Introduction. Each base learner receives the same pre-processed seven-dimensional sensor input vector and produces a class-conditional probability score independently. These four score vectors are then concatenated and passed to a Logistic Regression meta-learner, which learns the optimal linear combination of base-learner outputs to produce the final prediction. The formal structure of the stacking architecture is

y ^ = f meta h 1 x , h 2 x , h 3 x , h 4 x (7)

In Equation 7, h b(x) denotes the class-probability output of the bth base learner given sensor input vector x, and f meta is the Logistic Regression meta-learner that maps the concatenated base-learner outputs to the final predicted class label y ^. The subscript b indexes the four base learners (Random Forest, Gradient Boosting, Support Vector Machine (SVM), and K-Nearest Neigbors (KNN)) and is distinct from the contamination class index k used in Equation 1. Stacking is preferred over simple majority voting because it allows the meta-learner to down-weight base learners that systematically underperform on specific contamination types, a particularly important property when compound contamination scenarios produce ambiguous sensor signatures that confuse individual classifiers while remaining distinguishable to a learned combination. Hyperparameter optimisation for all four base learners is conducted using Optuna-based Bayesian search with 200 trials per learner, optimising the number of estimators and maximum tree depth for tree-based models, regularisation strength C and kernel bandwidth gamma for the SVM, and neighbourhood size k for K-Nearest Neighbours, each evaluated under five-fold stratified cross-validation. Final generalisation is assessed using ten-fold stratified cross-validation on the full DS-1 training corpus, followed by evaluation on the held-out 20% test partition and external validation on DS-4. The adaptive adsorption regression engine (Module II) employs a weighted voting ensemble of three gradient-based regressors: Gradient Boosted Regression Trees, ExtraTrees, and HistGradientBoosting, with ensemble weights determined by cross-validated performance on DS-5. A physics-informed post-processing layer enforces two hard constraints on all predictions: adsorption capacity must be non-negative, and must not exceed the Langmuir theoretical maximum for the given adsorbent-pollutant pair. Contact-time recommendations are further constrained to be consistent with pseudo-second-order kinetic theorywhere t is contact time in minutes, q *t* is the adsorption capacity at time t in mg/g, q *e* is the predicted equilibrium adsorption capacity in mg/g, and k 2 is the pseudo-second-order rate constant in g/(mg min). This constraint ensures that contact-time recommendations are physically consistent with diffusion-limited chemisorption rather than unconstrained statistical interpolations. Separate sub-models are trained for Pb (II), methylene blue, and ciprofloxacin, sharing a common 24-variable feature backbone augmented with a one-hot pollutant-type indicator vector that allows the ensemble to adjust predictions according to the molecular properties of each specific contaminant. The explainability layer is applied to each module separately by means of TreeSHAP, which calculates the Shapley attribution value precisely for each input feature. TreeSHAP attribution values are calculated using Equation 9.where ϕi is the SHAP attribution value for feature i, F is the complete set of input features, S is any subset of features not containing i, f(S) is the model prediction when only the features in S are available with remaining features marginalised, and f (S∪{i}) is the prediction when feature i is included. Weighting Kernel S ! ( | F − S − 1 ) ! ensures that the weight assigned to each subset is proportional to the extent to which it represents all possible combinations. Rankings based on the importance measure are summarized into beeswarm plot summaries over the entire test dataset, while local waterfall plots are used to represent individual instances of contamination prediction and adsorption for instance-level audit purposes. In addition, LIME is used for outlier instances where the SHAP value differs from the actual prediction. SHAP values were interpreted as model-attribution measures rather than direct causal or mechanistic proof.

t q t = 1 k 2 q e 2 + t q e (8)

ϕ i = ∑ S ⊆ F \ i S ! F − S − 1 ! F ! f S ∪ i − f S (9)

The internal decision-making process of the designed explainable closed-loop platform is illustrated in Figure 3. Input pre-processing involves integrating data from sensors and adsorbers, pre-processing the data and retaining relevant feature values for future learning purposes. Module I make use of base learners, probabilities, and the meta-learner to classify pollution based on the given features and obtain the pollutant category as an output. If not credible, the output is rerouted back to the input processing module via feedback. Once validated by the confidence gate, the outputs are further analysed in Module II to estimate capture capacity and remediation efficiency based on physics-based limitations using regression ensembles. The closed-loop feedback architecture connects both modules through the adaptive control loop formalized as Algorithm 1 in Table 2.

Explainable dual-module closed-loop control framework integrating contamination classification, adsorption prediction, interpretability analysis, and adaptive remediation feedback.
Figure 3. Explainable dual-module closed-loop control framework integrating contamination classification, adsorption prediction, interpretability analysis, and adaptive remediation feedback.

TABLE 2. Algorithm for Closed-loop adaptive remediation control.

StepsDescription
InputSensor vector x, ηtarget, Dmax, ΔD, τconf
OutputOptimal dosage D, contact time t, efficiency η ^
1Acquire sensor vector x from WSN at polling interval τ
2Compute P (y = k / x) for all contamination classes k
3If maxk P (y = k / x) < τconf
4Request additional sensing cycle → go to step 1
5Else:
6Set ŷ ← argmaxk P (y = k / x)
7Initialise D ← Dinitial(ŷ) [contamination-class lookup]
8While D ≤ Dmax
9Construct descriptor vector z from {ŷ, D, C0, system params}
10Compute q ^ e ← Module II(z) [adsorption regression]
11Compute η ^ ← (q ^ e × D/C0) × 100
12If η̂ ≥ ηtarget:
13Set D* ← D
14Set t* ← fkinetic (q ^ e, k2) [invert Equation 8 for min time]
15Return D, tη ^
16Else:
17Set D ← D + ΔD
18Return Dmax, t*, η ^ [with convergence warning if ceiling reached]

C 0 is the initial pollutant concentration in mg/L, while η ^ is the predicted removal efficiency in percentage form for step 11. In step 14, the function fkinetic solves for the contact time based on the inversion of Equation 8 so that the minimum contact time is obtained to meet the predicted q ^ e in order to achieve the highest efficiency without unnecessary prolongation of the treatment process. The loop ends at the first dosage that achieves the 95% removal rate, ensuring the resource optimization approach by providing the resource-optimal solution instead of the conservative historical point solution. For the closed-loop operation’s performance evaluation, the baseline scenario is the comparison with the static case in which the dosage and contact time remain unchanged to be the historical average for the entire data pool irrespective of the nature of the contaminants, based on 1,000 simulation runs with random sampling from the entire contamination database. Regression performance is quantified using the coefficient of determination. Regression performance is quantified using Equation 10.where y *i* represents the actual adsorption capacity of sample i, y ^ i refers to the predicted value from the model, y ¯ is the mean of the actual adsorption-capacity values, and n is the number of test samples. Root mean squared error and mean absolute error will be calculated in mg/g units and separately for each of the three pollutant goals. Pairwise tests between the new ensemble method and the four baseline approaches will employ the non-parametric Wilcoxon signed-rank test on ten-fold cross validation and will utilize Bonferroni correction to control for multiple testing. A significance threshold of p < 0.05 is applied uniformly throughout.

R 2 = 1 − ∑ i = 1 n y i − y ^ i 2 ∑ i = 1 n y i − y ¯ 2 (10)

4 Results and discussion

Results are organized to satisfy the key research objectives laid out in the Introduction, such that each measure of performance cited in the abstract is attributable to an independent analysis. Five major categories of results are presented, including the performance of Module I with respect to the categorization of contaminants into one of six contamination classes, the prediction accuracy of Module II regarding Pb(II), diclofenac, and ibuprofen adsorption, the efficiency improvements attained via closed-loop adaptive control compared with a static baseline treatment method, cross-dataset generalization using separate independent test sets, and explainable AI results from both modules.

4.1 Module I: contamination classification performance

From the class-wise discriminatory behavior of Module I, it can be observed that there is a dominant behavior on the main diagonal, thus proving that the classifier is able to accurately classify all the classes related to contamination based on the seven dimensional sensing vector. Combination contamination was fully recognized, which shows that combination contamination patterns generated enough discriminatory power in terms of sensor signatures. Vinegar, washing powder, chlorine, and salt were accurately predicted within the range of 80.0%–90.0% of correct classification, proving that classes with chemical expressiveness can be separated easily. The lowest class-wise recognition is seen for soil (66.7%), since it is partially recognized by vinegar and combination contamination. From a technical point of view, it is justified since the effect of soil on turbidity, and combination contamination in terms of its optical response in sensors may overlap. As it can be seen in Figure 4, off-diagonal entries are not high, which implies the presence of reasonable misclassification.

Normalised six-class confusion matrix for Module I contamination classification on the DS-1 held-out test set. Rows indicate the true contamination classes, namely, soil, chlorine, salt, washing powder, vinegar, and combined contamination, while columns indicate the predicted classes. Diagonal cells represent class-wise correct prediction percentages, and off-diagonal cells show misclassification rates between chemically similar contamination categories. Cell intensity is scaled according to the row-normalised prediction rate, enabling direct comparison of per-class discrimination performance independent of class-frequency variation.
Figure 4. Normalised six-class confusion matrix for Module I contamination classification on the DS-1 held-out test set. Rows indicate the true contamination classes, namely, soil, chlorine, salt, washing powder, vinegar, and combined contamination, while columns indicate the predicted classes. Diagonal cells represent class-wise correct prediction percentages, and off-diagonal cells show misclassification rates between chemically similar contamination categories. Cell intensity is scaled according to the row-normalised prediction rate, enabling direct comparison of per-class discrimination performance independent of class-frequency variation.

The discrimination ability of Module I was evaluated based on the threshold-independent one-vs-rest ROC analysis carried out over all six contamination types at once. For each curve, the relationship between the true positive rate and the false positive rate at different thresholds is presented, thereby presenting a more detailed evaluation compared to accuracy in an unbalanced scenario with regards to the classes used for testing. Both macro and micro averages of the area under the curve provide measurements of the model’s discriminative abilities for all classes without considering their frequencies and including their frequencies, respectively. In turn, the curves representing each class separately in Figure 5 demonstrate that soil contamination (AUC = 0.985), chlorine contamination (AUC = 0.988), and vinegar contamination (AUC = 0.996) were discriminated most effectively, whereas washing powder (AUC = 0.960) and salt (AUC = 0.964) had the lowest but acceptable levels of discrimination.

Multi-class one-vs-rest receiver operating characteristic (ROC) curves for Module I contamination classification on the DS-1 test set. Individual class curves are plotted on a single axis with micro-averaged AUC (0.984) and macro-averaged AUC (0.979) annotated; the diagonal dashed line represents chance-level discrimination.
Figure 5. Multi-class one-vs-rest receiver operating characteristic (ROC) curves for Module I contamination classification on the DS-1 test set. Individual class curves are plotted on a single axis with micro-averaged AUC (0.984) and macro-averaged AUC (0.979) annotated; the diagonal dashed line represents chance-level discrimination.

4.2 Module I: cross-dataset generalization

Module I classification effectiveness was measured in terms of accuracy, precision, recall, F1 score, and one-vs-rest receiver operating characteristic analysis. From Table 3, the developed adaptive ensemble showed reliable multi-class classification in the DS-1 data test set, with an accuracy of 90.96%, a precision of 94.39%, recall of 85.97%, and an F1-score of 87.90%. The validation error reported in Table 3 shows that the classifier showed consistent performance throughout each fold despite overlapping between chemical contaminant classes. Mean values ± standard deviation were given for ten times repeated validations. For calculating 95% confidence intervals, the following equation was used: mean ± t0.975, n−1 × SD/√n, with n equaling to 10. Module II regression accuracy was determined based on comparison of predicted and actual adsorption capacities for three environmental pollutants. The coefficient of determination, root mean squared error, and mean absolute error were calculated for each pollutant using independent test sets, and external DS-6 validation was carried out only for Pb (II) to prevent any bias due to cross-validation of heavy metals based on the training data. Prediction intervals, calculated at 95%, surrounding the identity line give an indication of how widely predictions can deviate from the identity line, and how large the systematic deviation can be. As shown in Figure 6, there was very good correlation between predicted values and the identity line for all three target pollutants, with values of R2 = 0.986, 0.993, and 0.994 for Pb (II), diclofenac, and ibuprofen, respectively. This is also evident in the narrower prediction intervals moving from Pb (II) to ibuprofen due to increasingly consistent kinetics.

TABLE 3. Mean and Standard deviation classification performance of Module I.

ModelAccuracy (%)Precision (%)Recall (%)F1-score (%)
Proposed adaptive ensemble90.96 ± 4.9694.39 ± 3.1985.97 ± 7.7387.90 ± 6.89
Random forest92.01 ± 4.6394.00 ± 4.3187.64 ± 7.2289.05 ± 6.61
SVM89.58 ± 5.4194.82 ± 3.4284.17 ± 8.1886.69 ± 6.97
ANN89.57 ± 5.1893.63 ± 4.0184.17 ± 7.8685.97 ± 7.35
Boosted trees90.97 ± 4.3692.41 ± 4.0285.97 ± 6.7987.30 ± 6.21
Graphical presentation of predicted versus actual adsorption capacity values of Module II. Panel **(A)** depicts the predictions of Pb(′II) adsorption based on the DS-6 external validation dataset, Panel **(B)** shows the predictions of diclofenac adsorption based on the DS-5 test set, and Panel **(C)** shows the predictions of ibuprofen adsorption based on the DS-5 test set.
Figure 6. Graphical presentation of predicted versus actual adsorption capacity values of Module II. Panel (A) depicts the predictions of Pb(′II) adsorption based on the DS-6 external validation dataset, Panel (B) shows the predictions of diclofenac adsorption based on the DS-5 test set, and Panel (C) shows the predictions of ibuprofen adsorption based on the DS-5 test set.

In order to assess the statistical stability, each classification model was tested ten times using ten-fold validation, and the results obtained were presented as means ± standard deviations at a 95% confidence interval. The results prove that the adaptive ensemble used in the study is not dependent on any one good train-test split. Though the Random Forest algorithm performed marginally better than the proposed model in terms of accuracy, the latter is quite comparable in accuracy and stability.

To determine whether there is an improvement in predictive capability, a rigorous comparison against the state-of-the-art regression methods including random forest, support vector regression, artificial neural network, and XGBoost was performed by computing R2, RMSE, and MAE across all pollutants for the proposed algorithm. It is important to assess the three measures at once due to the possibility of masking systematic bias for R2 when there are high concentration readings and the physical significance of error measures in mg/g units that allow direct dosage optimisation decision making. By utilising the grouped bar chart format, it is possible to compare different models on each measure within a single figure as shown in Figure 7 and see how different models perform in terms of trade-offs between R2 and other two metrics. It was found that the proposed model always had R2 exceeding 0.986 with smaller RMSE and MAE compared to all other baselines on all pollutants, demonstrating statistical significance through the application of Bonferroni correction to Wilcoxon signed-rank test.

Regression performance comparison of the proposed ensemble against Random Forest, SVR, ANN, and XGBoost baselines across three pollutant targets: **(A)** R<sup>2</sup>, **(B)** RMSE, and **(C)** MAE. Error bars represent standard deviation across ten-fold validation runs.
Figure 7. Regression performance comparison of the proposed ensemble against Random Forest, SVR, ANN, and XGBoost baselines across three pollutant targets: (A) R2, (B) RMSE, and (C) MAE. Error bars represent standard deviation across ten-fold validation runs.

4.3 Module II: adsorption-capacity prediction

The ability to explain the Module II predictions based on mechanism was investigated through plotting the adsorption capacity predicted by the model, as a function of both contact time and pollutant concentration, against the entire DS-5 range of experimental variables, along with the pseudo-second-order kinetics surface as overlay for mechanistic comparison. This plot serves to confirm whether or not the machine-learning model has captured the saturation properties associated with chemisorption-type adsorption processes, instead of simply interpolating within the training distribution. As evident in Figures 8 below, predicted response surfaces for both Pb (II), diclofenac, and ibuprofen exhibit monotonic saturation with respect to contact time, while the plateau property due to saturation is observed at higher concentrations, consistent with the Langmuir theory isotherm equation. The high level of correspondence between the machine learning surface and the pseudo-second order kinetic overlay for all three pollutants in Figure 8 is indicative of successful embedding of physics-based constraints in the predictions.

Three-dimensional surface plots of Module II predicted adsorption capacity as a joint function of contact time and initial pollutant concentration for **(A)** Pb (II), **(B)** diclofenac, and **(C)** ibuprofen, generated from the DS-5 experimental variable ranges. The pseudo-second-order kinetic model surface is overlaid on each panel for mechanistic validation of predicted adsorption kinetics.
Figure 8. Three-dimensional surface plots of Module II predicted adsorption capacity as a joint function of contact time and initial pollutant concentration for (A) Pb (II), (B) diclofenac, and (C) ibuprofen, generated from the DS-5 experimental variable ranges. The pseudo-second-order kinetic model surface is overlaid on each panel for mechanistic validation of predicted adsorption kinetics.

Implementation of physics-informed information involved the application of the post-prediction feasibility rule. Predicted values had to be non-negative and within the feasible range for the particular pollutant and nanomaterial pair. Feasibility regarding contact time involved the use of the second-order kinetic formula where kinetics could be described by the adsorption-controlled removal process. The assumptions made here are best applicable to batch adsorption processes and do not apply universally for all possible combinations of pollutants and nanoparticles until experimental validation.

Adaptive closed-loop process efficiency was analyzed in terms of resource expenditure accumulation for 1,000 sequential simulated contamination instances from the entire database of contaminations by comparing adaptive closed-loop decision for each instance with the historical average dose and time parameters applied by the static baseline. In addition, the use of the nonlinear path form will help to find out whether savings increase progressively or exponentially. Inspection of Figure 9 shows that the efficiency gap between the closed-loop and static strategies widened progressively, with cumulative dosage savings reaching 14.7% and contact-time savings reaching 22.3% by event 1,000. The steeper gap growth during periods of high contamination variability confirms that adaptive decision-making delivers the greatest marginal benefit precisely when the static historical-average baseline is most prone to under-dosing or over-dosing the adsorbent.

Closed-loop resource savings analysis for the adaptive remediation technique relative to the historical average static method, simulated for 1,000 pollution incidents. Panel **(A)** represents cumulative adsorbent dose usage and savings, and Panel **(B)** represents cumulative contact time usage and savings. The marked differences represent the cumulative efficiency gained using the adaptive closed-loop method for the designated event numbers.
Figure 9. Closed-loop resource savings analysis for the adaptive remediation technique relative to the historical average static method, simulated for 1,000 pollution incidents. Panel (A) represents cumulative adsorbent dose usage and savings, and Panel (B) represents cumulative contact time usage and savings. The marked differences represent the cumulative efficiency gained using the adaptive closed-loop method for the designated event numbers.

Geographic and distributional generalisability of Module I was assessed by evaluating the trained classifier on three independent external datasets like DS-4 from Indian river and lake monitoring sites, DS-2 from the UCI repository, and DS-3 from the Kaggle potability benchmark each representing a distinct water-quality domain not encountered during training. Retention metrics, expressed as percentages of DS-1 reference-level accuracy and F1-score, provide direct quantification of domain transfer loss attributable to distributional shift between training and deployment environments. Accuracy retention was calculated as: Accuracy retention (%) = External dataset accuracy/DS-1 reference accuracy × 100.

As illustrated in Figure 10, the classifier maintained 96.0% accuracy retention on DS-4, confirming near-complete generalisability to geographically distinct Indian water-body field conditions, while retention dropped to 61.0% on DS-2 and DS-3 datasets. This reduced retention on non-sensing-specific datasets is expected given structural differences in feature composition and labelling conventions relative to DS-1, and does not compromise operational validity for the intended WSN-based real-time deployment context.

Cross-dataset generalisation performance of Module I, showing accuracy retention and F1-score retention relative to the DS-1 reference level across DS-1, DS-4, DS-2, and DS-3. Error bars represent standard deviation across repeated validation runs.
Figure 10. Cross-dataset generalisation performance of Module I, showing accuracy retention and F1-score retention relative to the DS-1 reference level across DS-1, DS-4, DS-2, and DS-3. Error bars represent standard deviation across repeated validation runs.

The Feature Attribution analysis performed on Module I involved the use of TreeSHAP to determine the SHAP value assigned to every sensing feature based on its additive effect to the probability of predicting an unsafe class per every test sample of DS-1. Such an approach meets all four axioms of Shapley values, including efficiency, symmetry, dummy, and linearity. As a result, importance scores can be theoretically proven as opposed to mere heuristics. The horizontal shift of each dot from zero is indicative of the magnitude of the contribution made, while color represents the feature value itself, showing whether high or low values make sensors detect contamination. The Beeswarm plot in Figure 11 proves that the conductivity (Mean|SHAP| = 0.1487) attribute was dominant in terms of classification tasks. The second most important attribute was the combination of sensors index (Mean|SHAP| = 0.1134). These results confirm the theoretical importance of conductivity as the main proxy for ionic content in water contamination.

SHAP beeswarm summary plot for Module I (contamination classification), ranking all seven sensing features by mean absolute SHAP value computed over the DS-1 test set. Each point represents one test instance; point colour encodes feature value magnitude from low (blue) to high (red); horizontal position indicates the direction and magnitude of contribution to unsafe-class probability.
Figure 11. SHAP beeswarm summary plot for Module I (contamination classification), ranking all seven sensing features by mean absolute SHAP value computed over the DS-1 test set. Each point represents one test instance; point colour encodes feature value magnitude from low (blue) to high (red); horizontal position indicates the direction and magnitude of contribution to unsafe-class probability.

The SHAP distribution without leakage in adsorption prediction by Module II reveals that material chemistry and adsorption behavior depending on concentration are the main factors determining adsorption prediction. The highest mean attributions belong to nitrogen amount, which implies that nitrogen-containing functional groups have a significant effect on adsorption predictions, most likely due to the processes of complex formation, electrostatic interactions, and surface binding. In addition, the N/C ratio and particle size play an important role, meaning that chemical composition and the possibility for adsorption reactions taking place in adsorption sites are two main factors impacting predictions. Surface area, final concentration, and initial concentration are some of the strongest predictors, implying that adsorption capacity is regulated both by the presence of active surfaces and adsorbate concentration. As can be seen from Figure 12, a large horizontal dispersion of the SHAP values for the strongest predictors suggests high heterogeneity and nonlinear relationships among the DS-5 and DS-6 samples. The weaker impact factors like solution pH, adsorption temperature, and nanomaterial dosage demonstrate lower SHAP dispersion. Figure 13 is organized to compare the feature level models’ performance in both AI modules. Figures 13A–C belong to Module I descriptors that sense features as follows: Figure 13A conductivity, which is indicative of the ionic pollution response; Figure 13B turbidity, which is indicative of the particulate pollution response; and Figure 13C pH, which is indicative of the acid-base imbalance in the water sample. Figures 13D–F belong to Module II descriptors that adsorb features as follows: Figure 13D contact time, which is indicative of the adsorption process behavior; Figure 13E nanomaterial dose, which is indicative of the adsorbent dose available; and Figure 13F pollutant dose, which is indicative of the contaminant dose available.

SHAP beeswarm summary plot for Module II adsorption regression after target-leakage removal. The plot ranks all 24 adsorption descriptors by mean absolute SHAP value across DS-5 held-out and DS-6 external explanation samples, using a fast interventional SHAP approximation with target-equivalent variables such as adsorption capacity, capacity, qe, qmax, uptake, and removal capacity excluded from the input feature set.
Figure 12. SHAP beeswarm summary plot for Module II adsorption regression after target-leakage removal. The plot ranks all 24 adsorption descriptors by mean absolute SHAP value across DS-5 held-out and DS-6 external explanation samples, using a fast interventional SHAP approximation with target-equivalent variables such as adsorption capacity, capacity, qe, qmax, uptake, and removal capacity excluded from the input feature set.
SHAP dependence plot for sensing & adsorption features. Panel **(A–C)** presents Module I sensing features where **(A)** conductance shows response to the presence of ions; **(B)** turbidity shows response to suspended/particulate contamination; and **(C)** pH shows response to acidity/alkalinity of the water sample. On the other hand, Panel **(D–F)** presents Module II adsorption descriptors where **(D)** contact time represents the progress of adsorption process; **(E)** nanomaterial dosage shows availability of the adsorbent; and **(F)** pollutant concentration represents contaminant concentration.
Figure 13. SHAP dependence plot for sensing & adsorption features. Panel (A–C) presents Module I sensing features where (A) conductance shows response to the presence of ions; (B) turbidity shows response to suspended/particulate contamination; and (C) pH shows response to acidity/alkalinity of the water sample. On the other hand, Panel (D–F) presents Module II adsorption descriptors where (D) contact time represents the progress of adsorption process; (E) nanomaterial dosage shows availability of the adsorbent; and (F) pollutant concentration represents contaminant concentration.

SHAP dependence plots provide more information than the global beeswarm importance ranking because they show not only how each feature value affects the model prediction but also how the effect depends on interactions through the color coded according to SHAP interaction value calculations. This visualization can indicate nonlinearities, threshold effects, and even suppressions that can never be understood from the absolute SHAP values. As for the sensing properties (Module I features), shown in Figures 13A–C, the feature values of conductivity and turbidity had a monotonically increasing SHAP effect while the pH was associated with non-monotonic dependence corresponding to the U-shape effect caused by acid and base pollutants discharged from the industrial processes. As for the adsorption features (Module II features), shown in Figures 13D–F, there was a sharp increase in SHAP for contact time followed by the saturation after 500 min of reaction, whereas the initial concentration SHAP effect was clearly increased by particle size.

4.4 Statistical stability and confidence intervals

The results generated by the proposed closed loop AI-enabled nanomaterial sensor-separator system reveal that integrating contamination detection, adsorption estimation, and remediation within a feedback-based framework provides significant and repeatable benefits compared to the separate use of machine learning and non-adaptive control systems. Module I attained an average classification accuracy of 90.96% and precision of 94.39%, with a macro-AUC score of 0.979 for the six categories of contamination. Such performance is quite reasonable despite the superior accuracy score of 92.007% by the random forest algorithm. The strength of the proposed stacking model does not only depend on accuracy but also on robustness to distributional shifts demonstrated by the maintenance of accuracy retention at 96.0% when the test is performed on the DS-4 HydroShare dataset, which is geographically independent. Moreover, the proposed system ensures that ambiguous ion signatures do not cause false positive actuations through the use of the confidence threshold.

Module II’s regression performance like R2 of 0.986, 0.993, and 0.994 for Pb (II), diclofenac, and ibuprofen respectively confirms that physics-informed ensemble regression substantially outperforms standalone learners. As shown in Table 4, the proposed model consistently achieves superior R2 with lower RMSE and MAE across all three pollutants compared to Random Forest, SVR, ANN, and XGBoost. The tighter prediction intervals for pharmaceutical organics relative to Pb (II) reflect the greater kinetic regularity of chemisorption in organic systems, which is physically consistent with the SHAP dependence analysis confirming contact time and initial concentration as important controllable operational drivers. The closed-loop adaptive control strategy produced cumulative adsorbent dosage savings of 14.7% and contact-time savings of 22.3% over 1,000 simulated contamination events compared to the static historical-average baseline. These savings compounded progressively during high-variability contamination sequences, confirming that the marginal benefit of adaptive control is largest precisely when static baselines fail most severely a practically important property for real-world treatment plants managing dynamic multi-pollutant influent. SHAP analysis further corroborated all model decisions against established physicochemical theory, with conductivity dominating classification and nitrogen content alongside initial concentration governing adsorption capacity prediction, supporting both scientific interpretability and regulatory transparency of the platform.

TABLE 4. Comparative regression performance of the proposed ensemble against baseline models across three pollutant targets on DS-5 training and DS-6 external validation sets.

ModelPb(II) R2Pb(II) RMSE (mg/g)Pb(II) MAE (mg/g)Diclofenac R2Diclofenac RMSE (mg/g)Diclofenac MAE (mg/g)Ibuprofen R2Ibuprofen RMSE (mg/g)Ibuprofen MAE (mg/g)
Proposed0.9864.230.960.9933.251.360.9942.151.02
Random forest0.9716.871.840.9785.612.090.9814.321.78
SVR0.9548.742.310.9637.182.670.9685.892.14
ANN0.9617.932.070.9716.442.380.9755.121.93
XGBoost0.9795.611.520.9854.731.810.9883.741.47

Best values are in bold. RMSE, root mean squared error; MAE, mean absolute error; SVR, support vector regression; ANN, artificial neural network.

The statistically significant results shown in Table 4 using Bonferroni-corrected Wilcoxon signed-rank tests (p < 0.05) prove the fact that the use of the physics-guided constraint layer and voting weight scheme result in true advancements in predictive power and not just negligible improvements due to noise. Overall, the above observations place the suggested platform as a feasible solution to water treatment utilizing AI. The Table 5 summarizes the six datasets used for classification, benchmarking, geographic validation, adsorption prediction, and external Pb(II) validation, improving transparency on sample size, feature use, and preprocessing. The ablation results in Table 6 show that physics constraints mainly improve adsorption-prediction accuracy, while closed-loop control contributes directly to dosage and contact-time savings.

TABLE 5. Summary of datasets used for contamination classification, external validation, and adsorption-capacity prediction.

DatasetSourceSamplesFeatures usedTarget/LabelModule rolePreprocessing
DS-1WSN drinking-water contamination260pH, turbidity, flow rate, conductivity, sensor-derived risk/response featuresContamination classModule I training/testingCleaning, KNN imputation, min-max scaling, SMOTE
DS-2UCI water quality705Multi-parameter physicochemical featuresPotability/water qualityExternal benchmarkingFeature alignment, scaling
DS-3Kaggle water potability3,27610 physicochemical featuresPotabilityExternal benchmarkingFeature alignment, scaling
DS-4HydroShare indian water bodies1,360Water-quality parametersExternal water statusModule I geographic validationFeature alignment, scaling
DS-5Adsorption-capacity dataset3,75724 adsorption descriptorsAdsorption capacityModule II training/testingZ-score scaling, outlier screening
DS-6Pb(II) heavy-metal adsorption1,519Adsorption descriptorsPb(II) adsorption capacityModule II external validationZ-score scaling

Bold values in the Samples column indicate the total number of records/samples available in each dataset used in this study.

TABLE 6. Ablation analysis of the proposed closed-loop AI-integrated sensor-separation framework.

ConfigurationPhysics constraintClosed-loop controlXAI layerAccuracy (%)/Mean R2Mean RMSE/MAE (mg/g)Dosage saving (%)Contact-time saving (%)
Standalone ML baselineNoNoNo90.97/0.9844.69/1.600.00.0
Ensemble onlyNoNoNo90.96/0.9874.02/1.380.00.0
Ensemble + physics constraintYesNoNo90.96/0.9913.21/1.110.00.0
Ensemble + closed-loop controlNoYesNo90.96/0.9874.02/1.3812.819.6
Full proposed frameworkYesYesYes90.96/0.9913.21/1.1114.722.3

Mean R2, RMSE, and MAE represent the average regression performance across Pb(II), diclofenac, and ibuprofen. Dosage and contact-time savings were calculated against the static historical-average treatment baseline.

4.5 Limitations and future work

Despite the fact that the proposed system shows good results in terms of classification, prediction of adsorption characteristics, and simulation-based closed loop control, two aspects must be mentioned here. In the first place, the closed loop approach to remediation was tested in a simulated environment instead of an instrumented water treatment plant or at least a pilot-scale setup. As a result, further research must focus on testing the framework’s capability to work under real effluent flow regimes, employing sensor modules for detection, automated dosing of nanomaterials, controlling contact times, and monitoring treated water quality. Moreover, while adsorption prediction relied on publicly accessible data, such models were created based on batch data instead of continuous flow hydrodynamics and other important factors. Thus, it is crucial to provide more external validation and use standardized experimental datasets. Finally, apart from Pb(II), diclofenac, and ibuprofen, the model must test more pollutants including but not limited to PFAS, microplastics, dyes, and antibiotics.

5 Conclusion

The present work proposed a closed-loop artificial intelligence-powered smart nanomaterial-based sensor-separation platform that combines contamination monitoring, physics-aware adsorption prediction, and adaptive remediation management all in one. The stacked ensemble model had an accuracy of 90.96%, precision score of 94.39%, recall score of 85.97%, and F1-score of 87.90%, while also having a macro-average area under the curve of 0.979 with geographically comprehensive validation using independent data from Indian water bodies. As for the weighted ensemble regression model, R2 scores of 0.986, 0.993, and 0.994 were obtained for Pb (II), diclofenac, and ibuprofen respectively, which were superior to all four baseline learners. In terms of results, the adaptive closed-loop approach has enabled reduction in adsorbent dose and contact time by 14.7% and 22.3%, respectively, compared to the static historical average approach using the 1,000 simulation runs performed. The SHAP explainability analysis further attributions are consistent with known physicochemical trends and therefore meet the necessary criteria for regulatory deployment. However, there are some issues associated with this work that need to be noted as well. First, the closed-loop performance analysis of this study is purely based on simulations and needs to be validated using hardware-in-the-loop under real effluent conditions before any application in the field. Furthermore, the regression sub-models are trained using batch experimental conditions, and thus require further research concerning continuous flow reactor systems. Other possible directions include online learning, energy consumption analysis in the control layer, and application on emerging pollutants like microplastics and PFAS that are not included in the current dataset.

Generative AI statement

The author(s) declared that generative AI was not used in the creation of this manuscript.

Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.

Publisher’s note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.

Footnotes

Edited by: Hadi Shayesteh, University of Ottawa, Canada

Reviewed by: Kosar Hikmat Hama Aziz, University of Sulaymaniyah, Iraq

Farshad Raji, Sharif University of Technology, Iran

Vishal Suryavanshi, DY Patil Technical Campus Faculty of Engineering and Faculty of Management, India

Statements

Conflict of interest

The author(s) declared that this work was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Funding

The author(s) declared that financial support was received for this work and/or its publication. The authors declare that no specific grant was received from any funding agency in the public, commercial, or not-for-profit sectors for the research, authorship, and/or preparation of this article. The article processing charge was supported through a publication waiver provided by Frontiers.

Data availability

Publicly available datasets were analyzed in this study. This data can be found here: Sithole, M. P. P., Nwulu, N., and Dogo, E. (2019). Wireless Sensor Network Based Drinking-Water Quality Monitoring and Notification System Dataset. Mendeley Data, V1. Doi: 10.17632/pbb76sbbrg.1. UCI Machine Learning Repository. (2022). Water Quality Prediction. University of California, Irvine. Available at: https://archive.ics.uci.edu/dataset/733/water%2Bquality%2Bprediction-1. Kadiwal, A. (2021). Water Quality. Kaggle. Available at: https://www.kaggle.com/datasets/adityakadiwal/water-potability. HydroShare. (2022). Water Quality Dataset for water quality prediction tool. HydroShare. Available at: https://www.hydroshare.org/resource/4ab43e1b507b496b9b42749701daed5c/. HydroShare. (2022). Water Quality Dataset for water quality prediction tool. HydroShare. Available at: https://www.hydroshare.org/resource/4ab43e1b507b496b9b42749701daed5c/. Haider Jaffari, Z. (2023a). Adsorption-capacity-prediction-for-ECs. GitHub. Available at: https://github.com/ZeeshanHJ/Adsorption-capacity-prediction-for-ECs. Haider Jaffari, Z. (2023b). Transformer_models_prediction: Transformer models for adsorption capacity prediction of biochar materials toward heavy metal ions. GitHub. Available at: https://github.com/ZeeshanHJ/Transformer_models_prediction.

Author contributions

RA: Conceptualization, Data curation, Investigation, Methodology, Software, Supervision, Writing – original draft, Writing – review and editing. UN: Formal Analysis, Funding acquisition, Project administration, Resources, Validation, Visualization, Writing – original draft, Writing – review and editing.

Acknowledgements

The authors acknowledge the providers of the publicly available water-quality, potability, HydroShare, adsorption-capacity, and heavy-metal adsorption datasets used in this study. The authors also acknowledge the open-source scientific computing and machine-learning communities whose tools supported data pre-processing, model evaluation, visualization, and explainable AI analysis.

References

  1. Abdullah Al Mamun Hridoy Md., Ibna Shawkat A., Bordin C., Acharjee M. R., Masood A., Baki A. O. (2025). Advanced machine learning models for accurate water quality classification and WQI prediction: implications for aquatic disease risk management. Sci. Total Environ. 1008, 180965. doi:10.1016/j.scitotenv.2025.180965
  2. Aziz K. H. H., Kareem R. (2023). Recent advances in water remediation from toxic heavy metals using biochar as a green and efficient adsorbent: a review. Case Stud. Chem. Environ. Eng. 8, 100495. doi:10.1016/j.cscee.2023.100495
  3. Haider Jaffari Z., Jeong H., Shin J., Kwak J., Son C., Lee Y.-G. (2023). Machine-learning-based prediction and optimization of emerging contaminants' adsorption capacity on biochar materials. Chem. Eng. J. 466, 1385 – 8947. doi:10.1016/j.cej.2023.143073
  4. Laishram D., Kim S.-B., Lee S.-Y., Soo-Jin P. (2025). Advancements in biochar as a sustainable adsorbent for water pollution mitigation. Adv. Sci. 12, 2410383. doi:10.1002/advs.202410383
  5. Liu B., Xi F., Zhang H., Peng J., Sun L., Zhu X. (2024). Coupling machine learning and theoretical models to compare key properties of biochar in adsorption kinetics rate and maximum adsorption capacity for emerging contaminants. Bioresour. Technology 402, 130776. doi:10.1016/j.biortech.2024.130776
  6. Makumbura R. K., Mampitiya L., Rathnayake N., Meddage D. P. P., Henna S., Dang T. L. (2024). Advancing water quality assessment and prediction using machine learning models, coupled with explainable artificial intelligence (XAI) techniques like shapley additive explanations (SHAP) for interpreting the black-box nature. Results Eng. 23, 102831. doi:10.1016/j.rineng.2024.102831
  7. Nagpal M., Siddique M. A., Sharma K., Sharma N., Mittal A. (2024). Optimizing wastewater treatment through artificial intelligence: recent advances and future prospects. Water science technology A Journal Int. Assoc. Water Pollut. Res. 90 (3), 731 – 757. doi:10.2166/wst.2024.259
  8. Nasir F. B., Li J. (2024). Understanding machine learning predictions of wastewater treatment plant sludge with explainable artificial intelligence. Water Environment Research A Research Publication Water Environ. Fed. 96 (10), e11136. doi:10.1002/wer.11136
  9. Noori R. N., Hamamin D. F., Hama Aziz K. H. (2025). Green synthesis of magnetic biochar from iron-containing sludge and spent coffee grounds for the removal of lead ions from groundwater. J. Dispersion Sci. Technol., 1 – 13. doi:10.1080/01932691.2025.2576873
  10. Ramya S., Srinath S., Pushpa T. (2024). Comprehensive analysis of multiple classifiers for enhanced river water quality monitoring with explainable AI. Case Stud. Chem. Environ. Eng. 10, 100822. doi:10.1016/j.cscee.2024.100822
  11. Sardar M., Omer K. M., Mohammad Ameen S. S., Hama Aziz K. H. (2026). Fluorescence-based detection of antibiotics in aquatic environments using carbon nanodots: a review. RSC Sustain. 4, 1230 – 1251. doi:10.1039/D5SU00816F
  12. Singh Y., Walingo T. (2024). Smart water quality monitoring with IoT wireless sensor networks. Sensors 24, 2871. doi:10.3390/s24092871
  13. Sivaranjanee R., Senthil Kumar P., Chitra B., Rangasamy G. (2024). A critical review on biochar for the removal of toxic pollutants from water environment. Chemosphere 360, 142382. doi:10.1016/j.chemosphere.2024.142382
  14. Yiting L., Hongpeng Z., Peng Z., Yin W., Yiming H., Xinran W. (2026). AI for smart wastewater treatment plants: a review of physics-informed water quality modeling, optimization, and advanced control. J. Environmental Management 401, 128949. doi:10.1016/j.jenvman.2026.128949

Citation

Abdullah, R. Y. & Nisha, U. B. (2026). Closed-loop AI-integrated smart nanomaterial sensor-separation platform for real-time detection and adaptive capture of emerging pollutants in water systems. Frontiers in Environmental Chemistry, Volume 7. https://doi.org/
Received
Accepted
Published
Volume
7 - 2026

Copyright

Copyright © 2026 Yasir Abdullah and Barakkath Nisha.

License: https://creativecommons.org/licenses/by/4.0/

*Correspondence: R Yasir Abdullah

Article metrics

Views
0
Downloads
0
Citations
0
Shares
0