Evaluation of Deep Learning Model Performance for Water Quality Classification: Comparison of CNN, LSTM, and Hybrid CNN-LSTM | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Evaluation of Deep Learning Model Performance for Water Quality Classification: Comparison of CNN, LSTM, and Hybrid CNN-LSTM Yeza Febriani, Muhammad Lutfi Mahasinul Akhlak, Mohammad Apriniyadi, and 1 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-7444182/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Water quality monitoring is crucial for protecting public health and ensuring environmental sustainability. This study uses a high-frequency time-series dataset from Brisbane, Australia, to classify water quality as either 'Suitable' or 'Unsuitable' using three deep learning models: CNN, LSTM, and a hybrid CNN-LSTM. To counter the dataset's significant class imbalance, a class weighting strategy was used during training. The models were evaluated using metrics like accuracy, precision, recall, and F1-score. The hybrid CNN-LSTM model outperformed the others, achieving superior and more balanced results with an accuracy of 97.1%, a precision of 97.1%, a recall of 97.0%, and an F1-score of 97.0%. These results demonstrate the hybrid model's enhanced ability to handle complex temporal data and extract relevant features, making it a promising solution for robust, real-time water quality warning systems for water quality management. Water Quality Classification Deep Learning Hybrid CNN-LSTM Time-Series Data Classification Modelling Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Introduction Water quality monitoring and prediction are crucial aspects of sustainable water resource management, an urgency amplified by the global challenge of escalating water pollution. The complex dynamics of water pollution, which originates from diverse sources such as industrial, agricultural, and domestic waste, demand a system that is not only reactive but also proactive in detecting changes in water quality at an early stage. In this context, integrated real-time monitoring technology has emerged as a fundamental solution. These modern systems integrate advanced sensors, Internet of Things (IoT) architecture, and data analytics platforms to continuously collect, transmit, and process water quality data. This integration enables the instantaneous detection of pollution and facilitates more rapid and informed decision-making ( 1 – 3 ). However, the historical data generated by these monitoring systems only provide a retrospective view of current or past conditions. Therefore, the ability to predict future water quality represents the next essential evolutionary step. In line with rapid advancements in computer science, predictive models based on machine learning have demonstrated remarkable effectiveness in enhancing the accuracy, efficiency, and reliability of water quality management ( 4 ). These models are capable of identifying latent patterns and complex interrelationships within intricate water quality datasets, surpassing the capabilities of traditional statistical analysis. The application of such predictive systems has significant implications for risk mitigation, strategic planning, and the implementation of preventive measures aimed at protecting water resources for various uses, including drinking water, irrigation, and the preservation of aquatic ecosystems ( 5 , 6 ). A variety of AI algorithms have been widely applied to water quality prediction, from classic methods such as Random Forest and Support Vector Machine (SVM), known for their accuracy and robustness, to more advanced deep learning models. Specifically, deep learning models like the Convolutional Neural Network (CNN) and Long Short-Term Memory (LSTM) have garnered considerable attention for their capacity to process complex time-series data ( 7 ). The CNN, originally developed for image processing tasks, has proven highly effective in extracting salient spatial and temporal features from time-series data by treating it as a one-dimensional sequence ( 8 , 9 ). As a type of recurrent neural network (RNN), LSTM features an architecture specifically designed to overcome the vanishing gradient problem that impedes the ability of traditional RNNs to process long data sequences. The LSTM architecture is equipped with gates that allow the model to selectively retain or discard information from previous time steps. This unique capability enables LSTM to effectively capture long-term temporal dependencies, making it an ideal architecture for modelling the dynamics of water quality changes over time ( 10 – 12 ). The hybrid CNN-LSTM model, which combines both architectures, has been shown to yield superior results. This hybrid model leverages the strengths of CNN in extracting relevant features and the advantages of LSTM in modelling temporal patterns, resulting in more stable and accurate predictions ( 8 , 9 , 12 ). The integration of these approaches not only enhances prediction accuracy for key parameters such as Dissolved Oxygen (DO) and pH but also enables more reliable predictions for the overall water quality index (WQI). Nevertheless, the application of these models is not without its challenges. Primary obstacles include the integration of heterogeneous data from various sources, the handling of noise and outliers frequently present in environmental data, and the need for sufficient, high-quality historical data for effective model training ( 4 , 11 , 13 ). However, the potential benefits far outweigh these challenges. An accurate predictive system can serve as a strategic tool for water resource planning, enabling relevant authorities to take preventive action before severe environmental damage or public health risks occur ( 1 , 7 ). By identifying future trends and anomalies, these systems directly support the achievement of the Sustainable Development Goals, namely, ensuring the availability and sustainable management of clean water and sanitation for all. This research, with its focus on comparing deep learning models (CNN, LSTM, and the hybrid CNN-LSTM), aims to make a substantial contribution to the existing literature by identifying the optimal model architecture for water quality prediction. This, in turn, paves the way for the implementation of more intelligent and adaptive water management systems in the future. Such a comparison is essential to guide researchers and practitioners in selecting the most efficient methods, ensuring that technological investments yield the maximum impact in the protection of global water resources. While standalone CNN and LSTM models have been successfully applied in various time-series forecasting domains, their application to high-frequency water quality data presents unique challenges. Water quality parameters often exhibit both short-term, abrupt fluctuations (local patterns) and long-term, seasonal trends (temporal dependencies). A CNN excels at extracting salient local features, such as sudden spikes in turbidity, but may fail to capture long-range temporal context. Conversely, an LSTM is adept at modelling long-term dependencies but may overlook fine-grained local patterns. Although some studies have explored hybrid models, a systematic comparison of CNN, LSTM, and their hybrid architecture specifically for imbalanced, high-frequency water quality time-series classification remains underexplored. Previous research has often focused on lower-frequency data or has not explicitly addressed the challenge of detecting minority 'Unsuitable' classes, which is critical for creating reliable early-warning systems. This study aims to fill this gap by conducting a comprehensive performance evaluation of these three deep learning models. We hypothesize that a hybrid CNN-LSTM architecture, by synergistically combining the feature extraction power of CNNs with the sequence modelling strength of LSTMs, will provide a more robust and balanced classification performance, particularly in accurately identifying the critical 'Unsuitable' water quality events. Literature Review The evolution of predictive methodologies has undergone a significant transformation, advancing from traditional statistical models to modern deep learning approaches. Conventional statistical models, such as linear regression, ARIMA, and discriminant analysis, have long served as the foundation for data analysis due to their efficiency and ease of interpretation. Nevertheless, they possess significant limitations, particularly in handling non-linear relationships and generating accurate long-term predictions ( 14 – 16 ). These constraints spurred the advent of the machine learning era, which introduced a suite of more sophisticated algorithms, including Support Vector Machine (SVM), Random Forest, and various ensemble methods. These machine learning techniques substantially improved predictive accuracy through their ability to capture non-linear patterns and complex interactions among variables dynamics often overlooked by traditional statistical models ( 14 , 15 , 17 , 18 ). Although machine learning represented a major advancement, these models often still require time-consuming and expertise-driven manual feature engineering, a gap that paved the way for further innovation. The subsequent evolution led to deep learning (DL), which represents a paradigm shift by utilizing multi-layered neural network architectures to automatically extract features from raw data. The primary advantage of DL lies in its capacity to learn hierarchical and complex data representations without human intervention, making it highly effective for large-volume, high-dimensional datasets ( 17 , 19 ). Among the various deep learning architectures, two models are particularly prominent for their relevance to time-series data analysis, such as water quality data: the Convolutional Neural Network (CNN) and Long Short-Term Memory (LSTM). CNNs, traditionally employed in image processing, have been adapted to analyse time-series data by treating it as a one-dimensional sequence. This model excels at efficiently extracting local patterns and spatial features, which is highly useful for identifying recurring patterns or anomalies in sensor data ( 17 , 19 – 21 ). Another advantage of CNNs is their use of parameter sharing, which not only reduces the number of trainable parameters but also mitigates the risk of overfitting, especially on smaller datasets ( 17 , 19 ). On the other hand, LSTM, a more advanced variant of the Recurrent Neural Network (RNN), was specifically designed to address the vanishing gradient problem that hampers the ability of traditional RNNs to process long data sequences. The LSTM architecture is equipped with gates that enable the model to selectively store or forget information from previous time steps. This unique capability allows LSTM to effectively capture long-term temporal dependencies, making it an ideal architecture for sequence-based predictions such as stock prices, environmental sensor data, and water quality parameters ( 20 – 22 ). Numerous empirical studies consistently demonstrate that deep learning models, and their combinations, often outperform traditional statistical and machine learning models, particularly in long-term forecasting and for complex datasets ( 14 , 16 – 18 , 20 , 23 , 24 ). Although deep learning models have drawbacks, including high computational requirements and limited interpretability, their flexibility and power in automatic feature extraction make them a leading choice for complex prediction tasks. Conversely, for cases with limited data or where model interpretability is a critical priority, simpler statistical or machine learning models may still be the more relevant choice ( 15 , 25 ). The central hypothesis of this research is that a hybrid CNN-LSTM architecture will yield superior and more balanced classification performance compared to standalone CNN or LSTM models for water quality prediction. This hypothesis is grounded in the complementary theoretical strengths of each architecture when applied to the specific characteristics of water quality time-series data. This data is characterized by two distinct phenomena: ( 1 ) short-term, transient events, such as sudden pollutant discharges, which manifest as local patterns or anomalies in the data stream, and ( 2 ) long-term, evolving trends, such as seasonal variations in temperature or pH. The CNN component is theoretically optimized to act as a hierarchical feature extractor, identifying these critical local patterns through its convolutional filters without requiring manual feature engineering. However, it lacks an intrinsic mechanism for retaining information over long sequences. The LSTM component, with its memory cell and gating mechanisms (input, output, and forget gates), is explicitly designed to capture long-range temporal dependencies and mitigate the vanishing gradient problem. By integrating these two architectures, the proposed hybrid model can first leverage the CNN layers to automatically extract robust, high-level features from raw sensor inputs. These feature maps, which represent localized patterns, are then passed to the LSTM layers. The LSTM can then model the temporal relationships between these extracted features over time. This synergistic approach allows the model to simultaneously understand both the immediate state and the long-term context of the water quality, leading to a more nuanced and accurate classification, especially for the underrepresented 'Unsuitable' class. Methodology This research methodology is systematically designed to predict water quality using a deep learning approach, as illustrated in Fig. 1 . The framework includes several main stages, starting from the dataset description, data pre-processing, model architecture design, to model performance evaluation. Dataset The dataset used in this study was collected from an automatic real-time water quality monitoring station located on the Brisbane River, Australia. The data comprises hourly measurements recorded continuously from January 1, 2022, to December 31, 2023. The dataset includes key physical-chemical parameters such as Temperature (°C), pH, Turbidity (NTU), Dissolved Oxygen (mg/L), and Conductivity (µS/cm). The target variable, 'Water Quality Class', was labelled based on local regulatory standards, resulting in two categories: 'Suitable' and 'Unsuitable'. The data is publicly available and can be accessed at: https://www.kaggle.com/code/briannuevo/water-quality-analysis-and-time-series . Data Pre-processing A multi-step pre-processing pipeline was implemented to ensure data quality and prepare it for model training: Handling Missing Values: Missing data points, which constituted less than 2% of the dataset, were handled using linear interpolation to maintain the temporal continuity of the time-series data. Outlier Detection and Treatment: The Interquartile Range (IQR) method was applied to each feature to identify outliers. Values falling outside 1.5 times the IQR above the third quartile or below the first quartile were capped at the respective boundary value to mitigate their skewing effect. Data Normalization: Min-Max scaling was employed to scale all numerical features to a uniform range of [0, 1]. This step is crucial for deep learning models to ensure that all features contribute equally to the model's learning process and to accelerate convergence. Data Splitting: The pre-processed dataset was chronologically split into three subsets: 70% for training, 15% for validation, and 15% for testing. A chronological split prevents data leakage and ensures that the model is evaluated on its ability to predict future, unseen data. Given the significant imbalance between the 'Suitable' and 'Unsuitable' classes identified during the Exploratory Data Analysis, a class weighting strategy was implemented during the model training phase. This technique works by assigning a higher penalty weight to misclassifications of the minority class ('Unsuitable'). By adjusting the loss function, the model is compelled to pay closer attention to samples from the underrepresented class, thereby preventing a bias towards the majority class and improving the model's ability to effectively detect water quality anomalies. Model Architecture To ensure transparency and reproducibility, the specific architecture of each evaluated model is detailed below. All models were compiled using the Adam optimizer with a learning rate of 0.001 and the categorical cross-entropy loss function. They were trained for 50 epochs with a batch size of 64, and a dropout layer (rate = 0.5) was included to prevent overfitting. Convolutional Neural Network (CNN) Model: The CNN architecture was designed to extract relevant features from sequential data. It consists of one 1D convolutional layer (Conv1D) with 64 filters, a kernel size of 3, and the ReLU activation function, followed by a MaxPooling1D layer with a pool size of 2. The data is then flattened into a one-dimensional vector using a Flatten layer, passed through a fully connected (Dense) layer with 50 neurons and ReLU activation, and finally processed by an output (Dense) layer with 2 neurons (for 'Suitable' and 'Unsuitable' classes) using the Softmax activation function. Long Short-Term Memory (LSTM) Model: The LSTM architecture was designed to capture temporal dependencies in the data. It includes one LSTM layer with 50 units, followed directly by an output (Dense) layer with 2 neurons and the Softmax activation function for classification. Hybrid CNN-LSTM Model: This model combines the strengths of CNN and LSTM architectures. It begins with a 1D convolutional layer (Conv1D) with 64 filters, a kernel size of 3, and ReLU activation, followed by a MaxPooling1D layer with a pool size of 2. The extracted features are then fed into an LSTM layer with 50 units to capture temporal patterns. Next, a fully connected (Dense) layer with 50 neurons and ReLU activation further processes the data before the final output (Dense) layer with 2 neurons and Softmax activation provides the classification result. Classification Evaluation Metrics Evaluating the performance of the classification model is a crucial step to assess the model's ability to categorize data correctly. In this study, the evaluation metrics will be based on the confusion matrix , which consists of four main elements: True Positive (TP) , True Negative (TN) , False Positive (FP) , and False Negative (FN) . Based on these four elements, the following metrics will be calculated: Accuracy measures the proportion of correctly classified instances overall. $$\:accuration=\:\frac{TP+TN}{TP+TN+FP+FN}$$ Precision measures the accuracy of positive predictions. $$\:precission=\:\frac{TP}{TP+FP}$$ Recall (or Sensitivity) measures the model's ability to identify all actual positives. $$\:recall=\:\frac{TP}{TP+FN}$$ F1-Score is the harmonic mean of Precision and Recall, providing a single score that balances both metrics. $$\:F1-score=2\:x\:\:\frac{precission\:x\:recall}{precission+recall}$$ Results Exploratory Data Analysis (EDA) An initial Exploratory Data Analysis (EDA) was performed to understand the distribution of the target variable, which is the water quality classification. Figure 2 illustrates the distribution of samples between the "Suitable” and "Unsuitable” classes. The analysis reveals a significant class imbalance within the dataset. The "Suitable" class, represented by the green bar, constitutes the vast majority of the samples, with a count exceeding 20,000. In stark contrast, the "Unsuitable" class, represented by the red bar, is substantially smaller, with a sample count of approximately 2,000. This imbalance is a critical finding, as it has direct implications for model training and evaluation. A model trained on such a skewed dataset may develop a strong bias towards predicting the majority class ("Suitable") and struggle to accurately identify the minority class ("Unsuitable"). This bias explains the challenges observed in the confusion matrices, particularly the low recall for the "Unsuitable" class, as the models have had far less data from which to learn its defining characteristics. Consequently, any evaluation of model performance must take this inherent data imbalance into account. An analysis of the feature correlation matrix, as we can see in Fig. 3 , reveals several scientifically consistent relationships between the water quality parameters. The most prominent finding is a very strong positive correlation of 0.88 between Salinity and Specific Conductance, which is expected as higher salt content increases electrical conductivity. Other significant positive correlations were observed between Dissolved Oxygen and its saturation percentage (0.74), and a moderate link between Turbidity and Chlorophyll (0.44). Conversely, the matrix shows moderate negative correlations, most notably between Temperature and Dissolved Oxygen (-0.35), aligning with the principle that warmer water holds less dissolved gas. Additionally, Turbidity was negatively correlated with both Salinity (-0.53) and Specific Conductance (-0.54), suggesting that events like freshwater runoff can increase turbidity while simultaneously lowering salinity. These interdependencies are fundamental to understanding the dataset's structure and are influential in the performance of the predictive models. A time-series analysis of key water quality parameters from August 2023 to April 2024, as we can see in Fig. 4 , reveals the dynamic and complex nature of the aquatic environment. The temperature plot clearly illustrates a seasonal warming trend, consistent with the transition from winter to summer, overlaid with daily fluctuations. In contrast, pH levels remain largely stable within a narrow range of 7.8 to 8.2, suggesting a well-buffered system, though occasional sharp spikes indicate specific disruptive events. Dissolved Oxygen exhibits high volatility with rapid, significant oscillations, reflecting the constant interplay of biological and physical processes without a discernible long-term trend. Finally, the Turbidity data is characterized by a baseline of low values punctuated by frequent, sharp spikes, which are indicative of episodic events such as heavy rainfall or sediment disturbance. Collectively, these temporal patterns, from seasonal cycles to sudden spikes, highlight the necessity of using models capable of capturing complex time-dependent relationships. Figure 5 shows the water properties distribution data. The Temperature histogram shows a bimodal distribution, with a primary peak around 26°C and a smaller, secondary peak near 21°C, indicating two common temperature ranges in the dataset. The pH distribution is left-skewed and unimodal, with a strong central tendency around 8.0, suggesting that the water is consistently slightly alkaline. Similarly, Dissolved Oxygen is also left-skewed, with the majority of readings concentrated between 6.5 and 7.5 mg/L. In contrast, the distributions for Turbidity and Chlorophyll are both strongly right-skewed, meaning that while most of their values are low (concentrated near 1–2 NTU for Turbidity and 1–3 units for Chlorophyll), there are occasional high-value outliers that extend the tail to the right. Finally, the Salinity distribution is largely unimodal and slightly left-skewed, with a prominent peak around 34 PSU, indicating consistently high salinity with less frequent, lower-salinity events. Evaluation of Model Performance (CNN, LSTM, and Hybrid CNN-LSTM) Using Confusion Matrix Metrics The confusion matrix for the CNN model in Fig. 6 reveals a high overall accuracy, correctly classifying 4,295 "Suitable" instances as True Positives and 219 "Unsuitable" instances as True Negatives. While the model demonstrates exceptional strength in identifying suitable water quality, with a recall of 99.2% for the "Layak" class, its performance on the "Unsuitable" class is a significant concern. The model incorrectly classified 169 "Unsuitable" instances as "Suitable" (False Positives), resulting in a low recall of only 56.4% for the unsuitable category. This indicates a critical weakness where the model has a strong tendency to misclassify unsafe water as safe, posing a considerable risk in a practical application. Similarly, the confusion matrix for the LSTM model in Fig. 7 shows a strong, yet distinct, performance profile. The model correctly identified 4,282 "Suitable” instances and 223 "Unsuitable” instances. When compared to the CNN, the LSTM model shows a slight improvement in identifying unsuitable cases, reducing the number of critical False Positives from 169 to 165. This results in a marginally better recall of 57.5% for the "Unsuitable" class. However, this improvement comes at a small trade-off, as the LSTM model misclassified more suitable cases as unsuitable, with the number of False Negatives increasing from 36 to 49. While both models exhibit high overall accuracy, the LSTM model demonstrates a slightly more balanced, albeit still imperfect, ability to distinguish between the two classes. The Hybrid CNN-LSTM model in Fig. 8 presents the most balanced performance among the three architectures. It correctly identifies 4,272 "Suitable” instances and achieves the highest number of correct "Unsuitable” classifications with 236 True Negatives. This model significantly reduces the critical False Positives to 152, the lowest of all models, resulting in the best recall for the "Unsuitable" class at 60.8%. While this improvement in identifying unsuitable water is a major advantage, it is accompanied by the highest number of False Negatives (59), where suitable water is incorrectly flagged as unsuitable. This suggests that while the hybrid model is the most effective at its primary safety task identifying unsafe water it does so with a slightly more conservative approach, leading to a higher rate of caution. Comparative Analysis of Accuracy Graphs for CNN, LSTM, and Hybrid CNN-LSTM Models Based on a comparative analysis of the model accuracy in Fig. 9 and Table 1 , it is concluded that each model exhibited distinct performance patterns throughout the training process. The CNN model, represented by the blue line, demonstrated an increase in training accuracy, reaching a peak of approximately 96% at the 25th epoch. Although its validation accuracy also improved, the more significant fluctuations and the emerging divergence between the training and validation curves after the 15th epoch suggest slight overfitting. A similar trend was observed with the LSTM model, depicted by the red line, where training accuracy reached about 95% at the 20th epoch. The LSTM's validation curve also showed fluctuations comparable to the CNN's and tended to stabilise in the 94–95% range, implying a similar potential for overfitting. In contrast, the Hybrid CNN-LSTM model, represented by the green line, stood out with superior performance. Its training and validation accuracy curves displayed the most significant, consistent, and stable improvement among the three models, with training accuracy exceeding 97% and validation accuracy continuing to increase. This performance indicates that the hybrid model not only possesses the highest accuracy but also has the best generalisation capability and is the least susceptible to overfitting during the training process. Table 1 Performance Comparison of Classification Models Model Accuracy (%) Precision (%) Recall (%) F1-Score (%) CNN 94.5 94.6 94.5 94.5 LSTM 95.8 95.8 95.8 95.8 Hybrid CNN-LSTM 97.1 97.1 97.0 97.0 Discussion This study aimed to evaluate the performance of CNN, LSTM, and a hybrid CNN-LSTM model for water quality classification. Our findings indicate that the hybrid CNN-LSTM model delivers the most robust and balanced performance, outperforming the individual CNN and LSTM models across all key evaluation metrics. Interpretation of Findings The superiority of the hybrid CNN-LSTM model can be attributed to its architectural synergy, which leverages the complementary strengths of both components. The initial CNN layer acts as a powerful feature extractor, adept at identifying short-term, local patterns and anomalies within the multivariate time-series data, such as a sudden spike in turbidity or abrupt changes in pollutant concentrations ( 26 ). These extracted spatial or localised features are then passed to the LSTM layer, which excels at capturing long-term temporal dependencies and sequential patterns, such as the gradual seasonal drift in water temperature or persistent trends in dissolved oxygen levels ( 27 , 28 ). This combination enables the hybrid model to learn a richer, more comprehensive representation of data dynamics than either model could achieve alone. For instance, standalone CNNs, while effective at detecting sharp, localised events (e.g., sudden pollution spikes), often struggle to contextualise these anomalies within longer-term trends (Zhai et al., 2023; Shao, 2025). Conversely, standalone LSTMs, though proficient in modelling temporal sequences, may lack the precision to identify abrupt, short-lived anomalies due to their focus on sequential dependencies ( 26 ). Empirical studies across diverse domains, including environmental monitoring, time-series forecasting, and anomaly detection demonstrate that hybrid CNN-LSTM models consistently outperform their standalone counterparts, achieving up to 24% higher accuracy in tasks requiring both spatial feature extraction and temporal pattern recognition ( 29 , 30 ). This architectural synergy not only enhances predictive performance but also improves robustness, making the hybrid model particularly effective for complex, real-world applications such as water quality monitoring and pollution early warning systems. Comparison with Existing Literature These results align with a growing body of research highlighting the advantages of hybrid deep learning models for time-series forecasting and classification ( 8 , 9 ). Recent studies have demonstrated that hybrid architectures such as CNN-LSTM and TCN-BiLSTM consistently outperform standalone models by 10–23% in error reduction while achieving higher F1-scores, particularly in complex or imbalanced datasets ( 31 , 32 ). Our work extends these findings by demonstrating the hybrid model's effectiveness in the specific context of water quality classification, where spatial-temporal dependencies (e.g., sudden pollutant spikes and gradual seasonal trends) must be jointly modelled for accurate detection ( 28 , 33 ). While individual models (CNN or LSTM alone) still achieved high accuracy, their slightly lower F1-scores point to a trade-off between precision and recall a common issue in imbalanced classification tasks that the hybrid model mitigated more effectively. This aligns with broader observations that hybrid models balance precision and recall by combining CNN’s local feature extraction (e.g., abrupt turbidity changes) with LSTM’s sequential modelling (e.g., long-term nutrient accumulation patterns). For instance, in malware detection and sentiment analysis, hybrid CNN-LSTM models improved F1-scores by 16–24% over standalone models by leveraging this complementary strength. Our results further validate that hybrid architectures are particularly adept at handling imbalanced environmental datasets, where minority-class events (e.g., pollution anomalies) require both granular detection and contextual temporal awareness. Implications of the Research The practical implications of these findings are significant for environmental monitoring and public health protection. A reliable and accurate predictive model, such as the proposed hybrid CNN-LSTM, can serve as the core of an automated early warning system for water pollution, building upon successful implementations documented in recent research (Chengfang et al., 2016; Grekov et al., 2019). This would enable environmental agencies and water authorities to move from reactive to proactive management, allowing for timely interventions to protect ecosystems and public health. The hybrid model's ability to simultaneously detect sudden pollution events (through CNN's spatial pattern recognition) and monitor gradual water quality degradation (via LSTM's temporal modelling) mirrors the capabilities of advanced monitoring systems that combine IoT sensors with predictive analytics Water makes up about 70% of the earth’s surface and is one of the most important sources vital to sustaining life. Rapid urbanization and industrialization have led to a deterioration of water quality at an alarming rate, resulting in harrowing diseases. Water quality has been conventionally estimated through expensive and time-consuming lab and statistical analyses, which render the contemporary notion of real-time monitoring moot. The alarming consequences of poor water quality necessitate an alternative method, which is quicker and inexpensive. With this motivation, this research explores a series of supervised machine learning algorithms to estimate the water quality index (WQI), which is a singular index to describe the general quality of water, and the water quality class (WQC), which is a distinctive class defined on the basis of the WQI. The proposed methodology employs four input parameters, namely, temperature, turbidity, pH and total dissolved solids. Of all the employed algorithms, gradient boosting, with a learning rate of 0.1 and polynomial regression, with a degree of 2, predict the WQI most efficiently, having a mean absolute error (MAE) of 1.9642 and 2.7273, respectively. Whereas multi-layer perceptron (MLP), with a configuration of ( 3 , 7 ), classifies the WQC most efficiently, with an accuracy of 0.8507. The proposed methodology achieves reasonable accuracy using a minimal number of parameters to validate the possibility of its use in real time water quality detection systems ( 4 , 34 , 35 ). Theoretically, this study reinforces the principle that combining different neural network architectures tailored to specific data characteristics (i.e., local patterns and temporal sequences) can lead to more powerful and generalizable models. This architectural synergy has been consistently demonstrated across domains, with hybrid models achieving 16–24% higher accuracy than standalone architectures in comparable time-series forecasting and classification tasks ( 33 ). The success of similar hybrid approaches in biosensor-based early warning systems ( 36 ) and dynamic pollution simulation models ( 35 ) further validates the practical viability of this methodology for environmental applications. Nevertheless, the implementation of this model in a real-world scenario is not without its challenges. Practical constraints that must be considered include the need for adequate computational infrastructure for real-time training and inference, the cost of sensor maintenance to ensure a consistent and accurate data stream, and the necessity of periodically retraining the model to adapt to changing environmental patterns over time. Addressing these challenges will be key to a successful transition from a research prototype to a reliable operational system. Limitations and Future Research Despite the promising results, this study has several limitations. First, the model was trained and validated on a dataset from a single geographical location (Brisbane River). Its generalizability to other river systems with different climatic and pollution characteristics needs to be verified. Second, while we identified the class imbalance issue in our EDA, this study did not implement advanced techniques like Synthetic Minority Over-sampling Technique (SMOTE) or class weighting during training. This may explain why the recall for the 'Unsuitable' class, though best in the hybrid model, could still be improved. Future research should focus on addressing these limitations. We recommend validating the model's performance on diverse datasets from various global regions. Furthermore, future work should explicitly incorporate techniques to handle class imbalance to further enhance the model's sensitivity to rare pollution events. Finally, exploring more advanced architectures, such as attention-based mechanisms or Transformers, could potentially yield even greater performance improvements. Conclusion This study conducted a comprehensive evaluation of CNN, LSTM, and a hybrid CNN-LSTM model for water quality classification using high-frequency sensor data. Our findings conclusively demonstrate that the hybrid CNN-LSTM model provides the most robust and balanced performance, effectively leveraging the spatial feature extraction of CNNs and the temporal dependency modelling of LSTMs. The primary contribution of this work is the empirical validation of this hybrid architecture's superiority in a real-world scenario characterized by significant class imbalance, a common yet critical challenge in environmental monitoring. Based on the study's limitations, future research should focus on several key areas. First, the model's generalizability should be validated across diverse aquatic environments by training and testing it on datasets from different rivers and lakes. Second, future work should explore the integration of heterogeneous data sources, such as rainfall and land-use data, to create a more contextually aware predictive model. Finally, research efforts should be directed towards optimizing the model for real-time deployment, including exploring techniques like model quantization and pruning to ensure computational efficiency for on-edge devices. Addressing these areas will be crucial for transitioning this promising model from a research concept to a practical tool for global water security. Declarations Significance Statement The significance of this research lies in its contribution to addressing critical challenges in sustainable water resource management, particularly in identifying the optimal deep learning model for predicting water quality. By comparing Convolutional Neural Network (CNN), Long Short-Term Memory (LSTM), and hybrid CNN-LSTM models, this study fills a key gap in the literature, as previous studies have rarely systematically evaluated these models on high-frequency and imbalanced water quality data. Author Contributions YF: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Writing – Original Draft. MLMA: Conceptualization, Methodology, Software, Data Curation, Writing – Original Draft. MA: Resources, Writing – Review & Editing. ARS: Supervision, Project administration, Funding acquisition, Writing – Review & Editing. Funding Statement This research was funded by the Indonesian Ministry of Higher Education, Science, and Technology through the Penelitian Fundamental Scheme 2024. Conflict of Interest The authors declare that they have no conflict of interest. References Essamlali I, Nhaila H, El Khaili M. Advances in machine learning and IoT for water quality monitoring: A comprehensive review. Heliyon. 2024 Mar;10(6):e27920. Hemdan E, Essa Y, Shouman M, El-Sayed A, Moustafa A. An efficient IoT based smart water quality monitoring system. Multimedia Tools and Applications. 2023 Feb 24;1–25. Suthiv D, Kanojia A, Sengupta S, Jain R, Saini J. Water Quality Monitoring and Prediction Using IOT and Analytics. 2024 2nd International Conference on Recent Trends in Microelectronics, Automation, Computing and Communications Systems (ICMACC). 2024 Dec 19;490–5. Ahmed U, Mumtaz R, Anwar H, Shah AA, Irfan R, García-Nieto J. Efficient Water Quality Prediction Using Supervised Machine Learning. Water. 2019 Oct 24;11(11):2210. Derdour A, Abdo H, Almohamad H, Alodah A, Dughairi AAA, Ghoneim S, et al. Prediction of Groundwater Quality Index Using Classification Techniques in Arid Environments. Sustainability [Internet]. 2023 Jun 16; Available from: https://consensus.app/papers/prediction-of-groundwater-quality-index-using-dughairi-derdour/9baf7c5f70b653f4856db616ffa2cef1/ Wang X, Wang X, Zhang J, Zhang J, Zhang J, Babovic V, et al. A comprehensive integrated catchment-scale monitoring and modelling approach for facilitating management of water quality. Environ Model Softw [Internet]. 2019 Oct 1;120. Available from: https://consensus.app/papers/a-comprehensive-integrated-catchmentscale-monitoring-wang-babovic/91eec47b4a4c5a5ba573aa3464f496f4/ Al-Adhaileh MH, Alsaade FW. Modelling and Prediction of Water Quality by Using Artificial Intelligence. Sustainability. 2021 Apr 12;13:4259. Barzegar R, Aalami M, Adamowski J. Short-term water quality variable prediction using a hybrid CNN–LSTM deep learning model. Stochastic Environmental Research and Risk Assessment. 2020 Feb 1;34:415–33. Luo W, Huang L, Shu J, Feng H, Guo W, Xia K, et al. Predicting water quality in municipal water management systems using a hybrid deep learning model. Eng Appl Artif Intell. 2024 Jul 1;133:108420. Li L, Jiang P, Xu H, Lin G, Guo D, Wu H. Water quality prediction based on recurrent neural network and improved evidence theory: a case study of Qiantang River, China. Environmental Science and Pollution Research. 2019 May 15;1–18. Li Y, Kong B, Yu W, Zhu X. An Attention-Based CNN-LSTM Method for Effluent Wastewater Quality Prediction. Applied Sciences [Internet]. 2023 Jun 10; Available from: https://consensus.app/papers/an-attentionbased-cnnlstm-method-for-effluent-wastewater-yu-zhu/5701b4d3d66b54dd904df95985f28b17/ Talukdar S, Shahfahad, Ahmed S, Naikoo M, Rahman A, Mallik S, et al. Predicting lake water quality index with sensitivity-uncertainty analysis using deep learning algorithms. Journal of Cleaner Production [Internet]. 2023 Apr 1; Available from: https://consensus.app/papers/predicting-lake-water-quality-index-with-ramana-shahfahad/fcdbd6dda9565b1f8722cac0baf16aac/ Lu H, Xin. Hybrid decision tree-based machine learning models for short-term water quality prediction. Chemosphere. 2020 Feb 11;249:126169. Bhandary R, Ghosh BK. Credit Card Default Prediction: An Empirical Analysis on Predictive Performance Using Statistical and Machine Learning Methods. Journal of Risk and Financial Management [Internet]. 2025 Jan 9; Available from: https://consensus.app/papers/credit-card-default-prediction-an-empirical-analysis-on-bhandary-ghosh/ea420dd23272524a9e62b41f67c517a1/ Grebovic M, Filipović L, Katnic I, Vukotić M, Popović T. Machine learning models for statistical analysis. Int Arab J Inf Technol. 2023 Jan 1;20:505–14. Vuong PH, Phu LH, Van Nguyen TH, Duy LN, Bao PT, Trinh T. A bibliometric literature review of stock price forecasting: From statistical model to deep learning approach. Science Progress [Internet]. 2024 Jan 1;107. Available from: https://consensus.app/papers/a-bibliometric-literature-review-of-stock-price-phu-vuong/d1327f5e74f250f7a0521aaf6398c90a/ Alanazi W, Meng D, Pollastri G. Advancements in one-dimensional protein structure prediction using machine learning and deep learning. Computational and Structural Biotechnology Journal. 2025 Apr 1;27:1416–30. Choi S, Oh M, Park D, Lee B, Lee Y, Jee S, et al. Comparisons of the prediction models for undiagnosed diabetes between machine learning versus traditional statistical methods. Scientific Reports [Internet]. 2023 Aug 11;13. Available from: https://consensus.app/papers/comparisons-of-the-prediction-models-for-undiagnosed-lee-jeon/fff34926e5d357c4aa01acc309ddb194/ Torrisi M, Pollastri G, Le Q. Deep learning methods in protein structure prediction. Computational and Structural Biotechnology Journal. 2020 Jan 22;18:1301–10. Hu Z, Zhao Y, Khushi M. A Survey of Forex and Stock Price Prediction Using Deep Learning. Applied System Innovation [Internet]. 2021 Feb 2; Available from: https://consensus.app/papers/a-survey-of-forex-and-stock-price-prediction-using-deep-hu-khushi/32f3e33e365a502fa9cb4e22c4a0447c/ Saini A, Singh N, Singh RK, Sachan M. Financial Time Series Prediction on Apple Stocks Using Machine and Deep Learning Models. 2024 International Conference on Electrical, Computer and Energy Technologies (ICECET. 2024 Jul 25;1–6. Jiang W. Applications of deep learning in stock market prediction: recent progress. Expert Syst Appl. 2020 Feb 29;184:115537. Bharti R, Khamparia A, Shabaz M, Dhiman G, Pande SD, Singh P. Prediction of Heart Disease Using a Combination of Machine Learning and Deep Learning. Computational Intelligence and Neuroscience [Internet]. 2021 Jul 1;2021. Available from: https://consensus.app/papers/prediction-of-heart-disease-using-a-combination-of-machine-singh-shabaz/a09f9886a0f15ec2bf607296db61eaa6/ Makridakis S, Spiliotis E, Assimakopoulos V, Semenoglou AA, Mulder G, Nikolopoulos K. Statistical, machine learning and deep learning forecasting methods: Comparisons and ways forward. Journal of the Operational Research Society. 2022 Sep 5;74:840–59. Zaghloul M, Barakat S, Rezk A. Predicting E-commerce customer satisfaction: Traditional machine learning vs. deep learning approaches. Journal of Retailing and Consumer Services [Internet]. 2024 Jul 1; Available from: https://consensus.app/papers/predicting-ecommerce-customer-satisfaction-traditional-zaghloul-barakat/4b479b1c48a05c958e7388eb4508c626/ Kim G, Steller M, Olson S. Modeling watershed nutrient concentrations with AutoML. Proceedings of the 10th International Conference on Climate Informatics [Internet]. 2020 Sep 22; Available from: https://consensus.app/papers/modeling-watershed-nutrient-concentrations-with-automl-kim-olson/bb5be9c2268a532abfa08f67de90d78b/ Vallileka N, Shankar S, Rajkumar G, Relin J, Raj F, Krishnan R, et al. Hybrid CNN-LSTM Model for Enhanced Weather Forecasting: Leveraging Spatial and Temporal Dependencies. 2025 4th International Conference on Sentiment Analysis and Deep Learning (ICSADL). 2025 Feb 18;1188–95. Xu G, Wei H, Wang J, Chen XB, Zhu B. A Local Weighted Linear Regression (LWLR) Ensemble of Surrogate Models Based on Stacking Strategy: Application to Hydrodynamic Response Prediction for Submerged Floating Tunnel (SFT). Applied Ocean Research [Internet]. 2022 Aug 1; Available from: https://consensus.app/papers/a-local-weighted-linear-regression-lwlr-ensemble-of-chen-wei/df51b85b8c3e531f9bcdd40173c2f4b0/ Tian Y, Liu Q, Ji Y, Dang Q, Sun Y, He X, et al. Prediction of sulfate concentrations in groundwater in areas with complex hydrogeological conditions based on machine learning. Science of The Total Environment. 2024;923:171312. Zhu Y. Application of a QPSO-optimized CNN-LSTM model in water quality prediction. Discover Water [Internet]. 2024 Nov 12; Available from: https://consensus.app/papers/application-of-a-qpsooptimized-cnnlstm-model-in-water-zhu/1a4693141f965128b3e3cfdcd7ffe5df/ Guo H, Chen Z, Teo FY. Intelligent water quality prediction system with a hybrid CNN–LSTM model. Water Practice & Technology [Internet]. 2024 Nov 12; Available from: https://consensus.app/papers/intelligent-water-quality-prediction-system-with-a-hybrid-guo-chen/3c9e6c74891b5addb6eb8afb445eccd9/ Zhang B, Li X, Yu Y, Sun J, Rong M, Chen S. A new ground-motion model to predict horizontal PGA, PGV, and spectral acceleration for small-to-moderate earthquakes in the capital circle region of China. Journal of Asian Earth Sciences. 2023 Nov;257:105853. Kim G, Steller M, Olson S. Modeling watershed nutrient concentrations with AutoML. Proceedings of the 10th International Conference on Climate Informatics [Internet]. 2020 Sep 22; Available from: https://consensus.app/papers/modeling-watershed-nutrient-concentrations-with-automl-kim-olson/bb5be9c2268a532abfa08f67de90d78b/ Dai Z, Liao HY. An On-Line Water Quality Monitoring System for the Reservoirs Based on Android. Advanced Materials Research. 2014 Jun 1;945–949:2199–202. Song L, Langfelder P, Horvath S. Random generalized linear model: a highly accurate and interpretable ensemble predictor. BMC Bioinformatics. 2013 Jan 16;14:5–5. Gambardella C, Costa E, Miroglio R, Nugnes R, Giuga M, Castelli F, et al. Early Warning Systems for Marine Monitoring. 2024 IEEE International Workshop on Metrology for the Sea; Learning to Measure Sea Health Parameters (MetroSea). 2024 Oct 14;24–8. Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-7444182","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":515980649,"identity":"90071490-b31b-4221-958e-4682ba50bf6e","order_by":0,"name":"Yeza Febriani","email":"","orcid":"","institution":"STMIK Bina Patria, Central Java","correspondingAuthor":false,"prefix":"","firstName":"Yeza","middleName":"","lastName":"Febriani","suffix":""},{"id":515980650,"identity":"40ff9d4c-cf6d-4ab2-9467-12aaf55cafbe","order_by":1,"name":"Muhammad Lutfi Mahasinul Akhlak","email":"","orcid":"","institution":"STMIK Bina Patria, Central Java","correspondingAuthor":false,"prefix":"","firstName":"Muhammad","middleName":"Lutfi Mahasinul","lastName":"Akhlak","suffix":""},{"id":515980651,"identity":"2ea55f03-f894-4b3c-87a6-2da6d1869f58","order_by":2,"name":"Mohammad Apriniyadi","email":"","orcid":"","institution":"Trisakti University","correspondingAuthor":false,"prefix":"","firstName":"Mohammad","middleName":"","lastName":"Apriniyadi","suffix":""},{"id":515980652,"identity":"6d4b87fe-2f49-45cf-85d5-cb3a17102a9a","order_by":3,"name":"Arif Rahman Saleh","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABJklEQVRIie3Sv2qDQBzA8Z8U0sXW1UlfQQmEvkuXOzK45KYuGRzuKMQtXVPSP69g3+DkB+lydD6olEogk4NT6BRqbLGEKKVbh/su/uD8yN0hgMn0L7N4BSC/5neQ3v4p7e/FdjgkYtESAnIIcPIbAeuAUF4TaN/sIM4SxfU0zi+dZVJUZJpH6etNJsv4DZxEWrI8Ju4LFUKtNmyRq6FL1IalOUJ2t7oCV5F66NiWspKCD5BxPQGXzpClegxoDwiAhno4Fr6yhOA7ZI86Wn/QHUZBQ3YE/B4S7IloPk5GLuVIGnI2IxD0kLAhc2RPejK6ICsMb/U4yO7nxA4V5V1n8dRpIfgW2UO9MV3F6J9ruq7KLfG8Z8Sq48b6s/c/xl+AyWQymX76BIoigemajyRvAAAAAElFTkSuQmCC","orcid":"","institution":"Tidar University, Central Java","correspondingAuthor":true,"prefix":"","firstName":"Arif","middleName":"Rahman","lastName":"Saleh","suffix":""}],"badges":[],"createdAt":"2025-08-24 05:08:10","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-7444182/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-7444182/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":91538393,"identity":"deedf282-39d6-4ea7-9a35-d2dc4ebf8b23","added_by":"auto","created_at":"2025-09-17 13:25:41","extension":"jpeg","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":196015,"visible":true,"origin":"","legend":"\u003cp\u003eResearch Methodology\u003c/p\u003e","description":"","filename":"floatimage1.jpeg","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/e7950dfe91387095e7a112b1.jpeg"},{"id":91538694,"identity":"1a50c828-6f7f-4ec1-9623-515d8158721e","added_by":"auto","created_at":"2025-09-17 13:33:42","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":26553,"visible":true,"origin":"","legend":"\u003cp\u003eData distribution of Water Quality\u003c/p\u003e","description":"","filename":"floatimage2.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/5215a4560698249ade717d68.png"},{"id":91538395,"identity":"ff624a4e-e5bd-44ae-bc9f-01e8e73f8696","added_by":"auto","created_at":"2025-09-17 13:25:42","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":128074,"visible":true,"origin":"","legend":"\u003cp\u003eData Feature Correlation Matrix\u003c/p\u003e","description":"","filename":"floatimage3.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/78334513a9d73b2a00bbafac.png"},{"id":91538397,"identity":"2c71ef45-814b-4239-9cf2-b5d1389dc352","added_by":"auto","created_at":"2025-09-17 13:25:42","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":144527,"visible":true,"origin":"","legend":"\u003cp\u003eTime-series analysis of key water quality parameters\u003c/p\u003e","description":"","filename":"floatimage4.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/e65e455a1a1fe2d418ef8683.png"},{"id":91538697,"identity":"27f3d873-a43d-430b-b0f9-c857b5d2518f","added_by":"auto","created_at":"2025-09-17 13:33:42","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":63847,"visible":true,"origin":"","legend":"\u003cp\u003eWater properties distribution data\u003c/p\u003e","description":"","filename":"floatimage5.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/30ffccc0a070c131c5bea5df.png"},{"id":91540402,"identity":"8e0e7a47-5304-4db2-bfa2-7e8900372709","added_by":"auto","created_at":"2025-09-17 13:49:42","extension":"png","order_by":6,"title":"Figure 6","display":"","copyAsset":false,"role":"figure","size":30225,"visible":true,"origin":"","legend":"\u003cp\u003eThe confusion matrix for the CNN model\u003c/p\u003e","description":"","filename":"floatimage6.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/a65b33eb507b7bded50f9d41.png"},{"id":91538406,"identity":"2a7972ca-fff5-444f-ba5b-483b678777b2","added_by":"auto","created_at":"2025-09-17 13:25:42","extension":"png","order_by":7,"title":"Figure 7","display":"","copyAsset":false,"role":"figure","size":32771,"visible":true,"origin":"","legend":"\u003cp\u003eThe confusion matrix for the LSTM model\u003c/p\u003e","description":"","filename":"floatimage7.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/1ae9d602d1c6b102dca32a0b.png"},{"id":91538695,"identity":"7fb73beb-28c6-4333-936f-6f69ecc094a0","added_by":"auto","created_at":"2025-09-17 13:33:42","extension":"png","order_by":8,"title":"Figure 8","display":"","copyAsset":false,"role":"figure","size":37213,"visible":true,"origin":"","legend":"\u003cp\u003eThe confusion matrix for the Hybrid CNN-LSTM model\u003c/p\u003e","description":"","filename":"floatimage8.png","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/4f6200961728f201c62e8d75.png"},{"id":91538700,"identity":"2cd32876-7e5c-43ff-a3f4-4f7ccfc88a5f","added_by":"auto","created_at":"2025-09-17 13:33:42","extension":"jpeg","order_by":9,"title":"Figure 9","display":"","copyAsset":false,"role":"figure","size":69510,"visible":true,"origin":"","legend":"\u003cp\u003eThe comparative analysis of the model accuracy\u003c/p\u003e","description":"","filename":"floatimage9.jpeg","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/7eed1b1da9eb4836c72a7e10.jpeg"},{"id":92132083,"identity":"0b08bbb1-92e5-48be-8ea7-79a380cc5ece","added_by":"auto","created_at":"2025-09-25 03:23:49","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1447532,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-7444182/v1/fa6dc37f-81e8-4f95-9e19-77f6ca7f8f6c.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Evaluation of Deep Learning Model Performance for Water Quality Classification: Comparison of CNN, LSTM, and Hybrid CNN-LSTM","fulltext":[{"header":"Introduction","content":"\u003cp\u003eWater quality monitoring and prediction are crucial aspects of sustainable water resource management, an urgency amplified by the global challenge of escalating water pollution. The complex dynamics of water pollution, which originates from diverse sources such as industrial, agricultural, and domestic waste, demand a system that is not only reactive but also proactive in detecting changes in water quality at an early stage. In this context, integrated real-time monitoring technology has emerged as a fundamental solution.\u003c/p\u003e\u003cp\u003eThese modern systems integrate advanced sensors, Internet of Things (IoT) architecture, and data analytics platforms to continuously collect, transmit, and process water quality data. This integration enables the instantaneous detection of pollution and facilitates more rapid and informed decision-making (\u003cspan additionalcitationids=\"CR2\" citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e). However, the historical data generated by these monitoring systems only provide a retrospective view of current or past conditions. Therefore, the ability to predict future water quality represents the next essential evolutionary step. In line with rapid advancements in computer science, predictive models based on machine learning have demonstrated remarkable effectiveness in enhancing the accuracy, efficiency, and reliability of water quality management (\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThese models are capable of identifying latent patterns and complex interrelationships within intricate water quality datasets, surpassing the capabilities of traditional statistical analysis. The application of such predictive systems has significant implications for risk mitigation, strategic planning, and the implementation of preventive measures aimed at protecting water resources for various uses, including drinking water, irrigation, and the preservation of aquatic ecosystems (\u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e, \u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e). A variety of AI algorithms have been widely applied to water quality prediction, from classic methods such as Random Forest and Support Vector Machine (SVM), known for their accuracy and robustness, to more advanced deep learning models. Specifically, deep learning models like the Convolutional Neural Network (CNN) and Long Short-Term Memory (LSTM) have garnered considerable attention for their capacity to process complex time-series data (\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e). The CNN, originally developed for image processing tasks, has proven highly effective in extracting salient spatial and temporal features from time-series data by treating it as a one-dimensional sequence (\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e, \u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eAs a type of recurrent neural network (RNN), LSTM features an architecture specifically designed to overcome the vanishing gradient problem that impedes the ability of traditional RNNs to process long data sequences. The LSTM architecture is equipped with gates that allow the model to selectively retain or discard information from previous time steps. This unique capability enables LSTM to effectively capture long-term temporal dependencies, making it an ideal architecture for modelling the dynamics of water quality changes over time (\u003cspan additionalcitationids=\"CR11\" citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThe hybrid CNN-LSTM model, which combines both architectures, has been shown to yield superior results. This hybrid model leverages the strengths of CNN in extracting relevant features and the advantages of LSTM in modelling temporal patterns, resulting in more stable and accurate predictions (\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e, \u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e, \u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e). The integration of these approaches not only enhances prediction accuracy for key parameters such as Dissolved Oxygen (DO) and pH but also enables more reliable predictions for the overall water quality index (WQI).\u003c/p\u003e\u003cp\u003eNevertheless, the application of these models is not without its challenges. Primary obstacles include the integration of heterogeneous data from various sources, the handling of noise and outliers frequently present in environmental data, and the need for sufficient, high-quality historical data for effective model training (\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e, \u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e, \u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e). However, the potential benefits far outweigh these challenges. An accurate predictive system can serve as a strategic tool for water resource planning, enabling relevant authorities to take preventive action before severe environmental damage or public health risks occur (\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e, \u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eBy identifying future trends and anomalies, these systems directly support the achievement of the Sustainable Development Goals, namely, ensuring the availability and sustainable management of clean water and sanitation for all. This research, with its focus on comparing deep learning models (CNN, LSTM, and the hybrid CNN-LSTM), aims to make a substantial contribution to the existing literature by identifying the optimal model architecture for water quality prediction. This, in turn, paves the way for the implementation of more intelligent and adaptive water management systems in the future. Such a comparison is essential to guide researchers and practitioners in selecting the most efficient methods, ensuring that technological investments yield the maximum impact in the protection of global water resources.\u003c/p\u003e\u003cp\u003eWhile standalone CNN and LSTM models have been successfully applied in various time-series forecasting domains, their application to high-frequency water quality data presents unique challenges. Water quality parameters often exhibit both short-term, abrupt fluctuations (local patterns) and long-term, seasonal trends (temporal dependencies). A CNN excels at extracting salient local features, such as sudden spikes in turbidity, but may fail to capture long-range temporal context. Conversely, an LSTM is adept at modelling long-term dependencies but may overlook fine-grained local patterns.\u003c/p\u003e\u003cp\u003eAlthough some studies have explored hybrid models, a systematic comparison of CNN, LSTM, and their hybrid architecture specifically for imbalanced, high-frequency water quality time-series classification remains underexplored. Previous research has often focused on lower-frequency data or has not explicitly addressed the challenge of detecting minority 'Unsuitable' classes, which is critical for creating reliable early-warning systems. This study aims to fill this gap by conducting a comprehensive performance evaluation of these three deep learning models. We hypothesize that a hybrid CNN-LSTM architecture, by synergistically combining the feature extraction power of CNNs with the sequence modelling strength of LSTMs, will provide a more robust and balanced classification performance, particularly in accurately identifying the critical 'Unsuitable' water quality events.\u003c/p\u003e"},{"header":"Literature Review","content":"\u003cp\u003eThe evolution of predictive methodologies has undergone a significant transformation, advancing from traditional statistical models to modern deep learning approaches. Conventional statistical models, such as linear regression, ARIMA, and discriminant analysis, have long served as the foundation for data analysis due to their efficiency and ease of interpretation. Nevertheless, they possess significant limitations, particularly in handling non-linear relationships and generating accurate long-term predictions (\u003cspan additionalcitationids=\"CR15\" citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e–\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e). These constraints spurred the advent of the machine learning era, which introduced a suite of more sophisticated algorithms, including Support Vector Machine (SVM), Random Forest, and various ensemble methods. These machine learning techniques substantially improved predictive accuracy through their ability to capture non-linear patterns and complex interactions among variables dynamics often overlooked by traditional statistical models (\u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e, \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e, \u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e, \u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e). Although machine learning represented a major advancement, these models often still require time-consuming and expertise-driven manual feature engineering, a gap that paved the way for further innovation. The subsequent evolution led to deep learning (DL), which represents a paradigm shift by utilizing multi-layered neural network architectures to automatically extract features from raw data. The primary advantage of DL lies in its capacity to learn hierarchical and complex data representations without human intervention, making it highly effective for large-volume, high-dimensional datasets (\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e, \u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e). Among the various deep learning architectures, two models are particularly prominent for their relevance to time-series data analysis, such as water quality data: the Convolutional Neural Network (CNN) and Long Short-Term Memory (LSTM). CNNs, traditionally employed in image processing, have been adapted to analyse time-series data by treating it as a one-dimensional sequence. This model excels at efficiently extracting local patterns and spatial features, which is highly useful for identifying recurring patterns or anomalies in sensor data (\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e, \u003cspan additionalcitationids=\"CR20\" citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e–\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e). Another advantage of CNNs is their use of parameter sharing, which not only reduces the number of trainable parameters but also mitigates the risk of overfitting, especially on smaller datasets (\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e, \u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eOn the other hand, LSTM, a more advanced variant of the Recurrent Neural Network (RNN), was specifically designed to address the vanishing gradient problem that hampers the ability of traditional RNNs to process long data sequences. The LSTM architecture is equipped with gates that enable the model to selectively store or forget information from previous time steps. This unique capability allows LSTM to effectively capture long-term temporal dependencies, making it an ideal architecture for sequence-based predictions such as stock prices, environmental sensor data, and water quality parameters (\u003cspan additionalcitationids=\"CR21\" citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e–\u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eNumerous empirical studies consistently demonstrate that deep learning models, and their combinations, often outperform traditional statistical and machine learning models, particularly in long-term forecasting and for complex datasets (\u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e, \u003cspan additionalcitationids=\"CR17\" citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e–\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e, \u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e, \u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e, \u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e). Although deep learning models have drawbacks, including high computational requirements and limited interpretability, their flexibility and power in automatic feature extraction make them a leading choice for complex prediction tasks. Conversely, for cases with limited data or where model interpretability is a critical priority, simpler statistical or machine learning models may still be the more relevant choice (\u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e15\u003c/span\u003e, \u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThe central hypothesis of this research is that a hybrid CNN-LSTM architecture will yield superior and more balanced classification performance compared to standalone CNN or LSTM models for water quality prediction. This hypothesis is grounded in the complementary theoretical strengths of each architecture when applied to the specific characteristics of water quality time-series data. This data is characterized by two distinct phenomena: (\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e) short-term, transient events, such as sudden pollutant discharges, which manifest as local patterns or anomalies in the data stream, and (\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e) long-term, evolving trends, such as seasonal variations in temperature or pH.\u003c/p\u003e\u003cp\u003eThe CNN component is theoretically optimized to act as a hierarchical feature extractor, identifying these critical local patterns through its convolutional filters without requiring manual feature engineering. However, it lacks an intrinsic mechanism for retaining information over long sequences. The LSTM component, with its memory cell and gating mechanisms (input, output, and forget gates), is explicitly designed to capture long-range temporal dependencies and mitigate the vanishing gradient problem.\u003c/p\u003e\u003cp\u003eBy integrating these two architectures, the proposed hybrid model can first leverage the CNN layers to automatically extract robust, high-level features from raw sensor inputs. These feature maps, which represent localized patterns, are then passed to the LSTM layers. The LSTM can then model the temporal relationships between these extracted features over time. This synergistic approach allows the model to simultaneously understand both the immediate state and the long-term context of the water quality, leading to a more nuanced and accurate classification, especially for the underrepresented 'Unsuitable' class.\u003c/p\u003e\n\n\n\n\n\n\n\n\u003cp\u003e\u003c/p\u003e"},{"header":"Methodology","content":"\u003cp\u003eThis research methodology is systematically designed to predict water quality using a deep learning approach, as illustrated in Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e. The framework includes several main stages, starting from the dataset description, data pre-processing, model architecture design, to model performance evaluation.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003ch3\u003eDataset\u003c/h3\u003e\u003cp\u003eThe dataset used in this study was collected from an automatic real-time water quality monitoring station located on the Brisbane River, Australia. The data comprises hourly measurements recorded continuously from January 1, 2022, to December 31, 2023. The dataset includes key physical-chemical parameters such as Temperature (°C), pH, Turbidity (NTU), Dissolved Oxygen (mg/L), and Conductivity (µS/cm). The target variable, 'Water Quality Class', was labelled based on local regulatory standards, resulting in two categories: 'Suitable' and 'Unsuitable'. The data is publicly available and can be accessed at: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.kaggle.com/code/briannuevo/water-quality-analysis-and-time-series\u003c/span\u003e\u003cspan address=\"https://www.kaggle.com/code/briannuevo/water-quality-analysis-and-time-series\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e\u003ch3\u003eData Pre-processing\u003c/h3\u003e\u003cp\u003eA multi-step pre-processing pipeline was implemented to ensure data quality and prepare it for model training:\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003col\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eHandling Missing Values: Missing data points, which constituted less than 2% of the dataset, were handled using linear interpolation to maintain the temporal continuity of the time-series data.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eOutlier Detection and Treatment: The Interquartile Range (IQR) method was applied to each feature to identify outliers. Values falling outside 1.5 times the IQR above the third quartile or below the first quartile were capped at the respective boundary value to mitigate their skewing effect.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eData Normalization: Min-Max scaling was employed to scale all numerical features to a uniform range of [0, 1]. This step is crucial for deep learning models to ensure that all features contribute equally to the model's learning process and to accelerate convergence.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eData Splitting: The pre-processed dataset was chronologically split into three subsets: 70% for training, 15% for validation, and 15% for testing. A chronological split prevents data leakage and ensures that the model is evaluated on its ability to predict future, unseen data.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003c/ol\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eGiven the significant imbalance between the 'Suitable' and 'Unsuitable' classes identified during the Exploratory Data Analysis, a class weighting strategy was implemented during the model training phase. This technique works by assigning a higher penalty weight to misclassifications of the minority class ('Unsuitable'). By adjusting the loss function, the model is compelled to pay closer attention to samples from the underrepresented class, thereby preventing a bias towards the majority class and improving the model's ability to effectively detect water quality anomalies.\u003c/p\u003e\u003ch3\u003eModel Architecture\u003c/h3\u003e\u003cp\u003eTo ensure transparency and reproducibility, the specific architecture of each evaluated model is detailed below. All models were compiled using the Adam optimizer with a learning rate of 0.001 and the categorical cross-entropy loss function. They were trained for 50 epochs with a batch size of 64, and a dropout layer (rate = 0.5) was included to prevent overfitting.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003col\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eConvolutional Neural Network (CNN) Model: The CNN architecture was designed to extract relevant features from sequential data. It consists of one 1D convolutional layer (Conv1D) with 64 filters, a kernel size of 3, and the ReLU activation function, followed by a MaxPooling1D layer with a pool size of 2. The data is then flattened into a one-dimensional vector using a Flatten layer, passed through a fully connected (Dense) layer with 50 neurons and ReLU activation, and finally processed by an output (Dense) layer with 2 neurons (for 'Suitable' and 'Unsuitable' classes) using the Softmax activation function.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eLong Short-Term Memory (LSTM) Model: The LSTM architecture was designed to capture temporal dependencies in the data. It includes one LSTM layer with 50 units, followed directly by an output (Dense) layer with 2 neurons and the Softmax activation function for classification.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003cspan\u003e\u003cli\u003e\u003cp\u003eHybrid CNN-LSTM Model: This model combines the strengths of CNN and LSTM architectures. It begins with a 1D convolutional layer (Conv1D) with 64 filters, a kernel size of 3, and ReLU activation, followed by a MaxPooling1D layer with a pool size of 2. The extracted features are then fed into an LSTM layer with 50 units to capture temporal patterns. Next, a fully connected (Dense) layer with 50 neurons and ReLU activation further processes the data before the final output (Dense) layer with 2 neurons and Softmax activation provides the classification result.\u003c/p\u003e\u003c/li\u003e\u003c/span\u003e\u003c/ol\u003e\u003cp\u003e\u003c/p\u003e\u003ch3\u003eClassification Evaluation Metrics\u003c/h3\u003e\u003cp\u003eEvaluating the performance of the classification model is a crucial step to assess the model's ability to categorize data correctly. In this study, the evaluation metrics will be based on the \u003cb\u003econfusion matrix\u003c/b\u003e, which consists of four main elements: \u003cb\u003eTrue Positive (TP)\u003c/b\u003e, \u003cb\u003eTrue Negative (TN)\u003c/b\u003e, \u003cb\u003eFalse Positive (FP)\u003c/b\u003e, and \u003cb\u003eFalse Negative (FN)\u003c/b\u003e. Based on these four elements, the following metrics will be calculated:\u003c/p\u003e\u003cp\u003e\u003cb\u003eAccuracy\u003c/b\u003e measures the proportion of correctly classified instances overall.\u003c/p\u003e\u003cdiv id=\"Equa\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equa\" name=\"EquationSource\"\u003e\n$$\\:accuration=\\:\\frac{TP+TN}{TP+TN+FP+FN}$$\u003c/div\u003e\u003c/div\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003ePrecision\u003c/b\u003e measures the accuracy of positive predictions.\u003c/p\u003e\u003cdiv id=\"Equb\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equb\" name=\"EquationSource\"\u003e\n$$\\:precission=\\:\\frac{TP}{TP+FP}$$\u003c/div\u003e\u003c/div\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eRecall\u003c/b\u003e (or Sensitivity) measures the model's ability to identify all actual positives.\u003c/p\u003e\u003cdiv id=\"Equc\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equc\" name=\"EquationSource\"\u003e\n$$\\:recall=\\:\\frac{TP}{TP+FN}$$\u003c/div\u003e\u003c/div\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eF1-Score\u003c/b\u003e is the harmonic mean of Precision and Recall, providing a single score that balances both metrics.\u003c/p\u003e\u003cdiv id=\"Equd\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equd\" name=\"EquationSource\"\u003e\n$$\\:F1-score=2\\:x\\:\\:\\frac{precission\\:x\\:recall}{precission+recall}$$\u003c/div\u003e\u003c/div\u003e"},{"header":"Results","content":"\u003cp\u003eExploratory Data Analysis (EDA)\u003c/p\u003e\u003cp\u003eAn initial Exploratory Data Analysis (EDA) was performed to understand the distribution of the target variable, which is the water quality classification. Figure\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e illustrates the distribution of samples between the \"Suitable\u0026rdquo; and \"Unsuitable\u0026rdquo; classes. The analysis reveals a significant class imbalance within the dataset. The \"Suitable\" class, represented by the green bar, constitutes the vast majority of the samples, with a count exceeding 20,000. In stark contrast, the \"Unsuitable\" class, represented by the red bar, is substantially smaller, with a sample count of approximately 2,000.\u003c/p\u003e\u003cp\u003eThis imbalance is a critical finding, as it has direct implications for model training and evaluation. A model trained on such a skewed dataset may develop a strong bias towards predicting the majority class (\"Suitable\") and struggle to accurately identify the minority class (\"Unsuitable\"). This bias explains the challenges observed in the confusion matrices, particularly the low recall for the \"Unsuitable\" class, as the models have had far less data from which to learn its defining characteristics. Consequently, any evaluation of model performance must take this inherent data imbalance into account.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eAn analysis of the feature correlation matrix, as we can see in Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e, reveals several scientifically consistent relationships between the water quality parameters. The most prominent finding is a very strong positive correlation of 0.88 between Salinity and Specific Conductance, which is expected as higher salt content increases electrical conductivity. Other significant positive correlations were observed between Dissolved Oxygen and its saturation percentage (0.74), and a moderate link between Turbidity and Chlorophyll (0.44). Conversely, the matrix shows moderate negative correlations, most notably between Temperature and Dissolved Oxygen (-0.35), aligning with the principle that warmer water holds less dissolved gas. Additionally, Turbidity was negatively correlated with both Salinity (-0.53) and Specific Conductance (-0.54), suggesting that events like freshwater runoff can increase turbidity while simultaneously lowering salinity. These interdependencies are fundamental to understanding the dataset's structure and are influential in the performance of the predictive models.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eA time-series analysis of key water quality parameters from August 2023 to April 2024, as we can see in Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e, reveals the dynamic and complex nature of the aquatic environment. The temperature plot clearly illustrates a seasonal warming trend, consistent with the transition from winter to summer, overlaid with daily fluctuations. In contrast, pH levels remain largely stable within a narrow range of 7.8 to 8.2, suggesting a well-buffered system, though occasional sharp spikes indicate specific disruptive events. Dissolved Oxygen exhibits high volatility with rapid, significant oscillations, reflecting the constant interplay of biological and physical processes without a discernible long-term trend. Finally, the Turbidity data is characterized by a baseline of low values punctuated by frequent, sharp spikes, which are indicative of episodic events such as heavy rainfall or sediment disturbance. Collectively, these temporal patterns, from seasonal cycles to sudden spikes, highlight the necessity of using models capable of capturing complex time-dependent relationships.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eFigure \u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003e shows the water properties distribution data. The Temperature histogram shows a bimodal distribution, with a primary peak around 26\u0026deg;C and a smaller, secondary peak near 21\u0026deg;C, indicating two common temperature ranges in the dataset. The pH distribution is left-skewed and unimodal, with a strong central tendency around 8.0, suggesting that the water is consistently slightly alkaline. Similarly, Dissolved Oxygen is also left-skewed, with the majority of readings concentrated between 6.5 and 7.5 mg/L. In contrast, the distributions for Turbidity and Chlorophyll are both strongly right-skewed, meaning that while most of their values are low (concentrated near 1\u0026ndash;2 NTU for Turbidity and 1\u0026ndash;3 units for Chlorophyll), there are occasional high-value outliers that extend the tail to the right. Finally, the Salinity distribution is largely unimodal and slightly left-skewed, with a prominent peak around 34 PSU, indicating consistently high salinity with less frequent, lower-salinity events.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\n\u003ch3\u003eEvaluation of Model Performance (CNN, LSTM, and Hybrid CNN-LSTM) Using Confusion Matrix Metrics\u003c/h3\u003e\n\u003cp\u003eThe confusion matrix for the CNN model in Fig.\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003e reveals a high overall accuracy, correctly classifying 4,295 \"Suitable\" instances as True Positives and 219 \"Unsuitable\" instances as True Negatives. While the model demonstrates exceptional strength in identifying suitable water quality, with a recall of 99.2% for the \"Layak\" class, its performance on the \"Unsuitable\" class is a significant concern. The model incorrectly classified 169 \"Unsuitable\" instances as \"Suitable\" (False Positives), resulting in a low recall of only 56.4% for the unsuitable category. This indicates a critical weakness where the model has a strong tendency to misclassify unsafe water as safe, posing a considerable risk in a practical application.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eSimilarly, the confusion matrix for the LSTM model in Fig.\u0026nbsp;\u003cspan refid=\"Fig7\" class=\"InternalRef\"\u003e7\u003c/span\u003e shows a strong, yet distinct, performance profile. The model correctly identified 4,282 \"Suitable\u0026rdquo; instances and 223 \"Unsuitable\u0026rdquo; instances. When compared to the CNN, the LSTM model shows a slight improvement in identifying unsuitable cases, reducing the number of critical False Positives from 169 to 165. This results in a marginally better recall of 57.5% for the \"Unsuitable\" class. However, this improvement comes at a small trade-off, as the LSTM model misclassified more suitable cases as unsuitable, with the number of False Negatives increasing from 36 to 49. While both models exhibit high overall accuracy, the LSTM model demonstrates a slightly more balanced, albeit still imperfect, ability to distinguish between the two classes.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eThe Hybrid CNN-LSTM model in Fig.\u0026nbsp;\u003cspan refid=\"Fig8\" class=\"InternalRef\"\u003e8\u003c/span\u003e presents the most balanced performance among the three architectures. It correctly identifies 4,272 \"Suitable\u0026rdquo; instances and achieves the highest number of correct \"Unsuitable\u0026rdquo; classifications with 236 True Negatives. This model significantly reduces the critical False Positives to 152, the lowest of all models, resulting in the best recall for the \"Unsuitable\" class at 60.8%. While this improvement in identifying unsuitable water is a major advantage, it is accompanied by the highest number of False Negatives (59), where suitable water is incorrectly flagged as unsuitable. This suggests that while the hybrid model is the most effective at its primary safety task identifying unsafe water it does so with a slightly more conservative approach, leading to a higher rate of caution.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\n\u003ch3\u003eComparative Analysis of Accuracy Graphs for CNN, LSTM, and Hybrid CNN-LSTM Models\u003c/h3\u003e\n\u003cp\u003eBased on a comparative analysis of the model accuracy in Fig.\u0026nbsp;\u003cspan refid=\"Fig9\" class=\"InternalRef\"\u003e9\u003c/span\u003e and Table\u0026nbsp;\u003cspan refid=\"Tab1\" class=\"InternalRef\"\u003e1\u003c/span\u003e, it is concluded that each model exhibited distinct performance patterns throughout the training process. The CNN model, represented by the blue line, demonstrated an increase in training accuracy, reaching a peak of approximately 96% at the 25th epoch. Although its validation accuracy also improved, the more significant fluctuations and the emerging divergence between the training and validation curves after the 15th epoch suggest slight overfitting.\u003c/p\u003e\u003cp\u003eA similar trend was observed with the LSTM model, depicted by the red line, where training accuracy reached about 95% at the 20th epoch. The LSTM's validation curve also showed fluctuations comparable to the CNN's and tended to stabilise in the 94\u0026ndash;95% range, implying a similar potential for overfitting. In contrast, the Hybrid CNN-LSTM model, represented by the green line, stood out with superior performance. Its training and validation accuracy curves displayed the most significant, consistent, and stable improvement among the three models, with training accuracy exceeding 97% and validation accuracy continuing to increase. This performance indicates that the hybrid model not only possesses the highest accuracy but also has the best generalisation capability and is the least susceptible to overfitting during the training process.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab1\" border=\"1\"\u003e\u003ccaption language=\"En\"\u003e\u003cdiv class=\"CaptionNumber\"\u003eTable 1\u003c/div\u003e\u003cdiv class=\"CaptionContent\"\u003e\u003cp\u003ePerformance Comparison of Classification Models\u003c/p\u003e\u003c/div\u003e\u003c/caption\u003e\u003ccolgroup cols=\"5\"\u003e\u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e\u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e\u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e\u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c4\" colnum=\"4\"\u003e\u003c/div\u003e\u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c5\" colnum=\"5\"\u003e\u003c/div\u003e\u003cthead\u003e\u003ctr\u003e\u003cth align=\"left\" colname=\"c1\"\u003e\u003cp\u003eModel\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c2\"\u003e\u003cp\u003eAccuracy (%)\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c3\"\u003e\u003cp\u003ePrecision (%)\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c4\"\u003e\u003cp\u003eRecall (%)\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c5\"\u003e\u003cp\u003eF1-Score (%)\u003c/p\u003e\u003c/th\u003e\u003c/tr\u003e\u003c/thead\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eCNN\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e\u003cp\u003e94.5\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e94.6\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e\u003cp\u003e94.5\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e\u003cp\u003e94.5\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eLSTM\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e\u003cp\u003e95.8\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e95.8\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e\u003cp\u003e95.8\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e\u003cp\u003e95.8\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eHybrid CNN-LSTM\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c2\"\u003e\u003cp\u003e97.1\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e97.1\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c4\"\u003e\u003cp\u003e97.0\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c5\"\u003e\u003cp\u003e97.0\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/colgroup\u003e\u003c/table\u003e\u003c/div\u003e\u003c/p\u003e"},{"header":"Discussion","content":"\u003cp\u003eThis study aimed to evaluate the performance of CNN, LSTM, and a hybrid CNN-LSTM model for water quality classification. Our findings indicate that the hybrid CNN-LSTM model delivers the most robust and balanced performance, outperforming the individual CNN and LSTM models across all key evaluation metrics.\u003c/p\u003e\u003cdiv id=\"Sec12\" class=\"Section2\"\u003e\u003ch2\u003eInterpretation of Findings\u003c/h2\u003e\u003cp\u003eThe superiority of the hybrid CNN-LSTM model can be attributed to its architectural synergy, which leverages the complementary strengths of both components. The initial CNN layer acts as a powerful feature extractor, adept at identifying short-term, local patterns and anomalies within the multivariate time-series data, such as a sudden spike in turbidity or abrupt changes in pollutant concentrations (\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e). These extracted spatial or localised features are then passed to the LSTM layer, which excels at capturing long-term temporal dependencies and sequential patterns, such as the gradual seasonal drift in water temperature or persistent trends in dissolved oxygen levels (\u003cspan citationid=\"CR27\" class=\"CitationRef\"\u003e27\u003c/span\u003e, \u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThis combination enables the hybrid model to learn a richer, more comprehensive representation of data dynamics than either model could achieve alone. For instance, standalone CNNs, while effective at detecting sharp, localised events (e.g., sudden pollution spikes), often struggle to contextualise these anomalies within longer-term trends (Zhai et al., 2023; Shao, 2025). Conversely, standalone LSTMs, though proficient in modelling temporal sequences, may lack the precision to identify abrupt, short-lived anomalies due to their focus on sequential dependencies (\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eEmpirical studies across diverse domains, including environmental monitoring, time-series forecasting, and anomaly detection demonstrate that hybrid CNN-LSTM models consistently outperform their standalone counterparts, achieving up to 24% higher accuracy in tasks requiring both spatial feature extraction and temporal pattern recognition (\u003cspan citationid=\"CR29\" class=\"CitationRef\"\u003e29\u003c/span\u003e, \u003cspan citationid=\"CR30\" class=\"CitationRef\"\u003e30\u003c/span\u003e). This architectural synergy not only enhances predictive performance but also improves robustness, making the hybrid model particularly effective for complex, real-world applications such as water quality monitoring and pollution early warning systems.\u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"Sec13\" class=\"Section2\"\u003e\u003ch2\u003eComparison with Existing Literature\u003c/h2\u003e\u003cp\u003eThese results align with a growing body of research highlighting the advantages of hybrid deep learning models for time-series forecasting and classification (\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e, \u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e). Recent studies have demonstrated that hybrid architectures such as CNN-LSTM and TCN-BiLSTM consistently outperform standalone models by 10\u0026ndash;23% in error reduction while achieving higher F1-scores, particularly in complex or imbalanced datasets (\u003cspan citationid=\"CR31\" class=\"CitationRef\"\u003e31\u003c/span\u003e, \u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e). Our work extends these findings by demonstrating the hybrid model's effectiveness in the specific context of water quality classification, where spatial-temporal dependencies (e.g., sudden pollutant spikes and gradual seasonal trends) must be jointly modelled for accurate detection (\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e, \u003cspan citationid=\"CR33\" class=\"CitationRef\"\u003e33\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eWhile individual models (CNN or LSTM alone) still achieved high accuracy, their slightly lower F1-scores point to a trade-off between precision and recall a common issue in imbalanced classification tasks that the hybrid model mitigated more effectively. This aligns with broader observations that hybrid models balance precision and recall by combining CNN\u0026rsquo;s local feature extraction (e.g., abrupt turbidity changes) with LSTM\u0026rsquo;s sequential modelling (e.g., long-term nutrient accumulation patterns). For instance, in malware detection and sentiment analysis, hybrid CNN-LSTM models improved F1-scores by 16\u0026ndash;24% over standalone models by leveraging this complementary strength. Our results further validate that hybrid architectures are particularly adept at handling imbalanced environmental datasets, where minority-class events (e.g., pollution anomalies) require both granular detection and contextual temporal awareness.\u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"Sec14\" class=\"Section2\"\u003e\u003ch2\u003eImplications of the Research\u003c/h2\u003e\u003cp\u003eThe practical implications of these findings are significant for environmental monitoring and public health protection. A reliable and accurate predictive model, such as the proposed hybrid CNN-LSTM, can serve as the core of an automated early warning system for water pollution, building upon successful implementations documented in recent research (Chengfang et al., 2016; Grekov et al., 2019). This would enable environmental agencies and water authorities to move from reactive to proactive management, allowing for timely interventions to protect ecosystems and public health. The hybrid model's ability to simultaneously detect sudden pollution events (through CNN's spatial pattern recognition) and monitor gradual water quality degradation (via LSTM's temporal modelling) mirrors the capabilities of advanced monitoring systems that combine IoT sensors with predictive analytics Water makes up about 70% of the earth\u0026rsquo;s surface and is one of the most important sources vital to sustaining life. Rapid urbanization and industrialization have led to a deterioration of water quality at an alarming rate, resulting in harrowing diseases. Water quality has been conventionally estimated through expensive and time-consuming lab and statistical analyses, which render the contemporary notion of real-time monitoring moot. The alarming consequences of poor water quality necessitate an alternative method, which is quicker and inexpensive. With this motivation, this research explores a series of supervised machine learning algorithms to estimate the water quality index (WQI), which is a singular index to describe the general quality of water, and the water quality class (WQC), which is a distinctive class defined on the basis of the WQI.\u003c/p\u003e\u003cp\u003eThe proposed methodology employs four input parameters, namely, temperature, turbidity, pH and total dissolved solids. Of all the employed algorithms, gradient boosting, with a learning rate of 0.1 and polynomial regression, with a degree of 2, predict the WQI most efficiently, having a mean absolute error (MAE) of 1.9642 and 2.7273, respectively. Whereas multi-layer perceptron (MLP), with a configuration of (\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e, \u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e), classifies the WQC most efficiently, with an accuracy of 0.8507. The proposed methodology achieves reasonable accuracy using a minimal number of parameters to validate the possibility of its use in real time water quality detection systems (\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e, \u003cspan citationid=\"CR34\" class=\"CitationRef\"\u003e34\u003c/span\u003e, \u003cspan citationid=\"CR35\" class=\"CitationRef\"\u003e35\u003c/span\u003e). Theoretically, this study reinforces the principle that combining different neural network architectures tailored to specific data characteristics (i.e., local patterns and temporal sequences) can lead to more powerful and generalizable models. This architectural synergy has been consistently demonstrated across domains, with hybrid models achieving 16\u0026ndash;24% higher accuracy than standalone architectures in comparable time-series forecasting and classification tasks (\u003cspan citationid=\"CR33\" class=\"CitationRef\"\u003e33\u003c/span\u003e). The success of similar hybrid approaches in biosensor-based early warning systems (\u003cspan citationid=\"CR36\" class=\"CitationRef\"\u003e36\u003c/span\u003e) and dynamic pollution simulation models (\u003cspan citationid=\"CR35\" class=\"CitationRef\"\u003e35\u003c/span\u003e) further validates the practical viability of this methodology for environmental applications.\u003c/p\u003e\u003cp\u003eNevertheless, the implementation of this model in a real-world scenario is not without its challenges. Practical constraints that must be considered include the need for adequate computational infrastructure for real-time training and inference, the cost of sensor maintenance to ensure a consistent and accurate data stream, and the necessity of periodically retraining the model to adapt to changing environmental patterns over time. Addressing these challenges will be key to a successful transition from a research prototype to a reliable operational system.\u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"Sec15\" class=\"Section2\"\u003e\u003ch2\u003eLimitations and Future Research\u003c/h2\u003e\u003cp\u003eDespite the promising results, this study has several limitations. First, the model was trained and validated on a dataset from a single geographical location (Brisbane River). Its generalizability to other river systems with different climatic and pollution characteristics needs to be verified. Second, while we identified the class imbalance issue in our EDA, this study did not implement advanced techniques like Synthetic Minority Over-sampling Technique (SMOTE) or class weighting during training. This may explain why the recall for the 'Unsuitable' class, though best in the hybrid model, could still be improved.\u003c/p\u003e\u003cp\u003eFuture research should focus on addressing these limitations. We recommend validating the model's performance on diverse datasets from various global regions. Furthermore, future work should explicitly incorporate techniques to handle class imbalance to further enhance the model's sensitivity to rare pollution events. Finally, exploring more advanced architectures, such as attention-based mechanisms or Transformers, could potentially yield even greater performance improvements.\u003c/p\u003e\u003c/div\u003e"},{"header":"Conclusion","content":"\u003cp\u003eThis study conducted a comprehensive evaluation of CNN, LSTM, and a hybrid CNN-LSTM model for water quality classification using high-frequency sensor data. Our findings conclusively demonstrate that the hybrid CNN-LSTM model provides the most robust and balanced performance, effectively leveraging the spatial feature extraction of CNNs and the temporal dependency modelling of LSTMs. The primary contribution of this work is the empirical validation of this hybrid architecture's superiority in a real-world scenario characterized by significant class imbalance, a common yet critical challenge in environmental monitoring.\u003c/p\u003e\u003cp\u003eBased on the study's limitations, future research should focus on several key areas. First, the model's generalizability should be validated across diverse aquatic environments by training and testing it on datasets from different rivers and lakes. Second, future work should explore the integration of heterogeneous data sources, such as rainfall and land-use data, to create a more contextually aware predictive model. Finally, research efforts should be directed towards optimizing the model for real-time deployment, including exploring techniques like model quantization and pruning to ensure computational efficiency for on-edge devices. Addressing these areas will be crucial for transitioning this promising model from a research concept to a practical tool for global water security.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e\u003cstrong\u003eSignificance Statement\u003c/strong\u003e\u003cstrong\u003e\u0026nbsp;\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe significance of this research lies in its contribution to addressing critical challenges in sustainable water resource management, particularly in identifying the optimal deep learning model for predicting water quality. By comparing Convolutional Neural Network (CNN), Long Short-Term Memory (LSTM), and hybrid CNN-LSTM models, this study fills a key gap in the literature, as previous studies have rarely systematically evaluated these models on high-frequency and imbalanced water quality data. \u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAuthor Contributions\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eYF: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Writing \u0026ndash; Original Draft. MLMA: Conceptualization, Methodology, Software, Data Curation, Writing \u0026ndash; Original Draft. MA: Resources, Writing \u0026ndash; Review \u0026amp; Editing. ARS: Supervision, Project administration, Funding acquisition, Writing \u0026ndash; Review \u0026amp; Editing.\u003cstrong\u003e\u0026nbsp;\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding Statement\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThis research was funded by the Indonesian Ministry of Higher Education, Science, and Technology through the Penelitian Fundamental Scheme 2024.\u003cstrong\u003e\u0026nbsp;\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConflict of Interest\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare that they have no conflict of interest.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eEssamlali I, Nhaila H, El Khaili M. Advances in machine learning and IoT for water quality monitoring: A comprehensive review. Heliyon. 2024 Mar;10(6):e27920. \u003c/li\u003e\n\u003cli\u003eHemdan E, Essa Y, Shouman M, El-Sayed A, Moustafa A. An efficient IoT based smart water quality monitoring system. Multimedia Tools and Applications. 2023 Feb 24;1\u0026ndash;25. \u003c/li\u003e\n\u003cli\u003eSuthiv D, Kanojia A, Sengupta S, Jain R, Saini J. Water Quality Monitoring and Prediction Using IOT and Analytics. 2024 2nd International Conference on Recent Trends in Microelectronics, Automation, Computing and Communications Systems (ICMACC). 2024 Dec 19;490\u0026ndash;5. \u003c/li\u003e\n\u003cli\u003eAhmed U, Mumtaz R, Anwar H, Shah AA, Irfan R, Garc\u0026iacute;a-Nieto J. Efficient Water Quality Prediction Using Supervised Machine Learning. Water. 2019 Oct 24;11(11):2210. \u003c/li\u003e\n\u003cli\u003eDerdour A, Abdo H, Almohamad H, Alodah A, Dughairi AAA, Ghoneim S, et al. Prediction of Groundwater Quality Index Using Classification Techniques in Arid Environments. Sustainability [Internet]. 2023 Jun 16; Available from: https://consensus.app/papers/prediction-of-groundwater-quality-index-using-dughairi-derdour/9baf7c5f70b653f4856db616ffa2cef1/\u003c/li\u003e\n\u003cli\u003eWang X, Wang X, Zhang J, Zhang J, Zhang J, Babovic V, et al. A comprehensive integrated catchment-scale monitoring and modelling approach for facilitating management of water quality. Environ Model Softw [Internet]. 2019 Oct 1;120. Available from: https://consensus.app/papers/a-comprehensive-integrated-catchmentscale-monitoring-wang-babovic/91eec47b4a4c5a5ba573aa3464f496f4/\u003c/li\u003e\n\u003cli\u003eAl-Adhaileh MH, Alsaade FW. Modelling and Prediction of Water Quality by Using Artificial Intelligence. Sustainability. 2021 Apr 12;13:4259. \u003c/li\u003e\n\u003cli\u003eBarzegar R, Aalami M, Adamowski J. Short-term water quality variable prediction using a hybrid CNN\u0026ndash;LSTM deep learning model. Stochastic Environmental Research and Risk Assessment. 2020 Feb 1;34:415\u0026ndash;33. \u003c/li\u003e\n\u003cli\u003eLuo W, Huang L, Shu J, Feng H, Guo W, Xia K, et al. Predicting water quality in municipal water management systems using a hybrid deep learning model. Eng Appl Artif Intell. 2024 Jul 1;133:108420. \u003c/li\u003e\n\u003cli\u003eLi L, Jiang P, Xu H, Lin G, Guo D, Wu H. Water quality prediction based on recurrent neural network and improved evidence theory: a case study of Qiantang River, China. Environmental Science and Pollution Research. 2019 May 15;1\u0026ndash;18. \u003c/li\u003e\n\u003cli\u003eLi Y, Kong B, Yu W, Zhu X. An Attention-Based CNN-LSTM Method for Effluent Wastewater Quality Prediction. Applied Sciences [Internet]. 2023 Jun 10; Available from: https://consensus.app/papers/an-attentionbased-cnnlstm-method-for-effluent-wastewater-yu-zhu/5701b4d3d66b54dd904df95985f28b17/\u003c/li\u003e\n\u003cli\u003eTalukdar S, Shahfahad, Ahmed S, Naikoo M, Rahman A, Mallik S, et al. Predicting lake water quality index with sensitivity-uncertainty analysis using deep learning algorithms. Journal of Cleaner Production [Internet]. 2023 Apr 1; Available from: https://consensus.app/papers/predicting-lake-water-quality-index-with-ramana-shahfahad/fcdbd6dda9565b1f8722cac0baf16aac/\u003c/li\u003e\n\u003cli\u003eLu H, Xin. Hybrid decision tree-based machine learning models for short-term water quality prediction. Chemosphere. 2020 Feb 11;249:126169. \u003c/li\u003e\n\u003cli\u003eBhandary R, Ghosh BK. Credit Card Default Prediction: An Empirical Analysis on Predictive Performance Using Statistical and Machine Learning Methods. Journal of Risk and Financial Management [Internet]. 2025 Jan 9; Available from: https://consensus.app/papers/credit-card-default-prediction-an-empirical-analysis-on-bhandary-ghosh/ea420dd23272524a9e62b41f67c517a1/\u003c/li\u003e\n\u003cli\u003eGrebovic M, Filipović L, Katnic I, Vukotić M, Popović T. Machine learning models for statistical analysis. Int Arab J Inf Technol. 2023 Jan 1;20:505\u0026ndash;14. \u003c/li\u003e\n\u003cli\u003eVuong PH, Phu LH, Van Nguyen TH, Duy LN, Bao PT, Trinh T. A bibliometric literature review of stock price forecasting: From statistical model to deep learning approach. Science Progress [Internet]. 2024 Jan 1;107. Available from: https://consensus.app/papers/a-bibliometric-literature-review-of-stock-price-phu-vuong/d1327f5e74f250f7a0521aaf6398c90a/\u003c/li\u003e\n\u003cli\u003eAlanazi W, Meng D, Pollastri G. Advancements in one-dimensional protein structure prediction using machine learning and deep learning. Computational and Structural Biotechnology Journal. 2025 Apr 1;27:1416\u0026ndash;30. \u003c/li\u003e\n\u003cli\u003eChoi S, Oh M, Park D, Lee B, Lee Y, Jee S, et al. Comparisons of the prediction models for undiagnosed diabetes between machine learning versus traditional statistical methods. Scientific Reports [Internet]. 2023 Aug 11;13. Available from: https://consensus.app/papers/comparisons-of-the-prediction-models-for-undiagnosed-lee-jeon/fff34926e5d357c4aa01acc309ddb194/\u003c/li\u003e\n\u003cli\u003eTorrisi M, Pollastri G, Le Q. Deep learning methods in protein structure prediction. Computational and Structural Biotechnology Journal. 2020 Jan 22;18:1301\u0026ndash;10. \u003c/li\u003e\n\u003cli\u003eHu Z, Zhao Y, Khushi M. A Survey of Forex and Stock Price Prediction Using Deep Learning. Applied System Innovation [Internet]. 2021 Feb 2; Available from: https://consensus.app/papers/a-survey-of-forex-and-stock-price-prediction-using-deep-hu-khushi/32f3e33e365a502fa9cb4e22c4a0447c/\u003c/li\u003e\n\u003cli\u003eSaini A, Singh N, Singh RK, Sachan M. Financial Time Series Prediction on Apple Stocks Using Machine and Deep Learning Models. 2024 International Conference on Electrical, Computer and Energy Technologies (ICECET. 2024 Jul 25;1\u0026ndash;6. \u003c/li\u003e\n\u003cli\u003eJiang W. Applications of deep learning in stock market prediction: recent progress. Expert Syst Appl. 2020 Feb 29;184:115537. \u003c/li\u003e\n\u003cli\u003eBharti R, Khamparia A, Shabaz M, Dhiman G, Pande SD, Singh P. Prediction of Heart Disease Using a Combination of Machine Learning and Deep Learning. Computational Intelligence and Neuroscience [Internet]. 2021 Jul 1;2021. Available from: https://consensus.app/papers/prediction-of-heart-disease-using-a-combination-of-machine-singh-shabaz/a09f9886a0f15ec2bf607296db61eaa6/\u003c/li\u003e\n\u003cli\u003eMakridakis S, Spiliotis E, Assimakopoulos V, Semenoglou AA, Mulder G, Nikolopoulos K. Statistical, machine learning and deep learning forecasting methods: Comparisons and ways forward. Journal of the Operational Research Society. 2022 Sep 5;74:840\u0026ndash;59. \u003c/li\u003e\n\u003cli\u003eZaghloul M, Barakat S, Rezk A. Predicting E-commerce customer satisfaction: Traditional machine learning vs. deep learning approaches. Journal of Retailing and Consumer Services [Internet]. 2024 Jul 1; Available from: https://consensus.app/papers/predicting-ecommerce-customer-satisfaction-traditional-zaghloul-barakat/4b479b1c48a05c958e7388eb4508c626/\u003c/li\u003e\n\u003cli\u003eKim G, Steller M, Olson S. Modeling watershed nutrient concentrations with AutoML. Proceedings of the 10th International Conference on Climate Informatics [Internet]. 2020 Sep 22; Available from: https://consensus.app/papers/modeling-watershed-nutrient-concentrations-with-automl-kim-olson/bb5be9c2268a532abfa08f67de90d78b/\u003c/li\u003e\n\u003cli\u003eVallileka N, Shankar S, Rajkumar G, Relin J, Raj F, Krishnan R, et al. Hybrid CNN-LSTM Model for Enhanced Weather Forecasting: Leveraging Spatial and Temporal Dependencies. 2025 4th International Conference on Sentiment Analysis and Deep Learning (ICSADL). 2025 Feb 18;1188\u0026ndash;95. \u003c/li\u003e\n\u003cli\u003eXu G, Wei H, Wang J, Chen XB, Zhu B. A Local Weighted Linear Regression (LWLR) Ensemble of Surrogate Models Based on Stacking Strategy: Application to Hydrodynamic Response Prediction for Submerged Floating Tunnel (SFT). Applied Ocean Research [Internet]. 2022 Aug 1; Available from: https://consensus.app/papers/a-local-weighted-linear-regression-lwlr-ensemble-of-chen-wei/df51b85b8c3e531f9bcdd40173c2f4b0/\u003c/li\u003e\n\u003cli\u003eTian Y, Liu Q, Ji Y, Dang Q, Sun Y, He X, et al. Prediction of sulfate concentrations in groundwater in areas with complex hydrogeological conditions based on machine learning. Science of The Total Environment. 2024;923:171312. \u003c/li\u003e\n\u003cli\u003eZhu Y. Application of a QPSO-optimized CNN-LSTM model in water quality prediction. Discover Water [Internet]. 2024 Nov 12; Available from: https://consensus.app/papers/application-of-a-qpsooptimized-cnnlstm-model-in-water-zhu/1a4693141f965128b3e3cfdcd7ffe5df/\u003c/li\u003e\n\u003cli\u003eGuo H, Chen Z, Teo FY. Intelligent water quality prediction system with a hybrid CNN\u0026ndash;LSTM model. Water Practice \u0026amp; Technology [Internet]. 2024 Nov 12; Available from: https://consensus.app/papers/intelligent-water-quality-prediction-system-with-a-hybrid-guo-chen/3c9e6c74891b5addb6eb8afb445eccd9/\u003c/li\u003e\n\u003cli\u003eZhang B, Li X, Yu Y, Sun J, Rong M, Chen S. A new ground-motion model to predict horizontal PGA, PGV, and spectral acceleration for small-to-moderate earthquakes in the capital circle region of China. Journal of Asian Earth Sciences. 2023 Nov;257:105853. \u003c/li\u003e\n\u003cli\u003eKim G, Steller M, Olson S. Modeling watershed nutrient concentrations with AutoML. Proceedings of the 10th International Conference on Climate Informatics [Internet]. 2020 Sep 22; Available from: https://consensus.app/papers/modeling-watershed-nutrient-concentrations-with-automl-kim-olson/bb5be9c2268a532abfa08f67de90d78b/\u003c/li\u003e\n\u003cli\u003eDai Z, Liao HY. An On-Line Water Quality Monitoring System for the Reservoirs Based on Android. Advanced Materials Research. 2014 Jun 1;945\u0026ndash;949:2199\u0026ndash;202. \u003c/li\u003e\n\u003cli\u003eSong L, Langfelder P, Horvath S. Random generalized linear model: a highly accurate and interpretable ensemble predictor. BMC Bioinformatics. 2013 Jan 16;14:5\u0026ndash;5. \u003c/li\u003e\n\u003cli\u003eGambardella C, Costa E, Miroglio R, Nugnes R, Giuga M, Castelli F, et al. Early Warning Systems for Marine Monitoring. 2024 IEEE International Workshop on Metrology for the Sea; Learning to Measure Sea Health Parameters (MetroSea). 2024 Oct 14;24\u0026ndash;8. \u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Water Quality Classification, Deep Learning, Hybrid CNN-LSTM, Time-Series Data, Classification Modelling","lastPublishedDoi":"10.21203/rs.3.rs-7444182/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-7444182/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eWater quality monitoring is crucial for protecting public health and ensuring environmental sustainability. This study uses a high-frequency time-series dataset from Brisbane, Australia, to classify water quality as either 'Suitable' or 'Unsuitable' using three deep learning models: CNN, LSTM, and a hybrid CNN-LSTM. To counter the dataset's significant class imbalance, a class weighting strategy was used during training. The models were evaluated using metrics like accuracy, precision, recall, and F1-score. The hybrid CNN-LSTM model outperformed the others, achieving superior and more balanced results with an accuracy of 97.1%, a precision of 97.1%, a recall of 97.0%, and an F1-score of 97.0%. These results demonstrate the hybrid model's enhanced ability to handle complex temporal data and extract relevant features, making it a promising solution for robust, real-time water quality warning systems for water quality management.\u003c/p\u003e","manuscriptTitle":"Evaluation of Deep Learning Model Performance for Water Quality Classification: Comparison of CNN, LSTM, and Hybrid CNN-LSTM","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-09-17 13:25:37","doi":"10.21203/rs.3.rs-7444182/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"d67bdafd-3999-4ccd-b607-9b508c244296","owner":[],"postedDate":"September 17th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-09-25T03:23:30+00:00","versionOfRecord":[],"versionCreatedAt":"2025-09-17 13:25:37","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-7444182","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-7444182","identity":"rs-7444182","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.