Predictive modeling of heavy metal pollution and ecological risk for sustainable water quality management in the NY–NJ harbor system Authors: Md Shahnul Islam, Sara Naveed, Huan Feng, Tapos Kumar Chakraborty Published: 2026 ABSTRACT AbstractEvaluating and forecasting surface water quality is essential for protecting aquatic ecosystems and improving water resource management. This study introduces a novel paradigm that integrates machine learning (ML) with the potential ecological risk index (PERI) to dynamically forecast, rather than statically assess, ecological risks from heavy metal contamination in an urban estuarine environment. Surface water samples from the Lower Passaic River in New Jersey, USA, were analyzed for copper (Cu), lead (Pb), and mercury (Hg) across multiple sites and sampling campaigns. Concentrations ranged from 3.1 to 42.6 µg/L for Cu, 1.8 to 25.4 µg/L for Pb, and 0.12 to 1.36 µg/L for Hg, corresponding to PERI values spanning from 85.7 to 672.3, indicating moderate to very high ecological risk levels. Four ML algorithms, random forest (RF), support vector machine (SVM), extreme gradient boosting (XGBoost), and artificial neural network (ANN), were employed to model PERI based on pollution indices. According to the findings, model performance was ranked as ANN > RF > SVM > XGBoost. The ANN model demonstrated superior performance, achieving the lowest error (MAE = 2.25) with excellent predictive accuracy (a testing R2 of 0.981), and was identified as the most effective model. Variable importance analysis confirmed Hg as the dominant risk driver. This integrated approach demonstrates that coupling ML with ecological risk indices can effectively capture complex, nonlinear relationships between metal concentrations and ecological impact, significantly improving risk forecasting for dynamic urban rivers and providing a mechanistic understanding of the dominant risk drivers. The findings provide a transferable framework for identifying contamination hotspots, guiding remediation efforts, and supporting adaptive management.Graphical Abstract Supplementary InformationThe online version contains supplementary material available at https://doi.org/10.1007/s10661-026-15832-x.Keywords: Heavy metal pollution, Ecological risk modeling, Machine learning, Lower Passaic River, Environmental risk assessment Introduction Surface water systems are fundamental to ecological integrity, economic vitality, and public health. However, accelerated urbanization and industrial expansion have caused widespread degradation of water quality, particularly in densely populated estuarine environments (Chakraborty et al., 2022; Mansor et al., 2023; Riso et al., 1993; Sodré et al., 2012). Among the numerous contaminants, heavy metals such as Hg, Cu, and Pb are of exceptional concern because of their high environmental persistence, strong bioaccumulation potential, and pronounced ecological toxicity (Chakraborty et al., 2023; Lee et al., 2019; Nour & Garoub, 2026; Pandey & Kumari, 2023). These metals enter waterways primarily through industrial effluents, stormwater runoff, and municipal wastewater discharges, and can persist in sediments and the water column for decades, posing chronic risks to aquatic ecosystems and human populations (Acharjee et al., 2026; Mansor et al., 2023; Wiener & Suchanek, 2008). The New York–New Jersey (NY–NJ) Harbor System epitomizes these challenges. Characterized by intense maritime commerce, a legacy of industrialization, and dense urban infrastructure, the estuary exhibits complex hydrodynamic regimes and pronounced environmental heterogeneity that govern contaminant fate and transport (Donovan et al., 2008; Iannuzzi & Ludwig, 2004; Islam et al., 2026; Wenning et al., 1994). Within this system, the Lower Passaic River (LPR) is emblematic of the broader conflict between historical contamination and contemporary restoration. As a tidal tributary directly influencing the larger harbor and a site listed on the U.S. EPA Superfund National Priorities List, the LPR has experienced decades of heavy metal loading while simultaneously being the focus of major dredging and remediation efforts (NOAA, 2007; USEPA, 2023, 2026). Consequently, the LPR and the greater NY–NJ Harbor represent an ideal system for evaluating data-driven approaches to pollution control and ecological restoration in highly urbanized estuarine environments. Determining ecological risk in such an environment remains technically demanding. Conventional statistical and deterministic water quality models often rely on static assumptions and low-resolution datasets that fail to capture the nonlinear interactions and multivariate dependencies among environmental drivers (Abraj et al., 2022; Islam et al., 2025; Laarne et al., 2022). Consequently, these approaches exhibit limited predictive accuracy and poor generalizability when confronted with the pronounced spatial and temporal variability characteristic of tidal estuaries (Ahmed et al., 2024; Li et al., 2024). Risk assessments based solely on fixed-index calculations, such as the potential ecological risk index (PERI) provide valuable snapshots of contamination status but cannot anticipate how risk levels will evolve under changing environmental conditions. Machine learning (ML) algorithms have emerged as transformative tools capable of overcoming these limitations by learning complex, nonlinear patterns from high-dimensional environmental data. Unlike traditional deterministic models, ML methods effectively handle the nonlinear relationships and complex interactions that characterize heavy metal pollution in dynamic systems (Bi et al., 2024; Wang et al., 2020) and support vector machines, in particular, can mitigate problems associated with small samples and local optima while maintaining high generalization performance (Vapnik, 1999). Recent applications of random forest (RF), support vector machine (SVM), artificial neural networks (ANN), and extreme gradient boosting (XGBoost) have demonstrated considerable success in predicting heavy metal concentrations (Hu et al., 2026; Wang et al., 2022; Yan & Yang, 2025) and classifying water quality status (Basirian et al., 2026; Xie et al., 2025). Recent review studies have consistently identified RF, SVM, ANN, and XGBoost as the most frequently applied and best-performing machine learning algorithms for water quality assessment and heavy metal prediction because of their ability to capture nonlinear relationships, robustness across diverse environmental datasets, and strong predictive performance (Essamlali et al., 2024; Mohan et al., 2025; Zhu et al., 2022). These models also represent complementary learning paradigms, including tree-based ensemble methods (RF and XGBoost), kernel-based learning (SVM), and deep nonlinear function approximation (ANN), enabling comprehensive comparison of different modeling strategies for ecological risk prediction. A small number of studies have begun to couple ML outputs with ecological risk indices such as PERI in an effort to move beyond simple concentration prediction (Bi et al., 2024; Fan et al., 2021). Despite these encouraging advances, most ML-based investigations focus narrowly on contaminant levels while neglecting the forecasting of integrated ecological risk metrics. Furthermore, no framework has yet systematically leveraged ML to predict spatiotemporally resolved PERI values while simultaneously quantifying the relative importance of the environmental drivers shaping ecological risk in complex urban estuaries. To address this gap, the present study develops and validates a predictive framework that integrates PERI calculations with an ensemble of ML algorithms (RF, SVM, XGBoost, and ANN). This integration represents a paradigm shift from retrospective, static risk assessment toward prospective ecological risk forecasting. The framework not only enhances predictive accuracy but also provides interpretable insights into the key environmental factors governing heavy metal ecological risk, thereby strengthening the scientific basis for adaptive water quality management. The specific objectives of this study are to (i) analyze the variability of Hg, Cu, and Pb concentrations in the surface waters of the NY–NJ harbor system against established regulatory thresholds; (ii) apply ML-based variable importance methods to identify the dominant environmental predictors of ecological risk; and (iii) develop and rigorously validate a predictive model for PERI that supports dynamic risk assessment and improves the reliability and generalizability of ecological risk forecasts in heavily urbanized coastal ecosystems. Materials and methods Study area The Lower Passaic River (LPR) is a tidal riverine–estuarine system in northeast New Jersey, extending approximately 17 miles from the Dundee Dam to Newark Bay. The LPR is divided into the upper and lower sections. The lower section is contaminated with hazardous substances, including polychlorinated biphenyls (PCBs), heavy metals, and dioxins, due to historical industrial activity (Iannuzzi & Ludwig, 2004; Olson & Tharp, 2020). This section of the river flows through urbanized areas, including Newark, Passaic, and Paterson, with chemical manufacturing, industrial waste disposal, and contamination stemming from combined sewer overflow (Islam et al., 2025). The Lower Passaic River (LPR) receives freshwater inflow from the upstream Passaic River above the Dundee Dam, three main tributaries (the Saddle River, Third River, and Second River) as well as several smaller tributaries. Additional inputs include direct discharges from combined sewer overflows (CSOs), stormwater outfalls (SWOs), permitted municipal and industrial discharges, and surface runoff. Geologically, the LPR is a low-gradient, alluvial system with both tidal and nontidal flows (Donovan et al., 2008; Wallin et al., 2002). The bed is composed primarily of fine silt and clay, which serve as reservoirs for contaminants. These sediments are often disturbed by tidal action, storm events, and anthropogenic activities, leading to the redistribution of contaminants (Khairy et al., 2015). Data collection, analytical methods, and data analysis Water quality data were sourced from the Passaic River Digital Database, a collaborative effort maintained by the United States Environmental Protection Agency (USEPA), the United States Army Corps of Engineers (USACE), the New Jersey Department of Environmental Protection (NJDEP), and the United States Fish and Wildlife Service (USFWS). The data were collected for a project called “Lower Passaic River Study Area, Current Conditions and Monitoring Programs.” The project was originally designed to guide the first “Year 1” of a multiyear investigative effort. However, due to various external factors, including the COVID-19 pandemic and site-specific flow conditions, “Year 1” activities and data were expanded over several calendar years (AECOM, 2022). Sampling was done on the upper part of the LPR, specifically between River Mile (RM) 8 and Dundee Dam. For this monitoring study, five sample sites, RM 8.4, RM 10.2, RM 12.0, RM 13.5, and RM 15.8, were chosen (Fig. 1). Water samples were collected during 11 sampling events conducted across three seasonal monitoring periods: December 2019 (fall), June to August 2020 (summer), and March to April 2021 (spring). During each sampling event, samples were generally collected at two tidal stages (flood and ebb). At RM 8.4, RM 10.2, RM 12.0, and RM 13.5, samples were collected at two depths (0.9 m [3 ft] below the surface and approximately 0.6 m [2 ft] above the river bottom), whereas RM 15.8 was sampled only at mid-depth because of site-specific conditions. This sampling design produced approximately 18 samples per event, resulting in a final dataset of 198 water samples. Field duplicate samples collected as part of the quality assurance/quality control (QA/QC) program were included in the final dataset. Samples were collected at 0.9 m (3 ft) below the water surface (AECOM, 2022). This study focused on three heavy metals, Cu, Pb, and Hg, based on their high toxicity, regulatory relevance, and documented occurrence in the Lower Passaic River system. These metals have been consistently reported as priority pollutants linked to historical industrial discharges and urban runoff in the region (AECOM, 2022; Iannuzzi et al., 2008). Location of the study area in the upper portion of the Lower Passaic River (LPR), extending from Dundee Dam to River Mile (RM) 8 Immediately after collection, all water samples were acidified to pH < 2 using ultrapure nitric acid and stored at 4 °C until laboratory analysis to prevent metal adsorption and ensure data integrity, following EPA Method 1669 (USEPA, 1996). Copper (Cu) and lead (Pb) concentrations were analyzed at ALS Environmental (Kelso, WA), while mercury (Hg) was analyzed at Brooks Applied Labs (Bothell, WA). EPA Method 6020 A (SW-846) was employed for Cu and Pb using inductively coupled plasma mass spectrometry (ICP-MS) with argon plasma. Mercury (Hg) analysis followed EPA Method 1631 (Revision E), using cold vapor atomic fluorescence spectrometry (CVAFS) (AECOM, 2022). Analytical QA/QC procedures followed EPA guidelines and included standard reference materials (SRMs), method blanks, and matrix spikes. Recovery rates for Cu, Pb, and Hg ranged from 92 to 106%, indicating high analytical accuracy. Method detection limits (MDLs) were 0.1 µg/L for Cu, 0.05 µg/L for Pb, and 0.002 µg/L for Hg. All measured values were within acceptable QA/QC limits as defined by USEPA (1996). Summary statistics, including detection frequencies and reporting limits (RLs) for heavy metals in water samples, are provided in Table S1. Physical–chemical parameters were measured using a YSI multiparameter sonde (EX02) (AECOM, 2022). Microsoft Excel (v.16.85.2), JMP Pro (v.16.2.0), and RStudio (v.2024.04.1 + 748) were used for statistical analyses. Data were assessed for homogeneity and normality. Because the data did not satisfy the assumptions of normality, Spearman’s rank correlation was used to evaluate the relationships between heavy metals and the measured physicochemical parameters. Principal component analysis (PCA) with Varimax rotation was performed to identify the principal factors influencing relationships among physicochemical parameters and heavy metals in the LPR. Principal components with eigenvalues greater than 1 were retained according to the Kaiser criterion, and the rotated component loadings were used to facilitate interpretation of the variables contributing to each principal component. Pollution assessment indices To comprehensively evaluate heavy metal pollution and ecological risk, this study employed both single-metal and integrated pollution indices. The contamination factor (Cf) quantifies the contamination level of each individual metal relative to its background concentration, while the ecological risk index (Eir) incorporates both contamination and the toxic response of each metal to estimate its potential ecological risk. Integrated indices, including the contamination degree (Cd), heavy metal evaluation index (HEI), heavy metal pollution index (HPI), heavy metal toxicity load (HMTL), and potential ecological risk index (PERI), provide an overall assessment of water quality by combining the effects of multiple heavy metals. The mathematical expressions, classification criteria, and references for these indices are presented in Table 1. Table 1Indices and classification criteria for heavy metal pollution and ecological risk assessmentIndicesMathematical expressionClassificationContamination degreeReferencesContamination factor (Cf) Cf=CiCb Here, Ci = measured concentration on the metal, Cb = background value. The background concentrations for river water are 1 µg/L for Cu, 0.2 µg/L for Pb, and 0.01 µg/L for Hg, respectively (Salomons & Förstner, 1984)Cf < 1Low Hakanson (1980) 1 ≤ Cf < 3Moderate1 ≤ Cf < 3ConsiderableCf ≥ 6Very highEcological risk index (Eir) Eri=Tri×Cfi Here, Tir = toxic response factor of individual heavy metal. The Tir values for Cu, Pb, and Hg are 5, 5, and 40, respectivelyEir < 40Low Hakanson (1980) 40 ≤ Eir < 80Moderate80 ≤ Eir < 160High160 ≤ Eir < 320Much higherEir ≥ 320SeriousContamination degree (Cd) Cd=∑i=1nCfi Cd < 8Low Hakanson (1980) 8 ≤ Cd < 16Moderate16 ≤ Cd < 32ConsiderableCd ≥ 32Very highPotential ecological risk (PERI) PERI=∑i=1nEri PERI < 150Low-grade Hakanson (1980) 150 < PERI < 300Moderate300 < PERI < 600SeverePERI > 600SeriousHeavy metal evaluation index (HEI) HEI=∑i=1nHcHmac Here, Hc represents the measured concentration, and Hmac denotes the maximum allowable concentration for the ith parameter. The Hmac values for Cu, Pb, and Hg are 1300 µg/L, 10 µg/L, and 2 µg/L, respectively (USEPA, 2024)HEI < 400Low Proshad et al. (2021) 400 ≤ HEI < 800ModerateHEI ≥ 800HighHeavy metal pollution index (HPI) HPI=∑i=1nWiQiWi Here, Wi represents the unit weight of the ith heavy metal, and Qi is the subindex for the ith HM; Qi is calculated as follows: Qi=∑i=1nCi(-)IiSi-Ii×100 Here, Si and Ii represent the standard and ideal values for drinking water, respectively, as specified by USEPA (2024) for heavy metals in µg/LHEI < 100Low Saha and Paul (2019) HEI = 100Threshold riskHEI > 100HighHeavy metal toxicity load (HMTL) HMTL=∑i=1nCi-HIS Here, HIS represents the hazard intensity score. HIS is derived from the Agency for Toxic Substances and Disease Registry (ATSDR), considering the frequency of these toxic substances appearing on the National Priorities List (NPL), their toxicity levels, and the potential for human exposure. Table 5 (toxicity of heavy metals (µg/L) and heavy metal toxicity load (µg/L)) lists the highest allowable thresholds for determining the HIS that have been approved by ATSDR (2025) Saha and Paul (2019) Indices and classification criteria for heavy metal pollution and ecological risk assessment Cf=CiCb Here, Ci = measured concentration on the metal, Cb = background value. The background concentrations for river water are 1 µg/L for Cu, 0.2 µg/L for Pb, and 0.01 µg/L for Hg, respectively (Salomons & Förstner, 1984) Eri=Tri×Cfi Here, Tir = toxic response factor of individual heavy metal. The Tir values for Cu, Pb, and Hg are 5, 5, and 40, respectively HEI=∑i=1nHcHmac Here, Hc represents the measured concentration, and Hmac denotes the maximum allowable concentration for the ith parameter. The Hmac values for Cu, Pb, and Hg are 1300 µg/L, 10 µg/L, and 2 µg/L, respectively (USEPA, 2024) HPI=∑i=1nWiQiWi Here, Wi represents the unit weight of the ith heavy metal, and Qi is the subindex for the ith HM; Qi is calculated as follows: Qi=∑i=1nCi(-)IiSi-Ii×100 Here, Si and Ii represent the standard and ideal values for drinking water, respectively, as specified by USEPA (2024) for heavy metals in µg/L HMTL=∑i=1nCi-HIS Here, HIS represents the hazard intensity score. HIS is derived from the Agency for Toxic Substances and Disease Registry (ATSDR), considering the frequency of these toxic substances appearing on the National Priorities List (NPL), their toxicity levels, and the potential for human exposure. Table 5 (toxicity of heavy metals (µg/L) and heavy metal toxicity load (µg/L)) lists the highest allowable thresholds for determining the HIS that have been approved by ATSDR (2025) Among these indexes, PERI was selected as the target variable for the machine learning models because it integrates both the contamination level and the toxic response of individual heavy metals into a single ecological risk metric. Compared with the other indexes, PERI provides a more comprehensive representation of ecological risk and is widely used for environmental risk assessment. The machine learning framework was therefore developed to predict PERI from the measured environmental variables, allowing rapid estimation of ecological risk without requiring direct calculation of the index from all heavy metal measurements. Machine learning methods We assessed the performance of the four machine learning models: random forest (RF), support vector machine (SVM), extreme gradient boosting (XGBoost), and artificial neural network (ANN), as detailed in Table S2. RF, an ensemble learning method, generates several decisions during training and produces the average prediction of individual decision trees, effectively reducing overfitting and improving accuracy (Breiman, 2001). SVM is a supervised learning algorithm that constructs an optimal hyperplane in a high-dimensional space to separate data classes and can be adapted for regression functions using kernel functions (Cortes & Vapnik, 1996). XGBoost, a scalable implementation of gradient boosting, enhances model performance through regularization techniques and efficient handling of missing data (Chen & Guestrin, 2016). ANN, inspired by the structure of the biological neural networks, contains interconnected layers of nodes (neurons) that learn hierarchical feature representation through iterarive weight optimization using backpropagation (Rumelhart et al., 1986). In this study, a 70:30 ratio was employed to split the dataset into the training and testing sets, respectively, during the application of machine learning techniques. The detailed procedures for data preprocessing, dataset partitioning, and the hyperparameter tuning process for each model are described in Sects.“Data preprocessing and partitioning” and “Model development and hyperparameter optimization,” respectively. The overall workflow of the proposed ML modeling methodology is illustrated in Fig. 2. Workflow of the proposed ML modeling approach for PERI prediction Data preprocessing and partitioning The machine learning models were developed to predict the potential ecological risk index (PERI). The predictor variables consisted of chlorophyll-a, total alkalinity, dissolved organic carbon (DOC), particulate organic carbon (POC), suspended sediment concentration (SSC), and the concentrations of Cu, Pb, and Hg. Prior to model development, the dataset was examined for missing values, and no imputation was required because all variables were complete. Heavy metal concentrations and physicochemical parameters were screened for extreme values; however, no observations were removed or modified. Feature scaling was applied only to algorithms requiring normalized inputs. Specifically, the ANN model employed min–max normalization, with normalization parameters estimated exclusively from the training dataset and subsequently applied unchanged to the cross-validation and testing datasets to prevent data leakage. The remaining algorithms were implemented according to the requirements of their respective packages and did not require feature scaling. The dataset was randomly partitioned into training (70%) and testing (30%) subsets using the “createDataPartition()” function with a fixed random seed (“set.seed(1234)”). The same training and testing subsets were used for all machine learning models to ensure a fair comparison of predictive performance. Hyperparameter tuning and model selection were conducted exclusively on the training dataset using fivefold cross-validation. During each iteration, fourfolds were used for model training and onefold was used for validation, with each fold serving once as the validation set. After the optimal hyperparameters were identified, each model was retrained using the complete training dataset and subsequently evaluated on the independent testing dataset. The testing dataset was not used during model development or hyperparameter optimization, thereby preventing data leakage and ensuring an unbiased assessment of predictive performance. Because the dataset did not exhibit strong spatial or temporal dependence, random partitioning was considered appropriate for model development and evaluation. Model development and hyperparameter optimization Model development included four supervised learning algorithms: random forest (RF), support vector machine (SVM), extreme gradient boosting (XGBoost), and artificial neural network (ANN). All analyses were conducted in the RStudio environment. The common model development workflow, including data partitioning, cross-validation, and prevention of data leakage, is described in Sect. “Data Preprocessing and Partitioning.” The algorithm-specific implementation and hyperparameter optimization procedures are described below. Random forest (RF): the random forest model was implemented using the “randomForest” package. The optimal number of variables randomly selected at each split (“mtry”) was determined through systematic hyperparameter optimization using fivefold cross-validation. Candidate “mtry” values ranging from 2 to 8 were evaluated, corresponding to the eight predictor variables included in the model. The optimal value (“mtry” = 6) was selected based on the lowest average cross-validated root mean square error (RMSE). The final model was trained using 500 trees (“ntree” = 500) with the selected “mtry” value. Random forest (RF): the random forest model was implemented using the “randomForest” package. The optimal number of variables randomly selected at each split (“mtry”) was determined through systematic hyperparameter optimization using fivefold cross-validation. Candidate “mtry” values ranging from 2 to 8 were evaluated, corresponding to the eight predictor variables included in the model. The optimal value (“mtry” = 6) was selected based on the lowest average cross-validated root mean square error (RMSE). The final model was trained using 500 trees (“ntree” = 500) with the selected “mtry” value. Support vector machine (SVM): The SVM model was implemented using the “caret” package with a radial basis function (RBF) kernel. Candidate combinations of the kernel parameters (“sigma” and “C”) were evaluated using fivefold cross-validation, and the combination with the lowest average cross-validated RMSE was selected. The final model was trained using the optimal hyperparameter combination. Support vector machine (SVM): The SVM model was implemented using the “caret” package with a radial basis function (RBF) kernel. Candidate combinations of the kernel parameters (“sigma” and “C”) were evaluated using fivefold cross-validation, and the combination with the lowest average cross-validated RMSE was selected. The final model was trained using the optimal hyperparameter combination. Extreme gradient boosting (XGBoost): the XGBoost regression model was implemented using the “xgboost” package. Model hyperparameters, including the learning rate (eta = 0.30), maximum tree depth (max_depth = 6), subsample ratio (subsample = 0.80), and column sampling ratio (colsample_bytree = 0.80), were selected based on preliminary experiments to achieve stable predictive performance while minimizing overfitting. A maximum of 100 boosting rounds was specified, and the optimal number of boosting rounds was determined using fivefold cross-validation with early stopping. The final model was trained using the selected hyperparameters and the optimal number of boosting rounds Extreme gradient boosting (XGBoost): the XGBoost regression model was implemented using the “xgboost” package. Model hyperparameters, including the learning rate (eta = 0.30), maximum tree depth (max_depth = 6), subsample ratio (subsample = 0.80), and column sampling ratio (colsample_bytree = 0.80), were selected based on preliminary experiments to achieve stable predictive performance while minimizing overfitting. A maximum of 100 boosting rounds was specified, and the optimal number of boosting rounds was determined using fivefold cross-validation with early stopping. The final model was trained using the selected hyperparameters and the optimal number of boosting rounds Artificial neural network (ANN): the ANN model was developed using the “neuralnet” package. Several candidate network architectures were evaluated using fivefold cross-validation. The selected architecture consisted of two hidden layers containing five and three neurons, respectively, as it provided stable convergence and consistently good predictive performance while maintaining a relatively simple network structure. The model employed the hyperbolic tangent activation function (tanh), the resilient backpropagation (rprop +) learning algorithm, and a maximum of 1,000,000 training steps to ensure convergence. The final model was trained using the selected architecture and hyperparameters, and model predictions were subsequently transformed back to the original PERI scale for performance evaluation. Artificial neural network (ANN): the ANN model was developed using the “neuralnet” package. Several candidate network architectures were evaluated using fivefold cross-validation. The selected architecture consisted of two hidden layers containing five and three neurons, respectively, as it provided stable convergence and consistently good predictive performance while maintaining a relatively simple network structure. The model employed the hyperbolic tangent activation function (tanh), the resilient backpropagation (rprop +) learning algorithm, and a maximum of 1,000,000 training steps to ensure convergence. The final model was trained using the selected architecture and hyperparameters, and model predictions were subsequently transformed back to the original PERI scale for performance evaluation. Accuracy assessment of ML models The evaluation of the ML models was performed using the coefficient of determination (R2), mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE) (de Myttenaere et al., 2016). The most commonly used metric for assessing regression models is R2. Higher numbers on a scale of 0 to 1 suggest a better match, while lower values show a worse fit. The Nash–Sutcliffe Efficiency (NSE) is widely used in hydrology and water quality modeling; it ranges from − ∞ to 1, with values closer to 1 indicating better performance (values ≤ 0 indicate the model is no better than using the observed mean). The average relative error between estimated and measured values is measured by RMSE. The mean absolute value of the error between the measured and anticipated values is known as the MAE. Because of its natural interpretation in terms of relative error, MAPE, which focuses on percentage error, is frequently utilized in practice (Liang et al., 2025). The mathematical formulations of these performance metrics are presented in Eqs. 1, 2, 3, 4, and 5. where yi denotes the measured value, ŷi signifies the estimated value, n represents the number of samples, and ȳi indicates the mean value of the measured data. Results Statistical analysis of heavy metal concentrations The seasonal distribution of Cu, Pb, and Hg is highlighted in Table 2 at five sample locations along the LPR during the fall, spring, and summer. The data show distinct seasonal and spatial patterns, which vary in average concentrations across different locations. RM 8.4 recorded the highest values for Cu and Pb in most seasons. For Hg, while concentrations were relatively low, subtle seasonal differences were observed. Table 2Seasonal and spatial variation in the concentrations (µg/L) of trace metals (Cu, Pb, and Hg) in surface water across locations in the Lower Passaic River (LPR), with comparison to background values and regulatory limitsSeasonLocationCuPbHg FallRM 8.4Mean ± SD3.434 ± 1.6031.566 ± 1.8440.0184 ± 0.031Range2.08 − 7.610.162 − 6.280.0013 − 0.122RM 10.2Mean ± SD3.177 ± 0.8591.208 ± 1.450.011 ± 0.013Range2.1 − 5.430.28 − 4.270.0012 − 0.0411RM 12Mean ± SD2.688 ± 0.38530.4427 ± 0.29960.0027 ± 0.0027Range1.85 − 3.250.152 − 1.110.0008 − 0.0097RM 13.5Mean ± SD2.7293 ± 0.48970.4842 ± 0.5160.0026 ± 0.0037Range1.87 − 3.780.136 − 1.70.0007 − 0.0125RM15.8Mean ± SD2.394 ± 0.2270.2124 ± 0.10870.0014 ± 0.001Range2.05 − 2.740.114 − 0.4560.0006 − 0.0036SpringRM 8.4Mean ± SD2.11 ± 0.05720.4568 ± 0.09960.0041 ± 0.0011Range2.05 − 2.180.347 − 0.5470.0027 − 0.0052RM 10.2Mean ± SD1.872 ± 0.12560.2608 ± 0.04810.0019 ± 0.0003Range1.74 − 2.030.22 − 0.3380.0017 − 0.0023RM 12Mean ± SD2.1175 ± 0.07540.3008 ± 0.03780.0021 ± 0.0007Range2.01 − 2.170.25 − 0.3350.0012 − 0.0028RM 13.5Mean ± SD2.185 ± 0.13630.4108 ± 0.06410.0027 ± 0.0008Range2.05 − 2.350.319 − 0.4610.0019 − 0.0037RM15.8Mean ± SD2.325 ± 0.30410.389 ± 0.1130.0025 ± 0.0004Range2.11 − 2.540.309 − 0.4690.0022 − 0.0028SummerRM 8.4Mean ± SD3.7367 ± 1.45551.6063 ± 2.06150.0077 ± 0.0071Range2.61 − 5.380.121 − 3.960.0008 − 0.0151RM 10.2Mean ± SD2.82 ± 0.07810.4077 ± 0.43120.0036 ± 0.003Range2.77 − 2.910.103 − 0.9010.0008 − 0.0068RM 12Mean ± SD2.965 ± 0.30820.6328 ± 0.38030.0027 ± 0.0014Range2.66 − 3.250.211 − 1.120.0009 − 0.0042RM 13.5Mean ± SD2.52 ± 0.070.1993 ± 0.01780.0008 ± 0.0002Range2.47 − 2.60.179 − 0.2120.0007 − 0.001RM15.8Mean ± SD2.865 ± 0.460.239 ± 0.10040.0009 ± 0.0005Range2.54 − 3.190.168 − 0.310.0006 − 0.0013Background value1a0.2a0.01aPermissible limit—aquatic life − 65 (acute)b1.4 (acute)b − 2.5 (chronic)b0.77 (chronic)bPermissible limit—drinking water1300c10c2cToxicity reference value (TRVs)9d2.5d0.0028da Salomons and Förstner (1984) b USEPA (1986) c USEPA (2024) d USEPA (1999) Seasonal and spatial variation in the concentrations (µg/L) of trace metals (Cu, Pb, and Hg) in surface water across locations in the Lower Passaic River (LPR), with comparison to background values and regulatory limits a Salomons and Förstner (1984) b USEPA (1986) c USEPA (2024) d USEPA (1999) The seasonal variation of heavy metals (Cu, Pb, and Hg) is depicted in Fig. 3, with box plots representing their concentrations during summer, fall, and spring. Copper exhibited statistically significant seasonal differences (Kruskal–Wallis, p = 1.8E-07), with concentrations highest in fall and lowest in spring (Fig. 3a). In pairwise comparisons, summer versus fall showed no significant difference (p = 0.93), summer versus spring was highly significant (p = 4.1E-06), and fall versus spring was the most significant (p = 1.3E-07). In contrast, Pb and Hg did not show any significant seasonal variation (Kruskal–Wallis, p = 0.12 for Pb and p = 0.52 for Hg). Seasonal variation of trace metal concentrations of a copper (Cu), b lead (Pb), and c mercury (Hg) in surface water samples collected from the upper portion of the Lower Passaic River (LPR). Box plots represent data distributions across summer, fall, and spring seasons. Kruskal–Wallis test results indicate a statistically significant seasonal difference for Cu, Pb, and Hg. Pairwise comparisons are labeled with corresponding p-values Variation of physicochemical parameters Various sample locations (RM 8.4, RM 10.2, RM 12, RM 13.5, and RM 15.8) and seasons (fall, spring, and summer) exhibited spatial and seasonal variations in the physical and chemical parameters of the LPR. Chlorophyll-a concentration demonstrated significant seasonal variations, along with the highest levels observed during summer (Table 3). The total alkalinity showed noticeable fluctuations, with a decline relative to spring and summer levels. The dissolved organic carbon (DOC) and particulate organic carbon (POC) concentrations showed minor spatial and seasonal differences, with relatively stable values across the sampling locations and seasons (Table 3). The suspended sediment concentration (SSC) was highest in summer. Table 3Seasonal variation in physicochemical parameters (mean ± SD) across locations in the Lower Passaic River (LPR), compared with aquatic life criteriaParametersLocationSeasonsAquatic life criteriaFallSpringSummerChlorophyl-a (mg/m3)RM 8.411.02 ± 10.4210.48 ± 3.0863.1 ± 41.7120aRM 10.211.96 ± 11.49.56 ± 1.1639.43 ± 29.68RM 124.7 ± 3.0315.13 ± 2.393.7 ± 1.89RM 13.54.13 ± 3.1715.38 ± 3.671.7 ± 0.7RM 15.83.54 ± 1.6313.6 ± 1.560.95 ± 0.21Total alkalinity (As CaCO3) (mg/L)RM 8.484.53 ± 16.3558.75 ± 3.288 ± 14.7320bRM 10.286.67 ± 15.3457.4 ± 2.8888 ± 13.86RM 1284.81 ± 16.6656 ± 082.5 ± 13.28RM 13.587 ± 18.6956.5 ± 0.5886 ± 13.08RM 15.885.25 ± 21.3651 ± 2.8375 ± 8.49DOC (mg/L)RM 8.43.43 ± 0.713.93 ± 0.444.02 ± 0.358.3RM 10.23.45 ± 0.533.94 ± 0.464.09 ± 0.19RM 123.59 ± 0.44.15 ± 0.514.32 ± 0.27RM 13.53.47 ± 0.444.05 ± 0.664.15 ± 0.26RM 15.83.35 ± 0.534.05 ± 0.784.13 ± 0.45POC (mg/L)RM 8.44.98 ± 3.271.65 ± 0.848.95 ± 4.16 − RM 10.23.26 ± 1.521.16 ± 0.154.45 ± 1.87RM 122.28 ± 1.131.88 ± 0.411.97 ± 0.46RM 13.51.97 ± 0.981.77 ± 0.551.82 ± 0.55RM 15.81.94 ± 1.411.49 ± 0.190.96 ± 0.56SSC (mg/L)RM 8.456.46 ± 44.7414.63 ± 8.1485.57 ± 62.2780–100 for fishcRM 10.231.66 ± 22.478.34 ± 1.5136.77 ± 10.29RM 1221.05 ± 16.3413.45 ± 4.1912.83 ± 5.23RM 13.511.49 ± 7.8812.13 ± 3.1210.87 ± 1.1RM 15.89.4 ± 12.411.85 ± 1.911.8 ± 0.28aNJDEP (2026)b USEPA (1986) cGriffiths and Walton (1978) Seasonal variation in physicochemical parameters (mean ± SD) across locations in the Lower Passaic River (LPR), compared with aquatic life criteria aNJDEP (2026) b USEPA (1986) cGriffiths and Walton (1978) Water quality indices Single water quality indices The contamination factor (Cf) and ecological risk index (Eir) for Cu, Pb, and Hg were analyzed seasonally across five sampling locations in the LPR. The contamination factor (Fig. 4a) of Pb consistently showed higher contamination factors compared to Cu and Hg, particularly in fall and summer, with “considerable to very high” contamination levels observed at RM 8.4 and RM 10.2. In spring, Pb levels were “moderate to considerable.” Cu displayed moderate contamination levels across most seasons and locations, with the highest levels at downstream sites (e.g., RM 8.4). Hg demonstrated the lowest contamination factor among the metals, with low levels observed across most seasons and locations. Seasonal and spatial variation of a contamination factor (Cf) and b ecological risk index (Eir) for copper (Cu), lead (Pb), and mercury (Hg) across five locations (River Miles 8.4 to 15.8) along the upper portion of the Lower Passaic River (LPR). Error bars represent standard error The ecological risk index (Fig. 4b) of Hg contributed significantly to the ecological risk, with moderate risks observed in fall at RM 8.4 and RM 10.2, while risks decreased to low levels in spring and summer. Pb exhibited “moderate to low” ecological risk in fall but showed a reduction to “low” risk in other seasons. Cu consistently remained in the “low” risk category across all seasons and locations. Seasonal differences highlighted fall as the period with the highest ecological risk levels for all three metals. Integrated water quality indices Integrated water quality indices (Cd, PERI, HEI, and HPI) for heavy metals across five locations in the LPR during fall, spring, and summer are presented in Table 4. Values of Cd ranged from “low” (< 1) to “high” (> 3) across locations and seasons. The highest Cd values were observed at RM 8.4 and RM 10.2 during fall (11.27 and 9.296, respectively), while spring and summer showed comparatively lower values, predominantly in the “medium” to “high” range. PERI values were highest in fall, with RM 8.4 reaching a serious level (102) and RM 10.2 a “moderate” level (82.17). In spring and summer, PERI values remained in the “low” risk category (< 150). HEI values were low (< 400) across all locations and seasons, with the highest value observed at RM 8.4 in fall (0.168) (Table 4). HPI values were generally low (< 100) across all seasons and locations, with a maximum of 3.373 at RM 8.4 during fall (Table 4). Table 4Seasonal variation of integrated heavy metal pollution indices (Cd, PERI, HEI, and HPI) at different locations along the Lower Passaic River (LPR)SeasonLocationHeavy metal pollution indicesCdPERIHEIHPIFallRM 8.411.2730101.9560.1683.373RM 10.29.296082.1670.1292.481RM 126.063047.1020.0480.850RM 13.55.459036.4870.0520.914RM 15.83.596022.8880.0240.412SpringRM 8.44.318033.6910.0490.931RM 10.23.825027.7630.0280.513RM 123.880027.2260.0330.588RM 13.54.392031.0440.0440.796RM 15.84.518031.2700.0420.751SummerRM 8.49.297071.4370.1672.995RM 10.29.220073.1220.0450.829RM 127.072048.8630.0671.166RM 13.53.695022.2290.0220.365RM 15.84.154024.0400.0270.437 Seasonal variation of integrated heavy metal pollution indices (Cd, PERI, HEI, and HPI) at different locations along the Lower Passaic River (LPR) To provide a clear statistical justification for the observed temporal patterns, Kruskal–Wallis tests were conducted on these integrated indices. The results reveal a distinct seasonal pattern: Cd showed a statistically significant variation across seasons (p = 0.001), with a post hoc Steel–Dwass test confirming that fall values were significantly higher than spring values. In contrast, the PERI, along with the HEI and HPI, did not exhibit statistically significant seasonal variation (p > 0.05) (Table S3). Spatially, the downstream sites, particularly RM 8.4 and RM 10.2, consistently exhibited higher contamination and ecological risk levels across indices. Table 5 shows heavy metal toxicity (Cu, Pb, and Hg) and toxicity load across locations in the LPR during fall, spring, and summer. Pb consistently exhibited the highest toxicity, peaking in summer at RM 8.4 (2.46E + 03 µg/L), while Hg shows the lowest values. The heavy metal toxicity load was highest in summer (5.49E + 03 µg/L at RM 8.4) and lowest in spring (1.91E + 03 µg/L at RM 10.2) (Table 5). However, the studied metals did not exceed their permissible toxicity load (PTL). Table 5Toxicity of heavy metals (µg/L) and heavy metal toxicity load (µg/L) in surface water of the Lower Passaic River (LPR)SeasonLocationToxicity of heavy metalsHeavy metal toxicity loadCuPbHgFallRM 8.42.77E + 032.40E + 032.68E + 015.20E + 03RM 10.22.56E + 031.85E + 031.64E + 014.43E + 03RM 122.17E + 036.78E + 023.93E + 002.85E + 03RM 13.52.20E + 037.41E + 023.78E + 002.95E + 03RM 15.81.93E + 033.25E + 022.04E + 002.26E + 03SpringRM 8.41.70E + 036.99E + 025.97E + 002.41E + 03RM 10.21.51E + 033.99E + 022.76E + 001.91E + 03RM 121.71E + 034.61E + 023.06E + 002.17E + 03RM 13.51.76E + 036.29E + 023.93E + 002.40E + 03RM 15.81.88E + 035.96E + 023.61E + 002.48E + 03SummerRM 8.43.02E + 032.46E + 031.12E + 015.49E + 03RM 10.22.28E + 036.24E + 025.24E + 002.91E + 03RM 122.39E + 039.69E + 023.93E + 003.37E + 03RM 13.52.03E + 033.05E + 021.16E + 002.34E + 03RM 15.82.31E + 033.66E + 021.36E + 002.68E + 03Hazard intensity score (HIS)a80715311455 − Permissible toxicity load (PTL)1.05E + 062.30E + 042.92E + 035.92E + 06a ATSDR (2025) Toxicity of heavy metals (µg/L) and heavy metal toxicity load (µg/L) in surface water of the Lower Passaic River (LPR) a ATSDR (2025) Multivariate analysis Spearman’s rank correlation analysis revealed several significant relationships among heavy metals and environmental variables (Fig. 5). The strongest association was observed between Pb and Hg (r = 0.83, p < 0.001), followed by Pb and Cu (r = 0.67, p < 0.001) and Cu and Hg (r = 0.51, p < 0.001), suggesting that the three metals likely share common sources or exhibit similar environmental behavior. All three metals also showed significant positive correlations with suspended sediment concentration (SSC; r = 0.58–0.67, p < 0.001) and particulate organic carbon (POC; r = 0.49–0.60, p < 0.001), indicating that particulate matter plays an important role in metal transport and accumulation. Chlorophyll-a was positively correlated with Pb (r = 0.45, p < 0.001) and Hg (r = 0.54, p < 0.001), whereas its relationship with Cu was weak (r = 0.16, p < 0.05), suggesting a stronger association of Pb and Hg with biological productivity. Spearman’s rank correlation matrix among heavy metals and physicochemical parameters in the Lower Passaic River Among the environmental variables, SSC exhibited a very strong positive correlation with POC (r = 0.86, p < 0.001), indicating that organic carbon is largely associated with suspended particulate matter. Total alkalinity was positively correlated with Cu (r = 0.64, p < 0.001), Pb (r = 0.25, p < 0.001), Hg (r = 0.16, p < 0.05), POC (r = 0.51, p < 0.001), and SSC (r = 0.39, p < 0.001), but showed a strong negative correlation with dissolved organic carbon (DOC; r = −0.55, p < 0.001). DOC was weakly or negatively correlated with most variables and was significantly negatively associated only with Cu (r = −0.22, p < 0.01), while its relationships with Pb, Hg, chlorophyll-a, POC, and SSC were not statistically significant. These correlations indicate that particulate matter and associated organic carbon are the dominant controls on heavy metal distribution in the study area, whereas DOC appears to play a comparatively minor role. To detect the underlying patterns and dimensionality within the dataset, a principal component analysis (PCA) with varimax rotation was applied to physical–chemical parameters and heavy metals. The first three major components (PC1, PC2, and PC3) were retained on the basis of eigenvalue > 1 criteria, cumulatively explaining 79.56% of the total variance (Fig. S2). The PC1 was responsible for 47.04% variance and was strongly loaded with SSC (0.87), Cu (0.83), Pb (0.82), and Hg (0.66). PC2 explained 17.92% of the variance and was dominated by high positive loading for DOC (0.87) and total alkalinity (− 0.71). PC3 showed high loading accounting for 14.60% variance, chlorophyll-a (0.70), and Cu (0.65) (Table S4). Application of machine learning (ML) models for predicting PERI The performance evaluation of four machine learning (ML) models (RF, ANN, SVM, and XGBoost) for predicting the parameters PERI during the training and testing phases is shown in Table 6 and Fig. 6. ANN showed the strongest performance in both phases. During training, it produced the lowest MSE (3.59), MAE (1.32), and RMSE (1.90), together with the highest R2 (0.999) and NSE (0.99). Its testing results were similarly strong, with an MSE of 34.21, MAE of 2.25, RMSE of 5.85, R2 of 0.981, and NSE of 0.98. SVM ranked second, with training MSE, MAE, and RMSE of 17.93, 3.53, and 4.23, and testing values of 37.30, 4.26, and 6.11. RF delivered moderate performance, with higher training errors (MSE = 39.82, MAE = 3.08, and RMSE = 6.31) and testing errors (MSE = 28.95, MAE = 2.39, and RMSE = 5.93). XGBoost performed the weakest. Its training MSE, MAE, and RMSE were 149.08, 5.24, and 12.21, and its testing errors remained high, with an MSE of 135.85, MAE of 5.97, and RMSE of 11.66. These results confirm that ANN is the most accurate and reliable model, followed by SVM, while RF and XGBoost are less suitable for this prediction task. Table 6Performance evaluation of machine learning models (RF, SVM, XGBoost, and ANN) for predicting PERI during training and testing phasesRFSVMXGBoostANNRFSVMXGBoostANNTrainingTestingMSE39.8217.93149.083.5928.9537.30135.8534.21MAE3.083.535.241.322.394.265.972.25RMSE6.314.2312.211.905.386.1111.665.85RSR0.160.060.250.030.140.140.230.14NSE0.970.9960.920.990.980.980.950.98MAPE (%)2.519.736.263.153.7510.8511.074.24R20.9720.9970.9250.9990.9850.9780.9470.981 Performance evaluation of machine learning models (RF, SVM, XGBoost, and ANN) for predicting PERI during training and testing phases Comparison of actual and predicted PERI values obtained from the best-performing machine learning models: random forest (RF) (a, b), support vector machine (SVM) (c, d), extreme gradient boosting (XGBoost) (e, f), and artificial neural network (ANN) (g, h) Variable importance by ML models The selection and significance of input variables are critical for ensuring the robustness and predictive accuracy of machine learning (ML) models. In this study, the importance of input variables in predicting the PERI concentration was evaluated using four ML models: XGBoost, RF, ANN, and SVM. As shown in Fig. 7, variable importance values were expressed as percentages to provide a consistent scale for comparing the relative contribution of each predictor. Relative importance of input parameters in predicting ecological risk index (PERI) using four ML models: XGBoost, RF, ANN, and SVM Mercury emerged as the most influential predictor for PERI, achieving the highest relative importance across all models except SVM (XGBoost (64.24), RF (76.99), ANN (53.67), and SVM (20.37)) (Fig. 7). Conversely, Pb consistently exhibited the lowest predictive significance. Notably, Cu demonstrated greater relative importance than Pb across all four models. Discussion Interpretation of heavy metal and physicochemical dynamics The contrasting seasonal behavior of Cu relative to Pb and Hg indicates that these metals do not share the same dominant inputs or transport mechanisms within the system (Suttie & Wolff, 1992). In this study, Cu exhibited significant seasonal variation (p < 0.001), with higher concentrations observed during fall and summer, particularly at RM 8.4 and RM 10.2 (Table 2 and Fig. 3). The noticeable seasonality of Cu supports the interpretation that its concentrations are strongly influenced by recent watershed inputs, particularly surface runoff that varies with precipitation and hydrological conditions (Riso et al., 1993). The elevated Cu concentrations at these downstream locations coincided with higher SSC and POC levels, suggesting that particulate matter and organic-rich materials may contribute to Cu transport and retention within the water column. In comparison, the limited seasonal variability observed for Pb and Hg suggests that their presence in the water column is shaped primarily by long-term processes such as the slow release of legacy contaminants from bed sediments or the continuous resuspension of previously deposited material. These processes are governed less by short-term hydrological fluctuations and more by the persistent geochemical and physical characteristics of the river system, consistent with patterns reported in earlier studies (Reza & Singh, 2010; Riso et al., 1993). The relatively higher Pb and Hg concentrations observed at RM 8.4 and RM 10.2 compared with other monitoring locations further suggest that downstream areas may be influenced by historical contamination, sediment accumulation, and remobilization processes. The seasonal variation observed in chlorophyll-a, especially during summer, suggests high algal productivity, likely driven by warm temperatures and increased availability of sunlight (Chen et al., 2023; Son et al., 2018). The highest chlorophyll-a concentrations during summer at RM 8.4 and RM 10.2 indicate enhanced biological activity at these locations, which may influence metal cycling through interactions with organic matter and biological uptake processes. The fluctuations in total alkalinity between seasons can be attributed to seasonal changes in photosynthetic activity and the dissolution of calcium carbonate, influenced by hydrological and biological factors (Ingrosso et al., 2016; Legge et al., 2017). Relatively stable DOC and POC values suggest consistent organic matter input and turnover within the system (Dordoni et al., 2022; Worrall & Moody, 2014). However, the relatively higher POC concentrations at downstream sites may contribute to localized differences in metal mobility by providing additional binding surfaces for trace metals. High SSC during summer is consistent with potentially increased surface runoff and resuspension of sediment from upstream areas due to seasonal rainfall, which can contribute to reducing water clarity and causing potential stress on aquatic ecosystems (Dugan et al., 2009; Tramblay et al., 2008). The concurrent increase in SSC and elevated Cu and Pb concentrations during summer supports the role of suspended particles as an important transport pathway for metals in the LPR. Interpretation of pollution indices and ecological risk The elevated contamination factor for Pb, especially in fall and summer, reflects its historical accumulation from industrial activities and urban runoff (Donovan et al., 2008). The marked difference between the fall and spring suggests potentially seasonal input sources, such as stormwater runoff or sediment resuspension during wet periods (Sodré et al., 2012; Zhao et al., 2024). Hg, although demonstrating the lowest contamination factor, contributed significantly to ecological risk due to its high toxicity and bioavailability (Islam et al., 2025), especially in the fall at RM 8.4 and RM 10.2. This aligns with the potential for legacy contamination in sediments to mobilize under specific environmental conditions. While Pb and Cu pose moderate to low risks, Hg presents a more significant concern for aquatic ecosystems due to its high toxic response factor (Chen & Driscoll, 2018; Wiener & Suchanek, 2008). Ecological risk showed seasonal variations linked to changes in hydrological and biological factors, including sediment disturbances during high-flow periods, and can intensify during low-flow periods due to reduced dilution capacity (Bao et al., 2018; Ramos et al., 2016). These results emphasize the need for targeted mitigation strategies during high-risk seasons, particularly at downstream locations such as RM 8.4 and RM 10.2. The high contamination degree (Cd) observed in RM 8.4 and RM 10.2 suggests that these sites are hotspots of metal pollution (Fig. S1), which is likely influenced by legacy contamination from industrial discharge and enhanced sediment transport during certain seasons (Chen & Guestrin, 2016; Donovan et al., 2008). Lower Cd values in spring and summer indicate significant seasonal variations, potentially due to a dilution effect from higher water flows or reduced sediment mobilization (Sodré et al., 2012; Zhao et al., 2024). The PERI results highlight that while the overall ecological risk is low to moderate, RM 8.4 and RM 10.2 experience high risk in the fall due to the high bioavailability and toxicity of specific metals, such as Hg. Spatial patterns across the LPR indicate a downstream-to-upstream gradient in contamination, with the highest pollution levels consistently observed at RM 8.4 and RM 10.2 and progressively lower values at the upstream locations (RM 12, RM 13.5, and RM 15.8) (Tables 4 and 5). The elevated contamination indices at the downstream sites likely reflect their proximity to historical industrial areas, urban drainage inputs, and zones of enhanced sediment accumulation where particle-associated metals can be retained and remobilized (Minh & Bui, 2026). In contrast, the comparatively lower contamination levels observed at upstream sites may be associated with reduced exposure to direct anthropogenic inputs, greater distance from historical discharge areas, and increased dilution and dispersion processes (Palumbo-Roe et al., 2012; Zhang et al., 2025a, b). However, the presence of measurable contamination at all locations indicates that metal transport and redistribution occur throughout the river system, likely influenced by hydrodynamic conditions, sediment dynamics, and seasonal variations in runoff (Munusamy et al., 2025; Razi & Zahratunnisa, 2026). These spatial patterns highlight the importance of considering both localized pollution sources and river-wide transport processes when evaluating ecological risks in the LPR. Low values for both HEI and HPI indicate that the water is not heavily polluted by heavy metals and remains within the permissible range defined by regulatory bodies. Seasonal increases in toxic load, especially in summer, suggest the influence of elevated runoff. Pb dominates the toxicity burden, which indicates persistent industrial and urban sources (Wenning et al., 1994). Interpretation of multivariate statistical patterns The multivariate analysis indicates that heavy metal distribution in the LPR is controlled by multiple interacting processes, including particulate transport, geochemical conditions, and biological influences. The dominance of SSC, Cu, Pb, and Hg in PC1 (Table S4), together with the significant correlations between SSC and metals (Fig. 5), suggests that suspended particulate matter is a major pathway for metal transport and redistribution. This pattern is consistent with the strong affinity of Cu, Pb, and Hg for particulate phases in aquatic systems (Feng et al., 2017; Kucuksezgin et al., 2008). PC2, characterized by DOC and total alkalinity (Table S4), reflects the potential influence of dissolved organic matter and chemical conditions on metal mobility through processes such as complexation and changes in metal availability (Zhu et al., 2021). PC3, associated primarily with chlorophyll-a and Cu (Table S4), suggests that biological activity may contribute to metal cycling through interactions with algal biomass and organic matter (Devesa-Rey et al., 2009; Szymańska-Walkiewicz et al., 2022). Together, these findings demonstrate that metal behavior in the LPR results from the combined effects of sediment-associated transport, geochemical processes, and biological interactions. Interpretation of machine learning model performance The model comparison showed that the artificial neural network (ANN) was the most effective approach for predicting PERI. It achieved the lowest errors in both training and testing, together with the highest R2 and NSE values, which indicates strong capability in capturing the nonlinear structure of the PERI response. Random forest (RF) produced moderate results. Its testing performance was acceptable, but its higher training errors suggest limited ability to represent the full complexity of the system. The support vector machine (SVM) ranked third. Although its performance was weaker than that of ANN, it remained stable across phases, which is consistent with the known dependence of SVM accuracy on kernel selection and parameterization (Tharwat, 2019). XGBoost showed the weakest performance, with relatively high errors in both the training and testing phases. This finding is consistent with previous studies reporting that XGBoost may not outperform other machine learning algorithms on relatively small datasets or when complex nonlinear relationships are limited, despite hyperparameter optimization (Bentéjac et al., 2021). These findings identify ANN as the most reliable model for PERI prediction, followed by RF, while SVM and XGBoost were less suitable for this application. The strong performance of ANN, in particular, demonstrates the capacity of machine learning to represent the combined influence of multiple heavy metals on ecological risk. This supports a broader shift in environmental modeling toward using ML methods not only for concentration estimation but also for ecological and health risk prediction. Recent work has applied similar approaches to forecast toxicity or biological responses based on pollutant data (Bai et al., 2025; Fan et al., 2021; Jeong et al., 2024; Pantic et al., 2025; Zhang et al., 2025a, b), underscoring the growing relevance of risk-focused modeling frameworks. The high accuracy achieved in this study (testing R2 = 0.981 and NSE = 0.98 for ANN) indicates that such models can be transferred to other urban river systems with comparable contamination profiles. Retraining the models with local input data would allow extension to additional metals or risk indices. This adaptability positions the ANN model as a useful component of rapid-assessment systems, capable of converting new concentration measurements into reliable ecological risk predictions without the need for full index recalculation. Its operational value is therefore significant for data-scarce or rapidly changing monitoring contexts. Interpretation of variable importance and management implications The dominance of Hg in ecological risk prediction is likely linked to its persistent and bioaccumulative nature and to legacy industrial emissions historically discharged into the LPR (Iannuzzi & Ludwig, 2004; Olson & Tharp, 2020). This finding has critical ecological implications. Mercury’s bioaccumulation in the food web poses a threat to piscivorous (fish-eating) wildlife and human health, potentially leading to advisories on fish consumption. Although the ML algorithms showed some variation in the relative importance rankings of the predictors (Fig. 7), mercury was consistently identified as one of the most influential variables across the models. This consistent identification suggests broad agreement regarding the importance of mercury, while acknowledging algorithm-specific differences in predictor rankings. For river management, this unequivocally identifies mercury as the primary target for remediation efforts. This finding is consistent with the high toxic weighting of Hg in the PERI calculation, supporting the validity and robustness of the ML approach applied in this study. Therefore, any intervention strategy aimed at reducing the overall ecological risk (PERI) in the LPR must prioritize the control and remediation of mercury sources and their mobilization from sediments. Conclusion This study provides a comprehensive analysis of heavy metal contamination (Cu, Pb, and Hg) in the surface water of the Lower Passaic River (LPR), combining traditional ecological risk indices with advanced machine learning (ML) modeling to enhance predictive accuracy and environmental insights. The findings indicate that metal concentrations and associated ecological risk display significant spatial variability, with persistent contamination and high-risk levels at downstream locations such as RM 8.4 and RM 10.2, particularly during the fall season. Among the heavy metals analyzed, Hg emerged as the most significant ecological pollutant due to its high toxic response factor, despite its relatively low concentration. The application of ML models, including random forest (RF), support vector machine (SVM), extreme gradient boosting (XGBoost), and artificial neural network (ANN), to predict the potential ecological risk index (PERI) demonstrated outstanding performance. The testing results identified ANN as the top-performing model. The ANN achieved the lowest prediction errors (MAE = 2.25 and MAPE = 4.24%) and the highest coefficient of determination (R2 = 0.981), indicating excellent predictive performance and effective capture of the complex nonlinear relationships within the data. Variable importance analysis further highlighted mercury’s dominant role in driving ecological risk, corroborating the statistical findings and providing additional insight into the key predictors identified by the ML models. This study’s key scientific contribution lies in demonstrating a paradigm shift from static to dynamic ecological risk assessment. By integrating machine learning with ecological risk indices, we have established a robust, transferable framework for quantifying, predicting, and managing heavy metal–induced ecological risks in complex urban river systems. This approach advances water quality management from reactive monitoring toward proactive, science-based decision-making by providing a mechanistic understanding of risk drivers and enabling forecasting. In practical terms, the findings provide actionable insights for the NY–NJ Harbor system, offering a transferable framework that supports pollution mitigation, restoration planning, and compliance with regional and national water quality objectives. Based on these results, it is recommended that local water authorities integrate ML-based predictive systems into routine monitoring programs to identify contamination hotspots in real time and prioritize mitigation efforts. Continuous sampling across multiple seasons should be institutionalized to capture temporal dynamics, while stricter regulatory limits on mercury discharges should be enforced to reduce ecological risk. Collaborative monitoring between environmental agencies and research institutions is also encouraged to enhance data availability and model reliability. This study acknowledges certain limitations. The analysis was based on a limited number of sampling campaigns and selected heavy metals (Cu, Pb, and Hg), which may not fully capture long-term temporal variations or the influence of other contaminants such as cadmium or arsenic. Additionally, while the ML models demonstrated strong predictive performance, their reliability depends on the availability and representativeness of input data. Future research should include a broader range of pollutants, incorporate hydrodynamic modeling for improved simulation of pollutant transport, and develop real-time ML-based prediction systems to enhance early warning and adaptive water quality management. Supplementary Information Below is the link to the electronic supplementary material. (DOCX 1.07 MB) Acknowledgements The authors sincerely thank Dr. Andrew Hursthouse, Editor of Environmental Monitoring and Assessment, and the two anonymous reviewers for their constructive comments and valuable suggestions, which substantially improved an earlier version of this manuscript. This work was supported in part by the Montclair State University Doctoral Assistantship, the Anchor QEA Scholarship, and the ERI Scholarship. Abbreviations Artificial neural network Contamination degree Heavy metal evaluation index Heavy metal pollution index Lower Passaic River Mean absolute error Machine learning Nash–Sutcliffe efficiency Principal component analysis Potential ecological risk index Coefficient of determination Random forest River mile Root mean square error Support vector machine Extreme gradient boosting Author contribution All authors contributed to the study: Md Shahnul Islam-conceptualization; formal analysis; visualization; methodology; software; writing of the original draft. Sara Naveed- review and editing. Huan Feng-supervision, review and editing. Tapos Kumar Chakraborty- review and editing. Funding The authors declare that no funds, grants, or other support were received during the preparation of this manuscript. Data availability The data utilized in this study were obtained from the Passaic River Public Digital Library (https://sharepoint.ourpassaic.org/SitePages/Passaic%20River%20Datasets.aspx). Declarations Competing interests The authors declare no competing interests. Footnotes Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Supplementary Materials (DOCX 1.07 MB) Data Availability Statement The data utilized in this study were obtained from the Passaic River Public Digital Library (https://sharepoint.ourpassaic.org/SitePages/Passaic%20River%20Datasets.aspx).