Machine Learning Techniques for Modelling the Water Quality of Coastal Lagoons
Abstract
1. Introduction
2. Materials and Methods
2.1. Study Area
2.2. Datasets
- -
- For the variables wind speed and direction, cloud cover, temperature, pressure, and relative humidity, the daily average has been calculated.
- -
- For the variables evaporation, precipitation, and solar radiation, the total daily cumulative sum has been calculated.
2.3. Predictive Models
2.3.1. Ridge Regression
2.3.2. Lasso Regression
2.3.3. Elastic Net
- -
- If α = 1, the model is equivalent to Lasso regression.
- -
- If α = 0, the model is equivalent to Ridge regression.
2.3.4. K-Nearest Neighbours
2.3.5. Random Forest
2.3.6. Extreme Gradient Boosting
2.3.7. Support Vector Regression (SVR) with RBF Kernel
2.4. Standardisation Method
2.5. Training and Test Partition
2.6. Sliding Window Transformation
- -
- For physicochemical variables, the time instants chosen were t and t − 1, corresponding to the day of the prediction (t) and the day of the previous sampling campaign. This represents a delay of approximately 15 days in the case of t − 1.
- -
- For meteorological variables, the time instants chosen were t, t − 1, t − 2, ... and t − 7, which correspond to the day of the forecast (t) and the previous 7 days.
2.7. Experimental Design
2.8. Feature Selection
2.9. Hyperparameter Selection
2.10. Performance Metrics
- -
- RMSE (root mean squared error): It is used to measure the average difference between the values predicted by a model and the actual values (Equation (10)),
- -
- MAE (mean absolute error): Measures the average magnitude of errors without considering their direction (Equation (11)).
- -
- R2 (coefficient of determination): This is a statistical measure that indicates how well a model explains the variability of the data (Equation (12)),
2.11. Wilcoxon Paired Test with Benjamini–Hochberg Adjustment
2.12. Development Environment
3. Results
3.1. Feature Selection
3.2. Model Performance in the Cross-Validation Process (Training)
3.3. Wilcoxon Test
3.4. Model Selection
3.5. Predictions Broken Down by Sampling Points
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
| KNN | K-Nearest Neighbours |
| RF | Random Forest |
| RRF | Regularised Random Forest |
| XGB | Extreme Gradient Boosting |
| SVR-RBF | Support Vector Regression Radial Basis Function |
| RDA | Redundancy Analysis |
Appendix A





References
- Lantz, B. Machine Learning with R; Community experience distilled; Packt Publishing: Birmingham, UK, 2013. [Google Scholar]
- Peng, N. Application of Machine learning techniques in environmental governance: A review. Adv. Eng. Technol. Res. 2023, 7, 528. [Google Scholar] [CrossRef]
- Olawade, D.B.; Wada, O.Z.; Ige, A.O.; Egbewole, B.I.; Olojo, A.; Oladapo, B.I. Artificial intelligence in environmental monitoring: Advancements, challenges, and future directions. Hyg. Environ. Health Adv. 2024, 12, 100114. [Google Scholar] [CrossRef]
- Nishat, M.M.; Khan, M.R.; Ahmed, T.; Hossain, S.; Ahsan, A.; El-Sergany, M.; Shafiquzzaman, M.; Imteaz, M.; Alresheedi, M. Comparative analysis of machine learning models for predicting water quality index in Dhaka’s rivers of Bangladesh. Environ. Sci. Eur. 2025, 37, 31. [Google Scholar] [CrossRef]
- Özüpak, Y.; Alpsalaz, F.; Aslan, E. Air quality forecasting using machine learning: Comparative analysis and ensemble strategies for enhanced prediction. Water Air Soil Pollut. 2025, 236, 464. [Google Scholar] [CrossRef]
- Newton, A.; Icely, J.; Cristina, S.; Brito, A.; Cardoso, A.; Colijn, F.; Riva, S.; Gertz, F.; Hansen, J.; Holmer, M.; et al. An overview of ecological status, vulnerability and future perspectives of European large shallow, semi-enclosed coastal systems, lagoons and transitional waters. Estuar. Coast. Shelf Sci. 2013, 140, 95–122. [Google Scholar] [CrossRef]
- Pérez-Ruzafa, A.; Pérez-Ruzafa, I.M.; Newton, A.; Marcos, C. Coastal lagoons: Environmental variability, ecosystem complexity and goods and services uniformity. In Coastal and Estuaries, the Future; Wolanski, E., Day, J., Elliot, M., Ramesh, R., Eds.; Elsevier: Amsterdam, The Netherlands, 2019; pp. 253–276. [Google Scholar] [CrossRef]
- Fernández-Alías, A.; Marcos, C.; Quispe, J.I.; Sabah, S.; Pérez-Ruzafa, A. Population dynamics and growth in three scyphozoan jellyfishes, and their relationship with environmental conditions in a coastal lagoon. Estuar. Coast. Shelf Sci. 2020, 243, 106901. [Google Scholar] [CrossRef]
- Pérez-Ruzafa, A.; Marcos, C.; Pérez-Ruzafa, I.; Barcala, E.; Hegazi, M.; Quispe, J. Detecting changes resulting from human pressure in a naturally quick changing and heterogeneous environment: Spatial and temporal scales of variability in coastal lagoons. Estuar. Coast. Shelf Sci. 2007, 75, 175–188. [Google Scholar] [CrossRef]
- Cloern, J.; Abreu, P.; Carstensen, J.; Chauvaud, L.; Elmgren, R.; Grall, J.; Greening, H.; Johansson, J.R.; Kahru, M.; Sherwood, E.; et al. Human activities and climate variability drive fast-paced change across the world’s estuarine-coastal ecosystems. Glob. Change Biol. 2015, 22, 513–529. [Google Scholar] [CrossRef]
- Pérez-Ruzafa, A.; Campillo, S.; Fernández-Palacios, J.M.; García-Lacunza, A.; García- Oliva, M.; Ibañez, H.; Navarro-Martínez, P.C.; Pérez-Marcos, M.; Pérez-Ruzafa, I.M.; Quispe-Becerra, J.I.; et al. Long-term dynamic in nutrients, chlorophyll a, and water quality parameters in a coastal lagoon during a process of eutrophication for decades, a sudden break and a relatively rapid recovery. Front. Mar. Sci. 2019, 6, 26. [Google Scholar] [CrossRef]
- Fernández-Alías, A.; Montaño-Barroso, T.; Conde-Caño, M.R.; Manchado-Pérez, S.; López-Galindo, C.; Quispe-Becerra, J.I.; Marcos, C.; Pérez-Ruzafa, A. Nutrient overload promotes the transition from top-down to bottom-up control and triggers dystrophic crises in a mediterranean coastal lagoon. Sci. Total Environ. 2022, 846, 157388. [Google Scholar] [CrossRef]
- Jimeno-Sáez, P.; Senent-Aparicio, J.; Cecilia, J.; Pérez-Sánchez, J. Using machine-learning algorithms for eutrophication modeling: Case study of Mar Menor lagoon (Spain). Int. J. Environ. Res. Public Health 2020, 17, 1189. [Google Scholar] [CrossRef] [PubMed]
- Giménez, J.G.; Granero, A.; Senent-Aparicio, J.; Gómez-Jakobsen, F.; Mercado, J.M.; Blanco-Gómez, P.; Ruiz, J.M.; Cecilia, J.M. Assessment of oceanographic services for the monitoring of highly anthropised coastal lagoons: The Mar Menor case study. Ecol. Inform. 2024, 81, 102554. [Google Scholar] [CrossRef]
- Pérez-Ruzafa, A. Seguimiento y Análisis Predictivo del Estado Ecológico del Ecosistema Lagunar del Mar Menor y Prevención de Impactos. Consejería de Medio Ambiente, Universidades, Investigación y Mar Menor, Región de Murcia, España. 2024. Available online: https://canalmarmenor.carm.es/wp-content/uploads/Informe_final_abril-2023_junio-2024-Seguimiento-Mar-Menor-Angel-Perez-Ruzafa.pdf (accessed on 18 January 2026).
- Béjaoui, B.; Ottaviani, E.; Barelli, E.; Ziadi, B.; Dhib, A.; Lavoie, M.; Gianluca, C.; Turki, S.; Solidoro, C.; Aleya, L. Machine learning predictions of trophic status indicators and plankton dynamic in coastal lagoons. Ecol. Indic. 2018, 95, 765–774. [Google Scholar] [CrossRef]
- Concepcion, R.; Dadios, E.; Bandala, A.; Caçador, I.; Fonseca, V.F.; Duarte, B. Applying limnological feature-based Machine Learning Techniques to chemical state classification in Marine Transitional Systems. Front. Mar. Sci. 2021, 8, 658434. [Google Scholar] [CrossRef]
- Simonetti, I.; Lubello, C.; Cappietti, L. On the use of hydrodynamic modelling and random forest classifiers for the prediction of hypoxia in coastal lagoons. Sci. Total Environ. 2024, 951, 175424. [Google Scholar] [CrossRef]
- Zennaro, F.; Furlan, E.; Canu, D.; Alcazar, L.A.; Rosati, G.; Solidoro, C.; Critto, A. Hypoxia extreme events in a changing climate: Machine learning methods and deterministic simulations for future scenarios development in the Venice lagoon. Mar. Pollut. Bull. 2024, 208, 117028. [Google Scholar] [CrossRef]
- Mauricio, D.C.; Lugon, J.; Merlo, A.; Omai, M.; Gonzalez, P.H.; Guerra, R.; Telles, W.; Brandao, D. Application of Machine-Learning techniques for Water Quality Assessment in Coastal Environments: A case study of the Jacarepaguá Lagoon system at Rio de Janeiro/BR. In Computational Science and Its Applications—ICCSA 2025; PT III; Springer: Cham, Switzerland, 2025; Volume 15650, pp. 295–306. [Google Scholar] [CrossRef]
- Gómez, D.; Salvador, P.; Sanz, J.; Casanova, J.L. A new approach to monitor water quality in the Menor sea (Spain) using satellite data and machine learning methods. Environ. Pollut. 2021, 286, 117489. [Google Scholar] [CrossRef]
- Medina-López, E.; Navarro, G.; Santos-Echeandía, J.; Bernárdez, P.; Caballero, I. Machine Learning for Detection of Macroalgal Blooms in the Mar Menor Coastal Lagoon Using Sentinel-2. Remote Sens. 2023, 15, 1208. [Google Scholar] [CrossRef]
- Cisterna-García, A.; González-Vidal, A.; Martínez-Ibarra, A.; Ye, Y.; Guillén-Teruel, A.; Bernal-Escobedo, L.; Skarmeta, A.F. Artificial intelligence for streamflow prediction in river basins: A use case in Mar Menor. Sci. Rep. 2025, 15, 19481. [Google Scholar] [CrossRef]
- López-Andreu, F.J.; López-Morales, J.A.; Hernández-Guillén, Z.; Carrero-Rodrigo, J.A.; Sánchez-Alcaraz, M.; Atenza-Juárez, J.F.; Erena, M. Deep Learning-Based Time Series Forecasting Models Evaluation for the Forecast of Chlorophyll a and Dissolved Oxygen in the Mar Menor. J. Mar. Sci. Eng. 2023, 11, 1473. [Google Scholar] [CrossRef]
- González-Enrique, J.; Rodríguez-García, M.I.; Ruiz-Aguilar, J.J.; Carrasco-García, M.G.; Enguix, I.F.; Turias, I.J. Chlorophyll-α forecasting using LSTM, bidirectional LSTM and GRU networks in El Mar Menor (Spain). Log. J. IGPL 2015, 33, jzae046. [Google Scholar] [CrossRef]
- Delnevo, G.; Tumedei, G.; Ghini, V.; Prandi, C. Toward a Digital Twin: Combining sensing, machine learning, and data visualization for the effective management of a coastal lagoon environment. In Proceedings of the IEEE 21st Consumer Communications & Networking Conference (CCNC), Las Vegas, NV, USA, 6–9 January 2024. [Google Scholar] [CrossRef]
- Ye, Y.; González-Vidal, A.; Cisterna-García, A.; Pérez-Ruzafa, A.; Zamora Izquierdo, M.A.; Skarmeta, A.F. Advancing towards a marine digital twin platform: Modeling the Mar Menor coastal lagoon ecosystem in the south western Mediterranean. Future Gener. Comput. Syst. 2026, 178, 108265. [Google Scholar] [CrossRef]
- Perez-Ruzafa, A.; Marcos, C.; Ros, J. Environmental and biological changes related to recent human activities in the Mar Menor (SE of Spain). Mar. Pollut. Bull. 1991, 23, 747–751. [Google Scholar] [CrossRef]
- Perez-Ruzafa, A.; Fernández, A.I.; Marcos, C.; Gilabert, J.; Quispe, J.I.; García-Charton, J.A. Spatial and temporal variations of hydrological conditions, nutrients and chlorophyll a in a mediterranean coastal lagoon (Mar Menor, Spain). Hydrobiologia 2005, 550, 11–27. [Google Scholar] [CrossRef]
- García-Oliva, M.; Pérez-Ruzafa, A.; Umgiesser, G.; McKiver, W.; Ghezzo, M.; De Pascalis, F.; Marcos, C. Assessing the Hydrodynamic Response of the Mar Menor Lagoon to Dredging Inlets Interventions through Numerical Modelling. Water 2018, 10, 959. [Google Scholar] [CrossRef]
- Hoerl, A.E.; Kennard, R.W. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics 1970, 12, 55–67. [Google Scholar] [CrossRef]
- Tibshirani, R. Regression shrinkage and selection via the lasso. J. R. Stat. Soc. Ser. B (Methodol.) 1996, 58, 267–288. [Google Scholar] [CrossRef]
- Zou, H.; Hastie, T. Regularization and Variable Selection Via the Elastic Net. J. R. Stat. Soc. Ser. B Stat. Methodol. 2005, 67, 301–320. [Google Scholar] [CrossRef]
- Cover, T.M.; Hart, P.E. Nearest neighbor pattern classification. IEEE Trans. Inf. Theory 1967, 13, 21–27. [Google Scholar] [CrossRef]
- Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef]
- Deng, H.; Runger, G.C. Feature selection via regularized trees. In The 2012 International Joint Conference on Neural Networks (IJCNN); IEEE: Piscataway, NJ, USA, 2012; pp. 1–8. [Google Scholar] [CrossRef]
- Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In KDD’16: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining; Association for Computing Machinery: New York, NY, USA, 2016; pp. 785–794. [Google Scholar] [CrossRef]
- Drucker, H.; Burges, C.J.C.; Kaufman, L.; Smola, A.; Vapnik, V. Support vector regression machines. Adv. Neural Inf. Process. Syst. 1997, 28, 779–784. [Google Scholar]
- Guyon, I.; Weston, J.; Barnhill, S.; Vapnik, V. Gene selection for cancer classification using support vector machines. Mach. Learn. 2002, 46, 389–422. [Google Scholar] [CrossRef]
- Hodson, T.O. Root-mean-square error (RMSE) or mean absolute error (MAE): When to use them or not. Geosci. Model Dev. 2022, 15, 5481–5487. [Google Scholar] [CrossRef]
- Wilcoxon, F. Individual comparisons by ranking methods. Biom. Bull. 1945, 1, 80–83. [Google Scholar] [CrossRef]
- Benjamini, Y.; Hochberg, Y. Controlling the false discovery rate: A practical and powerful approach to multiple testing. J. R. Stat. Soc. Ser. B (Methodol.) 1995, 57, 289–300. [Google Scholar] [CrossRef]
- Wickham, H.; Bryan, J. readxl: Read Excel Files, R package version 1.4.3; The Comprehensive R Archive Network: Boston, MA, USA, 2023. [Google Scholar]
- Wickham, H.; François, R.; Henry, L.; Müller, K.; Vaughan, D. dplyr: A Grammar of Data Manipulation, R package version 1.1.4; The Comprehensive R Archive Network: Boston, MA, USA, 2023. [Google Scholar]
- Wickham, H. ggplot2: Elegant Graphics for Data Analysis; Springer: New York, NY, USA, 2016. [Google Scholar]
- Kowarik, A.; Templ, M. Imputation with the R package VIM. J. Stat. Softw. 2016, 74, 1–16. [Google Scholar] [CrossRef]
- Kuhn, M. caret: Classification and Regression Training, R package version 6.0-93; The Comprehensive R Archive Network: Boston, MA, USA, 2022. [Google Scholar]
- Chang, W.; Cheng, J.; Allaire, J.; Sievert, C.; Schloerke, B.; Xie, Y.; Allen, J.; McPherson, J.; Dipert, A.; Borges, B. Shiny: Web Application Framework for R, R package version 1.7.4.1; The Comprehensive R Archive Network: Boston, MA, USA, 2023. [Google Scholar]
- Bergmeir, C.; Benítez, J.M. On the use of cross-validation for time series predictor evaluation. Inf. Sci. 2012, 191, 192–213. [Google Scholar] [CrossRef]
- Liang, W.; Liu, T.; Wang, Y.; Jiao, J.J.; Gan, J.; He, D. Spatiotemporal-aware machine learning approaches for dissolved oxygen prediction in coastal waters. Sci. Total Environ. 2023, 905, 167138. [Google Scholar] [CrossRef]
- Giménez, J.G.; González, M.; Martínez-España, R.; Cecilia, J.M.; López-Espín, J.J. Enhancing shallow water quality monitoring efficiency with deep learning and remote sensing: A case study in Mar Menor. J. Ambient. Intell. Smart Environ. 2024, 17, 182–197. [Google Scholar] [CrossRef]
- Valera, M.; Walter, R.K.; Bailey, B.A.; Castillo, J.E. Machine learning based predictions of dissolved oxygen in a small coastal embayment. J. Mar. Sci. Eng. 2020, 8, 1007. [Google Scholar] [CrossRef]
- Taşan, M. Improved prediction of groundwater quality index by hybrid machine learning models in a coastal region: A case study from southern Turkey. Int. J. Environ. Res. 2025, 19, 147. [Google Scholar] [CrossRef]
- Ahmad, H.; Dash, P.; Panda, R.M.; Muduli, P.R. Integrating machine learning and remote sensing for long-term monitoring of chlorophyll-a in Chilika Lagoon, India. Environ. Monit. Assess. 2025, 197, 98. [Google Scholar] [CrossRef]





| Zones | Sectors | Sampling Points |
|---|---|---|
| Zone 1 (North Zone) | Sector 1 | E01, E02 |
| Sector 2 | E19, E20, EN1 | |
| Zone 2 (East Zone) | Sector 3 | E04, E05, E5b |
| Sector 4 | E08, E09, E9b | |
| Zone 3 (Central Zone) | Sector 5 | E03, E06 |
| Sector 6 | E07, E10 | |
| Zone 4 (West Zone) | Sector 7 | E17, E18, ES1 |
| Sector 8 | E15, E16 | |
| Zone 5 (South Zone) | Sector 9 | E11, E12, E12b |
| Sector 10 | E13, E14, MA1 |
| Variable | Brief Description | Units |
|---|---|---|
| Latitude | Sampling point latitude | UTM |
| Longitude | Sampling point longitude | UTM |
| Max_Depth | Maximum depth at sampling point | m |
| Nitrate | Molar concentration of nitrate | µmol NO3/L |
| Nitrite | Molar concentration of nitrite | µmol NO2/L |
| Ammonium | Molar concentration of ammonium | µmol NH4/L |
| Phosphate | Molar concentration of phosphate | µmol PO4/L |
| Silicate | Molar concentration of silicate | µmol SiO2/L |
| Chlorophyll_a Surf | Laboratory chlorophyll a in surface water | µg/L |
| Temperature_Surf | Surface-water temperature | °C |
| Salinity_Surf | Surface-water salinity | ppt |
| Turbidity_Surf | Surface-water turbidity | NTU |
| DO (%) Surf | Dissolved-oxygen saturation at surface | % |
| DO (mg/L) Surf | Dissolved-oxygen concentration at surface | mg/L |
| Suspended_Material | Suspended solids | g/L |
| pH_Surf | Surface-water pH | – |
| fDOM_Surf | Fluorescent dissolved organic matter (surface) | ppb |
| BGA_PE_Surf | Phycocyanin equivalent of cyanobacteria (surface) | µg/L |
| Chlorophyll_a Bottom | Probe chlorophyll a at bottom | µg/L |
| Temperature_Bottom | Bottom-water temperature | °C |
| Salinity_Bottom | Bottom-water salinity | ppt |
| Turbidity_Bottom | Bottom-water turbidity | NTU |
| DO (%) Bottom | Dissolved-oxygen saturation at bottom | % |
| DO (mg/L) Bottom | Dissolved-oxygen concentration at bottom | mg/L |
| pH_Bottom | Bottom-water pH | – |
| fDOM_Bottom | Fluorescent dissolved organic matter (bottom) | ppb |
| BGA_PE_Bottom | Phycocyanin equivalent of cyanobacteria (bottom) | µg/L |
| Visibility | Secchi-disc visibility | % |
| DIN | Dissolved inorganic nitrogen (NO3+NO2+NH4) | µmol/L |
| TRIX | Trophic status index | – |
| N/P | DIN / phosphate ratio | – |
| WindSpeed_Avg | Daily mean wind speed | m/s |
| WindDirection_Avg | Daily mean wind direction | ° |
| Evaporation_DailySum | Daily cumulative evaporation | mm |
| SolarRadiation_DailySum | Daily cumulative global radiation | Wm−2 |
| Precipitation_DailySum | Daily cumulative precipitation | mm |
| CloudCover_Avg | Daily mean cloud cover | 0–1 |
| Temperature_Avg | Daily mean air temperature | °C |
| Pressure_Avg | Daily mean air pressure | mbar |
| Humidity_Avg | Daily mean relative humidity | % |
| Model | Hyperparameters | Value Range |
|---|---|---|
| Ridge | α | 0 |
| λ | seq (0.001, 1, length = 100) | |
| Lasso | α | 1 |
| λ | seq (0.001, 1, length = 100) | |
| Elastic Net | α | seq (0, 1, length = 20) |
| λ | seq (0.001, 1, length = 100) | |
| KNN | k | seq (4, 15, by = 1) |
| Random Forest | mtry | It depends on the number of features. |
| min.node.size | {3, 4, 5, 8, 12} | |
| splitrule | {extratrees, variance} | |
| Regularised Random Forest | mtry | It depends on the number of features. |
| coefReg | {0.05, 0.1, 0.25, 0.5} | |
| coefImp | {0.05, 0.1, 0.25, 0.5} | |
| XGBoost | nrounds | {100, 500, 1000, 1500} |
| max_depth | {2, 3, 4} | |
| eta | {0.005, 0.01, 0.05, 0.1} | |
| gamma | {0.5, 1, 2} | |
| colsample_bytree | 1 | |
| min_child_weight | {1, 3, 6} | |
| subsample | 1 | |
| SVR-RBF | sigma | {0.01, 0.05, 0.1, 0.25, 0.5, 1, 1.5, 2, 3} |
| C | exp(seq(log(0.1), log(10), length = 15)) |
| Model | Packages |
|---|---|
| Ridge | glmnet (Version 4.1-4) |
| Lasso | glmnet (Version 4.1-4) |
| Elastic Net | glmnet (Version 4.1-4) |
| Random Forest | e1071 (Version 1.7-12), ranger (Version 0.13.1) |
| Regularised Random Forest | randomForest (Version 4.7-1), RRF (Version 1.9.4.1) |
| Extreme Gradient Boosting | xgboost (Version 7.7.1) |
| SVR_RBF | kernlab (Version 0.9-32) |
| Experiment L0–L7 | Experiment L1–L7 | |
|---|---|---|
| Ridge | 67 | 86 |
| Lasso | 69 | 86 |
| Elastic Net | 70 | 90 |
| Random Forest | 45 | 41 |
| Regularised Random Forest | 45 | 41 |
| Extreme Gradient Boosting | 82 | 92 |
| SVR-RBF | 95 | 96 |
| Rid L0 | Rid L1 | Las L0 | Las L1 | ENET L0 | ENET L1 | KNN L0 | KNN L1 | RF L0 | RF L1 | XGB L0 | XGB L1 | SVR L0 | SVR L1 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Latitude | X | X | X | X | X | X | X | |||||||
| Longitude | X | X | X | X | X | X | ||||||||
| Max_Depth | X | X | X | X | X | X | X | |||||||
| Nitrate | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Nitrite | X | X | X | X | X | X | X | X | ||||||
| Ammonium | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Phosphate | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Silicate | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Chlorophyll_Surf | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Temperature_Surf | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Salinity_Surf | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Turbidity_Surf | X | X | X | X | ||||||||||
| Suspended_Material | X | X | X | X | X | X | X | X | X | X | X | X | ||
| pH_Surf | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| fDOM_Surf | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| BGA_PE_Surf | X | X | X | X | X | X | X | X | ||||||
| Temperature_Bottom | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Salinity_Bottom | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Turbidity_Bottom | X | X | X | X | X | X | X | X | ||||||
| Chlorophyll_a Bottom | X | X | X | X | X | X | X | X | ||||||
| pH_Bottom | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| fDOM_Bottom | X | X | X | X | X | X | X | X | ||||||
| BGA_PE_Bottom | X | X | X | X | X | X | ||||||||
| Visibility | X | X | X | X | X | X | ||||||||
| TRIX | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| NP | X | X | X | X | X | X | ||||||||
| Nitrate_L1 | X | X | ||||||||||||
| Nitrite_L1 | X | X | X | |||||||||||
| Ammonium_L1 | X | X | X | X | X | X | X | |||||||
| Phosphate_L1 | X | X | ||||||||||||
| Silicate_L1 | X | X | X | X | X | X | X | |||||||
| Chlorophyll_Surf_L1 | X | X | X | X | X | X | ||||||||
| Temperature_Surf_L1 | X | X | X | X | X | X | ||||||||
| Salinity_Surf_L1 | X | X | X | X | X | X | ||||||||
| Turbidity_Surf_L1 | X | X | ||||||||||||
| DO_Surf_Perc_L1 | X | X | X | X | X | X | X | |||||||
| DO_Surf_Conc_L1 | X | X | X | X | X | X | X | |||||||
| Suspended_Material_L1 | X | X | X | X | ||||||||||
| pH_Surf_L1 | X | X | X | |||||||||||
| fDOM_Surf_L1 | X | X | X | X | X | X | ||||||||
| BGA_PE_Surf_L1 | X | X | X | X | X | X | X | |||||||
| Chlorophyll_a Bottom_L1 | X | X | X | |||||||||||
| Temperature_Bottom_L1 | X | X | X | X | X | X | X | |||||||
| Salinity_Bottom_L1 | X | X | X | X | X | X | ||||||||
| Turbidity_Bottom_L1 | X | |||||||||||||
| pH_Bottom_L1 | X | X | X | X | ||||||||||
| fDOM_Bottom_L1 | X | X | X | X | X | X | ||||||||
| BGA_PE_Bottom_L1 | X | X | X | X | X | |||||||||
| Visibility_L1 | X | |||||||||||||
| TRIX_L1 | X | X | X | X | X | X | ||||||||
| NP_L1 | X | X | X |
| Rid L0 | Rid L1 | Las L0 | Las L1 | ENET L0 | ENET L1 | KNN L0 | KNN L1 | RF L0 | RF L1 | XGB L0 | XGB L1 | SVR L0 | SVR L1 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WindSpeed_Avg | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| WindSpeed_Avg_L1 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| WindSpeed_Avg_L2 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| WindSpeed_Avg_L3 | X | X | X | X | X | X | X | X | X | X | ||||
| WindSpeed_Avg_L4 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| WindSpeed_Avg_L5 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| WindSpeed_Avg_L6 | X | X | X | X | X | X | X | X | X | X | ||||
| WindSpeed_Avg_L7 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| WindDirection_Avg | X | X | X | X | X | X | X | X | X | |||||
| WindDirection_Avg_L1 | X | X | X | X | ||||||||||
| WindDirection_Avg_L2 | X | X | X | X | X | X | X | X | X | X | ||||
| WindDirection_Avg_L3 | X | X | X | X | ||||||||||
| WindDirection_Avg_L4 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| WindDirection_Avg_L5 | X | X | X | X | X | X | X | X | X | |||||
| WindDirection_Avg_L6 | X | X | X | X | X | X | X | X | X | X | ||||
| WindDirection_Avg_L7 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Evaporation_DailySum | X | X | X | X | X | X | ||||||||
| Evaporation_DailySum_L1 | X | X | X | X | X | X | X | X | X | |||||
| Evaporation_DailySum_L2 | X | X | X | X | X | X | X | X | X | X | X | |||
| Evaporation_DailySum_L3 | X | X | X | X | X | X | ||||||||
| Evaporation_DailySum_L4 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Evaporation_DailySum_L5 | X | X | X | |||||||||||
| Evaporation_DailySum_L6 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Evaporation_DailySum_L7 | X | X | X | X | X | X | X | X | X | X | X | |||
| SolarRadiation_DailySum | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| SolarRadiation_DailySum_L1 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| SolarRadiation_DailySum_L2 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| SolarRadiation_DailySum_L3 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| SolarRadiation_DailySum_L4 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| SolarRadiation_DailySum_L5 | X | X | X | X | X | X | ||||||||
| SolarRadiation_DailySum_L6 | X | X | X | X | X | X | X | X | X | X | X | |||
| SolarRadiation_DailySum_L7 | X | X | X | X | X | |||||||||
| Precipitation | X | X | X | X | X | X | X | X | X | X | ||||
| Precipitation_L1 | X | X | X | X | X | X | X | X | ||||||
| Precipitation_L2 | X | X | X | X | X | X | X | X | X | X | ||||
| Precipitation_L3 | X | X | X | X | X | X | X | X | X | X | X | |||
| Precipitation_L4 | X | X | X | |||||||||||
| Precipitation_L5 | X | X | X | X | X | X | X | X | X | X | ||||
| Precipitation_L6 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Precipitation_L7 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| CloudCover_Avg | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| CloudCover_Avg_L1 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| CloudCover_Avg_Lag2 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| CloudCover_Avg_Lag3 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| CloudCover_Avg_Lag4 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| CloudCover_Avg_Lag5 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| CloudCover_Avg_Lag6 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| CloudCover_Avg_Lag7 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Temperature_Avg | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Temperature_Avg_Lag1 | X | X | X | X | X | X | X | X | ||||||
| Temperature_Avg_Lag2 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Temperature_Avg_Lag3 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Temperature_Avg_Lag4 | X | X | X | X | X | X | X | X | X | X | X | |||
| Temperature_Avg_Lag5 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Temperature_Avg_Lag6 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Temperature_Avg_Lag7 | X | X | X | X | X | X | X | |||||||
| Pressure_Avg | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Pressure_Avg_Lag1 | X | X | X | X | X | |||||||||
| Pressure_Avg_Lag2 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Pressure_Avg_Lag3 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Pressure_Avg_Lag4 | X | X | X | |||||||||||
| Pressure_Avg_Lag5 | X | X | X | |||||||||||
| Pressure_Avg_Lag6 | X | X | X | X | ||||||||||
| Pressure_Avg_Lag7 | X | X | X | X | X | X | X | X | X | X | ||||
| Humidity_Avg | X | X | X | X | X | X | X | X | X | X | X | |||
| Humidity_Avg_Lag1 | X | X | X | X | X | X | X | X | X | X | X | X | X | |
| Humidity_Avg_Lag2 | X | X | X | X | X | X | X | X | X | |||||
| Humidity_Avg_Lag3 | X | X | X | X | ||||||||||
| Humidity_Avg_Lag4 | X | X | X | X | X | X | X | X | ||||||
| Humidity_Avg_Lag5 | X | X | X | X | X | |||||||||
| Humidity_Avg_Lag6 | X | X | X | X | X | X | X | X | X | X | X | X | ||
| Humidity_Avg_Lag7 | X | X | X | X | X | X | X | X | X | X | X | X |
| Model | RMSE Train | MAE Train | R2 Train | RMSE Test | MAE Test | R2 Test |
|---|---|---|---|---|---|---|
| Ridge | 16.65425 | 9.62368 | 0.645560 | 8.92563 | 6.59818 | −0.07443 |
| Lasso | 17.28573 | 9.95883 | 0.660112 | 9.55324 | 7.11340 | −0.21234 |
| Elastic Net | 6.71401 | 3.67639 | 0.872530 | 10.33911 | 7.68410 | −0.42250 |
| KNN | 10.93026 | 7.32022 | 0.662165 | 9.65278 | 7.28442 | −0.23991 |
| Random Forest | 2.64370 | 1.52023 | 0.980236 | 8.20795 | 5.75857 | 0.10348 |
| Regularised Random Forest | 2.81363 | 1.58929 | 0.977613 | 8.21857 | 5.67905 | 0.10116 |
| Extreme Gradient Boosting | 4.65642 | 3.31297 | 0.938687 | 7.84216 | 5.49376 | 0.18161 |
| SVR-RBF | 5.07542 | 2.99299 | 0.927157 | 9.48748 | 7.30328 | −0.19781 |
| Model | RMSE Train | MAE Train | R2 Train | RMSE Test | MAE Test | R2 Test |
|---|---|---|---|---|---|---|
| Ridge | 17.12909 | 10.16747 | 0.67899 | 8.25736 | 5.85898 | 0.09082 |
| Lasso | 17.72343 | 10.39746 | 0.70233 | 8.62134 | 6.28764 | 0.00228 |
| Elastic Net | 6.72120 | 3.72516 | 0.87225 | 9.68704 | 7.09426 | −0.24873 |
| KNN | 10.15669 | 6.80755 | 0.70829 | 8.83778 | 6.44009 | −0.03937 |
| Random Forest | 2.72321 | 1.57287 | 0.97902 | 7.38217 | 5.00258 | 0.27480 |
| Regularised Random Forest | 2.86690 | 1.62593 | 0.97675 | 7.54391 | 5.13850 | 0.24267 |
| Extreme Gradient Boosting | 4.39343 | 3.17899 | 0.94541 | 7.28064 | 5.05803 | 0.29461 |
| SVR-RBF | 4.47354 | 2.68961 | 0.94340 | 8.75286 | 6.70983 | −0.01949 |
| Sampling Point | Model | RMSE Train | MAE Train | R2 Train | RMSE Test | MAE Test | R2 Test |
|---|---|---|---|---|---|---|---|
| E01 (Northern area) | RF | 2.22 | 1.55 | 0.99 | 4.37 | 3.67 | 0.44 |
| RRF | 2.38 | 1.61 | 0.98 | 4.81 | 4.11 | 0.32 | |
| XGB | 4.42 | 3.27 | 0.95 | 3.98 | 3.34 | 0.53 | |
| SVR | 3.79 | 2.69 | 0.96 | 6.11 | 4.97 | −0.10 | |
| E07 (Central area) | RF | 1.33 | 0.93 | 0.99 | 5.11 | 3.94 | 0.38 |
| RRF | 1.41 | 1.01 | 0.98 | 5.42 | 4.16 | 0.31 | |
| XGB | 3.25 | 2.38 | 0.96 | 4.94 | 3.79 | 0.42 | |
| SVR | 2.82 | 1.93 | 0.97 | 6.79 | 5.59 | −0.08 | |
| E5b (Albujón watercourse) | RF | 3.79 | 2.56 | 0.98 | 12.54 | 8.65 | 0.21 |
| RRF | 4.06 | 2.72 | 0.97 | 12.13 | 8.45 | 0.25 | |
| XGB | 6.36 | 4.51 | 0.94 | 13.03 | 8.61 | 0.14 | |
| SVR | 6.48 | 3.38 | 0.93 | 12.04 | 8.52 | 0.27 | |
| E12 (Southern area) | RF | 2.43 | 1.73 | 0.98 | 8.71 | 6.27 | 0.21 |
| RRF | 2.57 | 1.80 | 0.97 | 9.22 | 6.72 | 0.12 | |
| XGB | 4.86 | 3.68 | 0.92 | 8.27 | 6.29 | 0.29 | |
| SVR | 4.21 | 3.04 | 0.94 | 10.80 | 8.23 | −0.20 | |
| EN1 (Encañizada) | RF | 7.73 | 5.13 | 0.79 | 18.23 | 12.31 | 0.07 |
| RRF | 7.83 | 4.99 | 0.77 | 18.71 | 12.43 | 0.03 | |
| XGB | 7.54 | 5.85 | 0.80 | 17.58 | 12.61 | 0.14 | |
| SVR | 10.11 | 6.60 | 0.65 | 16.57 | 11.71 | 0.24 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Lorente-González, J.M.; Palma, J.; Jiménez, F.; Marcos, C.; Pérez-Ruzafa, A. Machine Learning Techniques for Modelling the Water Quality of Coastal Lagoons. Water 2026, 18, 297. https://doi.org/10.3390/w18030297
Lorente-González JM, Palma J, Jiménez F, Marcos C, Pérez-Ruzafa A. Machine Learning Techniques for Modelling the Water Quality of Coastal Lagoons. Water. 2026; 18(3):297. https://doi.org/10.3390/w18030297
Chicago/Turabian StyleLorente-González, Juan Marcos, José Palma, Fernando Jiménez, Concepción Marcos, and Angel Pérez-Ruzafa. 2026. "Machine Learning Techniques for Modelling the Water Quality of Coastal Lagoons" Water 18, no. 3: 297. https://doi.org/10.3390/w18030297
APA StyleLorente-González, J. M., Palma, J., Jiménez, F., Marcos, C., & Pérez-Ruzafa, A. (2026). Machine Learning Techniques for Modelling the Water Quality of Coastal Lagoons. Water, 18(3), 297. https://doi.org/10.3390/w18030297

