Abstract
Reliable surface water quality monitoring can support sustainable water resource management and contribute to SDG 6 by helping identify locations that may warrant further investigation. Because WQI-based classes are ordered, evaluating the direction and magnitude of classification errors is relevant to interpreting monitoring results. This study aimed to compare multiclass and ordinal classification in terms of accuracy, error patterns, and the quality of predicted probabilities. A total of 1344 samples from four different water bodies in Ukraine (the Rika River, Lake Pisochne, and the Burulka and Leninsky ponds), subject to varying levels of anthropogenic and recreational pressure, were analyzed. Five water quality classes defined by WQI were predicted using pH and the concentrations of Ni, Co, Zn, Fe, Cu, and Mn. Eleven models were evaluated using repeated nested stratified cross-validation with 25 outer folds. Cumulative Ordinal XGBoost and Cumulative Ordinal CatBoost ranked highest by mean Accuracy, Macro-F1, and QWK, with values of 0.9818, 0.9788, and 0.9955 for XGBoost and 0.9817, 0.9786, and 0.9955 for CatBoost, respectively. The Nadeau–Bengio corrected test detected no statistically significant differences in Macro-F1, QWK, mean absolute class error, or severe error rate between the two ordinal models or between either the ordinal model and its multiclass counterpart. Most incorrect predictions differed from the true class by one level. No critical errors were recorded according to the criteria defined in the study. Cumulative Ordinal CatBoost had the lowest Multiclass Brier Score (0.0285) and ECE (0.0140), whereas the multiclass XGBoost model had the lowest Log Loss (0.0587). Permutation importance analysis showed that Co was the most important feature across all 11 models. In multiclass XGBoost, Cu had the highest mean absolute SHAP value for class III (Satisfactory), while pH ranked first for classes IV (Good) and V (Excellent). In Cumulative Ordinal XGBoost, pH also ranked first for P(Y > 4). Ablation analysis of the multiclass and ordinal XGBoost models showed the greatest performance decline after Co was removed. Evaluating error direction, probability calibration, and feature contributions alongside classification accuracy provides a basis for selecting models to support surface water quality monitoring. Validation on other water bodies and sampling periods is needed before using these models to guide monitoring decisions in new settings.
1. Introduction
Access to safe water has long been a goal of national and international policy, including the ambitious United Nations (UN) Sustainable Development Goal 6 (SDG 6), which aims to ensure safe and affordable water for all by 2030 [1]. However, this goal remains out of reach for many countries today and is likely to remain so in the near future. In many regions of Ukraine, water quality does not meet the maximum permissible concentrations (MPCs) for heavy metals (HMs), owing to several factors, including the ongoing deterioration of water quality. Water bodies of different origins and designated uses are subject to the combined effects of saprobic and toxic factors, including metals [2]. Rising metal concentrations often reduce the biological productivity of water bodies and disrupt metabolic processes in aquatic organisms. Therefore, the concentrations of HMs and their compounds in aquatic ecosystems, particularly in water bodies used for fisheries, require regular environmental analytical monitoring, as these toxicants occur in natural waters at low levels that are often close to the MPCs.
Rivers are considered one of the most important sources of water for irrigation, industrial use, and other purposes. The dynamic nature of river systems and their accessibility for waste disposal make them especially vulnerable to the adverse effects of environmental pollution. Assessing and predicting surface water quality are essential for effective river basin management and for taking appropriate measures to keep pollution levels within permissible limits. Accurately predicting future water quality conditions is central to optimal water resource management.
Heavy metals are major environmental pollutants because of their toxicity, persistence in aquatic environments, and capacity for bioaccumulation. Natural sources include the weathering of rocks containing metals and volcanic eruptions, whereas anthropogenic sources include mining and a range of industrial and agricultural activities. The extraction and processing of mineral resources, along with their subsequent use in industry and agriculture, have increased the release of these elements into the environment and disrupted their biogeochemical cycles. Unlike organic compounds, heavy metals do not degrade naturally and remain in aquatic ecosystem components for long periods [3]. Growing demand for HMs places additional pressure on aquatic ecosystems. The extraction of many metals can increase the concentrations of both the metals and their associated byproducts in soils and water bodies [4].
In general, HMs can be classified as essential or nonessential according to their importance to biota. Their biological or toxic effects can occur at very low concentrations and vary among aquatic species [5]. Essential metals, such as copper (Cu), zinc (Zn), chromium (Cr), nickel (Ni), cobalt (Co), molybdenum (Mo), and iron (Fe), perform important biological functions. A deficiency in these metals can disrupt metabolic processes in aquatic organisms. Nonessential metals, namely cadmium (Cd), mercury (Hg), tin (Sn), and lead (Pb), have no established biological functions. However, when concentrations in water exceed permissible levels, both essential and toxic metals can accumulate in the tissues and organs of aquatic organisms, resulting in toxic effects [6]. Heavy metals, including Cd, Pb, Hg, Cr, Mn, Fe, Co, Ni, Cu, Zn, and As, enter aquatic ecosystems from natural and anthropogenic sources, including mining, metallurgy, transport, wastewater discharge, and the use of fertilizers and pesticides. Once in the aquatic environment, metals partition between the water phase and bottom sediments. Their migration and solubility depend on pH, temperature, dissolved oxygen content, and redox conditions [7]. In addition, metals can undergo biomagnification, or progressive accumulation along food chains, which creates further risks of toxic effects, including potential harm to human health [8].
Because water quality directly affects human health, improving the quality of water available for human use plays a significant role in reducing health risks. In recent years, artificial intelligence (AI) has been recognized as an effective alternative for modeling complex nonlinear systems. Such models generally do not account for internal processes. Instead, they are developed by modeling correlations between input and output data. The Water Quality Index (WQI) combines several water quality measurements into a single value. It has been used to assess drinking water suitability [9], characterize river water quality [10], and evaluate lake conditions alongside indicators of eutrophication [11]. In arid regions, principal component analysis, spatial analysis, and machine learning have been combined to assess groundwater quality [12].
Machine learning has also been applied to estimate water quality indices and individual pollutant concentrations. Of the ten models evaluated for estimating the WQI of the Southern Bug River, Gaussian process regression performed best [13]. Other applications include modeling water pollution and groundwater quality indices in eastern Saudi Arabia [14] and predicting metal concentrations in drinking water distribution systems to assess the associated health risks [15].
Accurately predicting the WQI in polluted rivers is essential for monitoring, managing, and preserving water quality. It enables authorities to take preventive measures to reduce water pollution and assess the effectiveness of water resource restoration strategies [16].
Study [17] calculated the WQI for twelve municipalities in Algeria using physicochemical parameters, including pH, electrical conductivity, total mineralization, calcium (Ca2+), magnesium (Mg2+), sodium (Na+), potassium (K+), chloride (Cl−), sulfate (SO42−), bicarbonate (HCO3−), and nitrate (NO3−). To predict the WQI using ML methods, 151 samples were used to train the classification models, and 18 samples were used for testing. The models included Decision Tree (DT), k nearest neighbors (kNN), Discriminant Analysis (DA), Support Vector Machine (SVM), and Ensemble Trees (ET). Among these models, SVM performed best, achieving 95.4% accuracy with standardized data during cross validation and 88.9% accuracy on the test samples.
In study [18], the authors analyzed 422 samples obtained from publicly available sources to predict the WQI and classify water quality. The input variables included various physicochemical parameters, namely pH, electrical conductivity, dissolved oxygen, temperature, turbidity, and chloride, nitrate, and sulfate concentrations. The authors compared six models: Random Forest (RF), Gradient Boosting (GB), SVM, XGBoost, kNN, and DT. GB achieved the highest accuracy at 96%, followed by RF at 95%. The accuracy was 92% for SVM, 84% for kNN, and 77% for DT.
Study [19] investigated the surface water quality of three rivers in Morocco during the winter and spring of 2023. The analysis covered concentrations of five metals: Cd, Cu, Fe, Pb, and Zn. The Heavy Metal Pollution Index (HPI) was calculated to assess water pollution. The hazard quotient (HQ), hazard index (HI), and carcinogenic risk (CR) were used to assess potential human health risks. To predict metal concentrations, the authors compared three ML models: ANN, SVM, and RF. Overall, ANN produced the best predictions. For individual metals, the coefficient of determination (R2) ranged from 0.82 to 0.99 in winter. However, model performance varied by metal and season.
Study [20] assessed and classified water quality in high altitude glacial lakes and rivers in Pakistan. The authors collected 79 water samples and divided them into training and test sets, comprising 70% and 30% of the data, respectively. Nine physicochemical parameters were used to assess water quality and calculate the WQI: Cd, Cr, Pb, Ni, Fe, As, total mineralization, pH, and electrical conductivity. The Boruta algorithm was used to select the most influential parameters. Five ML methods were applied to classify water quality. The reported accuracy was 88% for SVM, 88% for RF, 83% for DT, 83% for the multilayer perceptron (MLP), and 75% for kNN.
In study [21], samples were collected from 26 groundwater monitoring sites. The input variables comprised concentrations of 16 elements and parameters: Ag, Al, B, Ba, Cd, Co, Cr, Cu, F, Fe, Li, Mn, Mo, Ni, Pb, and Zn. The target variables were the heavy metal pollution indices, namely the HPI, the Heavy Metal Evaluation Index (HEI), and the degree of contamination index (Cd). Five ML algorithms were used to classify and predict the pollution indices: RF, SVM, kNN, DT, and Logistic Regression (LR). The RF and DT models performed best for the HPI and HEI indices, while DT, RF, and LR performed well for the Cd index. Shapley additive explanations (SHAP) feature importance analysis has revealed that Mo was among the most influential factors in estimating all three indices, HPI, HEI, and Cd, with the DT and RF models. Based on the pollution index values, most samples indicated low pollution according to the HPI, moderate pollution according to the HEI, and high pollution according to the Cd index.
Despite these advances, the studies reviewed have focused mainly on predicting water quality indices or classifying water quality. Comparisons of multiclass and ordinal models using the same hydrochemical indicators remain limited. WQI-based water quality classes have a natural order from Very Poor to Excellent, which ordinal classification explicitly incorporates. For environmental monitoring, an error of one class level has different implications from an error spanning several levels. The consequences also depend on the direction of the error. For example, assigning a sample with poor water quality to the Good class may mask unfavorable hydrochemical conditions and delay further investigation. This motivates comparing multiclass and ordinal models in terms of error magnitude, direction, and asymmetric cost. The studies also rarely assess the magnitude and direction of errors between classes, the calibration of predicted probabilities, and the contribution of features to model predictions within a single analysis. Combining these assessments with ablation analysis makes it possible to determine how accounting for class order affects model results and which indicators have the greatest influence on them.
Reliable assessment of WQI-based surface water classes can support the interpretation of monitoring results. Analyzing error direction and prediction confidence may help identify samples that warrant further investigation.
This study aims to compare multiclass and ordinal machine learning (ML) models for predicting five water quality classes from seven hydrochemical indicators in different types of aquatic ecosystems subject to varying levels of anthropogenic pressure. The evaluation covers classification accuracy, the magnitude and direction of ordinal errors, the quality of predicted probabilities, and the interpretation of feature contributions to model predictions using permutation importance, SHAP, and ablation analysis. The study also aims to identify the hydrochemical indicators that contribute most to model predictions of WQI-based water quality classes. For surface water monitoring, overestimating a WQI-based quality class may cause a sample with unfavorable hydrochemical conditions to receive less attention during follow-up. Examining error direction and magnitude alongside probability calibration therefore helps assess whether a model could support the prioritization of follow-up sampling.
2. Materials and Methods
2.1. Dataset and Water Quality Classes
The study was conducted at four water bodies of different types, namely the Rika River in Zakarpattia Oblast, Lake Pisochne in Shatsky National Nature Park, and the Burulka and Leninsky ponds in Kryvyi Rih.
The Rika River belongs to the Middle Transcarpathian hydromorphological district and is located in the Mizhhiria and Khust districts of Zakarpattia Oblast. It is a right bank tributary of the Tisza in the Danube basin, with a bed composed of clay and sand. The river is 92 km long, and its basin covers 1240 km2. The Rika is formed by the Prislop and Torunka streams, which originate from springs on the southwestern slopes of the Verkhovyna Range [22]. The condition of the Rika, which flows mainly through settlements in the two districts, has understandably raised concern among environmental specialists. Not all settlements have functioning wastewater treatment plants, and the operation of those that do is subject to justified criticism. Properly managed sites for storing industrial and household waste are also lacking. As a result, wastewater pollutes water bodies and waterways. Water protection structures, bank protection works, and dams built of sand and gravel are often ineffective during floods and prone to damage. The lack of adequate funding and outdated forest harvesting practices on slopes, together with the use of machinery instead of log skidding systems, lead to disruption of the forest soil cover, soil washout, and erosion [23].
The study ponds, Burulka and Leninsky, are located in Kryvyi Rih, Dnipropetrovsk Oblast, within the Kryvyi Rih Iron Ore Basin. The study area has undergone extensive anthropogenic transformation of its natural relief, drainage network, and catchments as a result of the long-standing development of the mining industry. The region’s main rivers are the Saksahan and Inhulets, both of which belong to the Dnipro River basin. The Saksahan is a left tributary of the Inhulets. It is currently about 140 km long, and its catchment area is approximately 1970 km2 [24]. The hydrographic network of the Kryvyi Rih region includes not only rivers but also numerous ravines, temporary watercourses, and ponds, many of which formed or were substantially altered by economic activity.
The Burulka Pond is a small water body in Kryvyi Rih that has been substantially modified by human activity. Its hydrological characteristics should be considered in the context of the region’s overall catchment system and the considerable anthropogenic pressure on surface waters. The water balance of such a pond is governed by precipitation, surface runoff from the surrounding catchment, evaporation, and possible inflows from the local ravine network. Under the steppe conditions of the Kryvyi Rih region, the balance between precipitation and evaporation is important for seasonal changes in water level. A distinctive feature of the Burulka Pond is that it lies within an area where the natural drainage network has been substantially reconfigured.
The Leninsky Pond is located in the Ternivskyi District of Kryvyi Rih and is a small water body that has been modified by human activity. Its hydrological regime is shaped by the absence of a permanent river inflow, seasonal water exchange, precipitation, surface runoff, and groundwater inflow. The considerable anthropogenic pressure on the pond is associated with nearby gardening cooperatives, recreational use, and changes to the natural catchment. Surface runoff from disturbed areas carries suspended solids, mineral and organic compounds, and HMs into the pond. During summer, intense evaporation, which is typical of the steppe zone, further lowers the water level. The pond’s condition is also closely linked to the extensive transformation of the Kryvyi Rih region’s drainage network caused by long term mining activity [25,26].
Lake Pisochne is of karst origin and is located within Shatsky National Nature Park, in the Western Bug catchment, which is part of the Vistula basin. Groundwater and precipitation are its primary water sources, resulting in one of the lowest mineralization levels among the Shatsky lakes, at approximately 115–116 mg/dm3. Hydrochemically, the water is of the calcium bicarbonate type. Forest cover dominates the catchment, accounting for 70.4%, while agricultural land accounts for only 12.6%. This limits nutrient inputs from surface runoff and helps preserve the lake ecosystem’s natural characteristics [27]. At the same time, the lake is one of the district’s most popular recreational sites and is subject to associated anthropogenic pressure. Despite this, Lake Pisochne has clear water, low nutrient concentrations, and less aquatic vegetation overgrowth than shallower lakes [28].
The total of 1344 samples was calculated as follows: 4 water bodies × 7 sampling sites × 24 months × 2 sampling events per month. Each sample was labeled with the name of the water body, the sampling depth, and the sampling date to ensure proper identification at every stage of the study [29,30,31].
Sampling was conducted in 2023–2024, taking into account the area and morphometric characteristics of the water bodies, spatial heterogeneity, and potential sources of anthropogenic impact. The study included water bodies with different pollution levels: the relatively clean Rika River and Lake Pisochne, and the Burulka and Leninsky ponds, which are subject to substantial anthropogenic pressure (Figure 1). This selection covered a broad range of water quality classes, since studying only one type of water body could have limited class representation. The modeling dataset was anonymized and contained hydrochemical measurements without individual sampling-site identifiers, allowing the analysis to focus on the physicochemical characteristics of the water.
Figure 1.
Water sampling sites: (a) Rika River, (b) Lake Pisochne, (c) Leninsky Pond, and (d) Burulka Pond.
Surface water samples were collected using a Ruttner bathometer (model 436 132, 2 L; HYDRO-BIOS Apparatebau GmbH, Altenholz, Germany) at a depth of 0.2–0.5 m into pre-cleaned polyethylene or chemically resistant colorless glass containers. To determine dissolved heavy metals (Ni, Co, Zn, Fe, Cu, and Mn), samples were filtered through 0.45 µm membrane filters and preserved with concentrated nitric acid at a ratio of 2.5 cm3 per 100 cm3 of sample [29,32,33].
Sampling followed the applicable Ukrainian national standards DSTU ISO 5667-4 and DSTU ISO 5667-6, as well as ISO 5667-1 [29,32,33].
The pH of the water samples was determined potentiometrically using an AL-123 ion analyzer (PBF DESKK, Kyiv, Ukraine) equipped with a combined glass electrode [30]. Following filtration and acid preservation as described above, the samples were preconcentrated according to the laboratory protocol and analyzed by flame atomic absorption spectrophotometry using a C-115M1 instrument (SELMI, Sumy, Ukraine) with a propane–butane–air flame. The analytical wavelengths were 232.0 nm for Ni, 240.7 nm for Co, 213.9 nm for Zn, 248.3 nm for Fe, 324.8 nm for Cu, and 279.5 nm for Mn. The method detection limits after preconcentration were 0.0001 mg/dm3 for Ni, 0.0002 mg/dm3 for Co, and 0.0010 mg/dm3 for Zn, Fe, Cu, and Mn. Without preconcentration, the direct determination limits were 0.0300 mg/dm3 for Fe and 0.0010 mg/dm3 for Mn. Metal concentrations were expressed in mg/dm3 [30].
The modeling dataset (N = 1344) contained no zero values. According to the original laboratory records, measurements recorded at the minimum level for each element were coded using that numerical value: 0.001 mg/dm3 for Cu (n = 298), Zn (n = 112), and Fe (n = 14); 0.004 mg/dm3 for Mn (n = 11); 0.0001 mg/dm3 for Ni (n = 7); and 0.0002 mg/dm3 for Co (n = 7). No sample or individual measurement was excluded from the final dataset because all results met the laboratory calibration and quality-control criteria.
The WQI was used for an integrated assessment of water status and calculated using the weighted average method [34]. It was based on an integrated assessment of a set of hydrochemical parameters, taking into account whether they met the MPCs for water bodies [35]. The WQI calculation included seven indicators: pH, Ni, Co, Zn, Fe, Cu, and Mn. The MPCs for Ni, Co, Zn, Fe, Cu, and Mn were taken from the current Ukrainian surface water quality standards [35] and were 0.01, 0.005, 0.01, 0.05, 0.005, and 0.01 mg/dm3, respectively. A reference value of 7.5 was used for pH. The normalized weights for pH, Ni, Co, Zn, Fe, Cu, and Mn were 0.000185, 0.138863, 0.277726, 0.138863, 0.027773, 0.277726, and 0.138863, respectively.
For each indicator, a water quality subindex was calculated relative to its corresponding standard or reference value using the procedure described in [34]. The WQI was then calculated as the weighted sum of these subindices. Each normalized weight was applied once, during aggregation. The weights were used at full computational precision, while the values reported above were rounded to six decimal places.
Samples were assigned to one of five water quality classes based on the WQI thresholds reported by Ramakrishnaiah et al. [36], with the class names aligned with the five-class ecological classification of surface waters in Ukraine [37]. The class boundaries were defined as follows: Excellent, WQI ≤ 50; Good, 50 < WQI ≤ 100; Satisfactory, 100 < WQI ≤ 200; Poor, 200 < WQI ≤ 300; and Very Poor, WQI > 300.
2.2. Exploratory Data Analysis
The distribution of observations across classes was uneven. Class I, representing very poor water quality, included 205 observations (15.3% of the total sample), while Class II, representing poor quality, included 237 (17.6%), and Class III, representing satisfactory quality, included 215 (16.0%). The largest numbers of samples fell into Class IV, representing good quality, and Class V, representing excellent quality, with 313 (23.3%) and 374 (27.8%) observations, respectively. Together, Classes IV and V accounted for 51.1% of the sample, indicating that samples with good or excellent water quality predominated in the dataset (Figure 2).
Figure 2.
Distribution of water quality classes.
The distribution of samples across water quality classes by water body and year is presented in Table 1.
Table 1.
Number of samples in each water quality class by water body and year.
Analysis using Spearman’s rank correlation coefficient showed that positive monotonic associations predominated among the water quality indicators examined (Figure 3).
Figure 3.
Correlation analysis using Spearman’s rank correlation coefficient.
The strongest associations were found between Ni and Co (ρ = 0.88), Ni and Mn (ρ = 0.88), Co and Mn (ρ = 0.86), and Co and Cu (ρ = 0.84), indicating consistent variation in the concentrations of these metals across the samples. Strong positive correlations were also observed for Ni–Cu (ρ = 0.76), Cu–Mn (ρ = 0.76), Co–Fe (ρ = 0.72), and Ni–Fe (ρ = 0.71).
Moderate positive correlations were found between pH and metal concentrations, including Co (ρ = 0.56), Ni (ρ = 0.52), Mn (ρ = 0.51), Cu (ρ = 0.47), and Zn and Fe (ρ = 0.43).
The strong positive correlations among Ni, Co, Mn, and Cu may indicate common sources or similar migration behavior in the aquatic environment. Correlation analysis is widely used to identify relationships between metal concentrations, determine potential pollution factors, and develop hypotheses about their origins. However, correlation alone does not prove the existence of a common pollution source [38,39,40,41,42].
Figure 4 shows the distribution of pH values across the five water quality classes in the combined dataset for the four studied water bodies.
Figure 4.
Distribution of pH values.
The box plots show a consistent decline in median pH from Class I, representing the poorest water quality, to Class V, representing the best, from 8.4 to 7.2, a decrease of 1.2 units. Class I had the highest median pH and considerable variability. Median pH values for Classes II, III, and IV were 8.0, 7.8, and 7.6, respectively, while the median for Class V was 7.2. Thus, as water quality improves from Class I to Class V, the median pH approaches neutrality. All median values fall within the pH range of 6.5–8.5, which is generally characteristic of most freshwater ecosystems [43]. This pattern does not indicate that lower pH directly reduces water quality, since the classes were determined through an integrated assessment of hydrochemical parameters. However, pH affects the solubility, sorption, and mobility of metals in the water and sediment system [44,45]. Its dynamics were therefore considered in relation to the concentrations of Ni, Co, Zn, Fe, Cu, and Mn. Correlations of varying strength indicate complex, multifactorial interactions between the acid–base status of the water and the metals. Thus, the lower median pH values in the higher quality classes reflect an associated hydrochemical pattern and do not, on their own, indicate a causal effect of pH on water quality class.
Figure 5 shows the distribution of Ni and Co concentrations across the five water quality classes in the combined dataset from the four water bodies.
Figure 5.
Distribution of concentrations: (a) Ni, (b) Co.
Box plot analysis (Figure 5a) showed a decline in median Ni concentration from Class I, representing very poor water quality, to Class V, representing excellent quality. The median concentrations were 0.034, 0.018, 0.011, 0.0065, and 0.0018 mg/dm3, respectively. Class I had the highest median and greatest variability, whereas the median in Class V was approximately 19 times lower and the distribution was more compact.
Differences in Ni concentrations and their variability may be associated with spatial and temporal heterogeneity in hydrochemical conditions and the influence of natural and anthropogenic factors. Ni mobility and bioavailability depend, among other things, on pH, redox conditions, water hardness, organic matter content, and interactions with Fe and Mn hydroxides [46,47,48]. The results indicate an association between higher Ni concentrations and lower water quality classes.
Figure 5b shows the distribution of Co concentrations across the five water quality classes in the combined dataset for the study sites. Median Co concentration declined consistently from Class I to Class V. The median values were 0.022, 0.011, 0.007, 0.0045, and 0.001 mg/dm3, respectively. Thus, the median in Class V was 22 times lower than in Class I. Class I had the highest values and the largest interquartile range, while Class V had the most compact distribution.
Co enters the aquatic environment through the weathering of rocks and soils and through industrial activities such as ore mining and processing. It often migrates alongside Fe and Ni, primarily as Co(II) [49]. The observed trend reflects the statistical structure of the combined dataset and does not indicate a direct causal effect of Co on water quality classification.
Figure 6 shows the distribution of Zn and Fe concentrations across the five water quality classes in the combined dataset for the study sites.
Figure 6.
Distribution of concentrations: (a) Zn, (b) Fe.
Median Zn concentrations in Figure 6a were 0.008, 0.007, 0.005, 0.003, and 0.002 mg/dm3 for Classes I–V, respectively. The highest median, the largest interquartile range, and occasional outliers (0.015–0.016 mg/dm3) were observed in Class I, whereas variability was minimal in Class V.
Differences in the distribution of Zn across classes may reflect variation in geochemical conditions and the local influence of natural and anthropogenic factors [50]. Zn mobility and bioavailability depend on pH, water hardness, and dissolved organic matter content [51,52]. In the sample studied, Class I was characterized by a higher median Zn concentration and a wider overall range, including occasional high outliers. This indicates an association between Zn concentration and water quality class and may point to a potential role for Zn as an indicator in surface water monitoring. The lower median concentrations in Classes II–V may be related to the binding of the metal to sediments [53].
Figure 6b shows a consistent decline in median Fe concentrations from 0.040 mg/dm3 in Class I, representing very poor water quality, to 0.011 mg/dm3 in Class V, representing excellent quality. Median concentrations in Classes II–IV were 0.030, 0.020, and 0.015 mg/dm3, respectively. The largest interquartile ranges were observed in Classes I and IV. Relative variability was especially pronounced in Class IV because the interquartile range was large in relation to the median.
The distribution of Fe in water may depend on physicochemical conditions and on the processes through which iron enters and is released from the water. In particular, water chemistry and hydrodynamic conditions may affect the release of Fe from corrosion products of iron containing materials [54]. Fe mobility and bioavailability depend on pH, redox conditions, and dissolved organic matter content [55,56,57]. In the Kryvyi Rih Iron Ore Basin, iron ore extraction and the discharge of mine water may also contribute.
Figure 7 shows the distribution of Cu and Mn concentrations across the five water quality classes in the combined dataset for the studied water bodies.
Figure 7.
Distribution of concentrations: (a) Cu, (b) Mn.
Figure 7a shows that median Cu concentrations declined consistently from Class I, representing very poor water quality, to Class V, representing excellent quality, from 0.006 to 0.001 mg/dm3. Variability was greatest in Class I, where the interquartile range was 0.005–0.009 mg/dm3 and the full range was 0.004–0.013 mg/dm3. This may reflect uneven Cu inputs and differences in hydrochemical conditions. Concentrations were lower and distributions more compact in Classes II–V. The overall decrease in variability as water quality class increased indicates that Cu concentrations were heterogeneously distributed across the samples. However, the overlap between class ranges does not support treating Cu as the sole factor in an integrated water quality assessment. The ecological effects of Cu also depend on its chemical speciation and bioavailability [58,59]. Figure 7b shows that median Mn concentrations declined consistently from Class I, representing very poor water quality, to Class V, representing excellent quality, from 0.033 to 0.006 mg/dm3, a decrease of more than fivefold. Variability was greatest in Class I, where the interquartile range was 0.029–0.044 mg/dm3 and outliers reached 0.073 mg/dm3. Distributions were more compact in Classes IV–V, indicating less variation in Mn concentrations in these sample groups.
The observed differences may be associated with natural rock weathering, mining activity, and the redox sensitivity of Mn. Its solubility and migration depend on oxygen conditions, redox conditions, microbial activity, and organic matter content [60]. Thus, Mn concentration may provide useful information about hydrochemical heterogeneity and anthropogenic pressure. However, partial overlap between the ranges of adjacent classes limits its ability to distinguish water quality categories on its own.
2.3. Problem Formulation and Predictor Set
The water quality prediction problem was formulated as a supervised classification task involving five ordered classes. For each water sample, the predictor vector was constructed from seven experimentally measured hydrochemical indicators, namely pH and the concentrations of Ni, Co, Zn, Fe, Cu, and Mn. These seven variables served as predictors in all subsequent models, while ClassWQ was the target variable [61]. All models used the same set of features, ensuring direct comparability between the multiclass and ordinal formulations.
The predictor vector for the i-th water sample was defined as:
where xi is the predictor vector for the i-th water sample, pHi is the measured acidity–alkalinity indicator, Nii, Coi, Zni, Fei, Cui, and Mni are the measured concentrations of nickel, cobalt, zinc, iron, copper, and manganese, respectively, T denotes vector transposition.
The target variable was defined as an integer yi ∈ {1, 2, 3, 4, 5}. Class 1 corresponded to very poor water quality, Class 2 to poor, Class 3 to satisfactory, Class 4 to good, and Class 5 to excellent water quality. The distribution of observations across these five classes and the hydrochemical differences among them were analyzed in Section 2.2.
The overall prediction task had been defined as constructing a function that maps the seven dimensional predictor space to the set of five water quality classes:
where f is the fitted classification model, xi is the predictor vector defined in Equation (1), is the predicted water-quality class for the i-th sample.
A key feature of the task is that the target values are both categorical and ordinal, with the natural ordering (1 < 2 < 3 < 4 < 5). This ordering represents the progression of water quality classes from Very poor to Excellent. Accordingly, the study examined two parallel formulations. In multiclass classification, the five classes were treated as separate categories, and the model estimated the probability that an observation belonged to each class without explicitly accounting for distances between classes. In ordinal classification, class order was incorporated directly into the prediction rule. This design made it possible to assess whether explicitly accounting for class order offers advantages over the standard multiclass formulation when using the same predictor set [62,63].
The WQI value itself was not used as a predictor. The models received seven measured hydrochemical parameters, while ClassWQ served as the target label. pH was recorded as a dimensionless quantity, and the concentrations of Ni, Co, Zn, Fe, Cu, and Mn were expressed in mg/dm3. The final modeling dataset contained 1344 observations with no missing predictor or target values. No imputation, outlier removal, or logarithmic transformation of predictors was applied during modeling. Because some of the algorithms used are sensitive to predictor scale, scaling was not performed globally before the data were split. For models that used standardization, StandardScaler was fitted within the model pipeline on the data supplied for each fit. The inner validation fold used to score a hyperparameter configuration and the outer test fold were excluded when estimating the scaling parameters for the corresponding fit. For the neural networks, StandardScaler was fitted before the early stopping subset was separated, so observations in that subset contributed to the scaling estimates, as described in Section 2.5. The study was designed as a controlled comparison of multiclass and ordinal classification using the same predictors, cross validation structure, and evaluation metrics. The specific algorithms and implementation of the ordinal formulation are described in Section 2.4, while the procedures for model selection and hyperparameter optimization are described in Section 2.5.
2.4. Multiclass and Ordinal Classification Models
Two groups of classification models were defined to compare the standard and ordinal approaches to predicting water quality class. The multiclass group comprised Multinomial Logistic Regression, Random Forest, XGBoost, CatBoost, and MLP implemented in PyTorch 2.7.1+cu118. The ordinal group comprised Cumulative Ordinal Logistic Regression, Cumulative Ordinal Random Forest, Cumulative Ordinal XGBoost, Cumulative Ordinal CatBoost, and the neural models CORAL-MLP and CORN-MLP.
In multiclass classification, each of the five classes was treated as a separate category. For an observation with predictor vector xi, defined in Equation (1), the model estimated the posterior probability of membership in each class. The general prediction rule was expressed as:
where is the predicted class for the i-th sample, Yi is the variable representing the water-quality class for the i-th sample, k is the class index, K is the total number of classes, and xi is the predictor vector for the i-th sample.
Multinomial Logistic Regression was used as a linear probabilistic baseline model [64]. Before training, the predictors were standardized using StandardScaler, which was incorporated directly into the model pipeline. Random Forest used an ensemble of decision trees, allowing it to model nonlinear relationships and interactions among hydrochemical indicators without prior feature scaling [65]. The XGBoost and CatBoost models were gradient boosting methods based on decision trees. The multiclass objective multi:softprob was used for XGBoost, while CatBoost used the MultiClass loss function [66,67]. The multiclass models also included MLP [68], implemented in PyTorch [69]. The predictors were standardized before being input to the neural network. Its hidden layers consisted of fully connected layers with ReLU activation and Dropout regularization, while the output layer contained five units, one for each water quality class [70]. The network was trained using cross-entropy loss and optimized with AdamW [71]. Early stopping based on validation loss was used to reduce the risk of overfitting. The hidden layer architecture, Dropout, learning rate, and weight decay were determined through the hyperparameter optimization described in Section 2.5.
Unlike the multiclass formulation, ordinal classification used information about the natural order of the classes. For classical ordinal models, the five-class problem was converted into K − 1 = 4 cumulative binary classification tasks. For each threshold t ∈ {1, 2, 3, 4}, a separate binary model estimated the probability that the true class exceeded that threshold:
where qi,t is the cumulative probability of exceeding threshold t for the i-th sample, t is the ordinal threshold between adjacent classes.
Four binary estimators were trained for each classical cumulative ordinal model, with targets Y > 1, Y > 2, Y > 3, and Y > 4. Logistic Regression, Random Forest, XGBoost, and CatBoost served as base estimators. This yielded four models: Cumulative Ordinal Logistic Regression, Cumulative Ordinal Random Forest, Cumulative Ordinal XGBoost, and Cumulative Ordinal CatBoost. For these models, XGBoost used the binary objective binary:logistic, while CatBoost used Logloss.
Because the four binary models estimated the exceedance probabilities separately, the estimates qi,t in Equation (4) could violate the required nonincreasing order. For each sample, we applied a cumulative minimum across thresholds in ascending order and then clipped the resulting values to [10−9, 1 − 10−9]. The corrected cumulative probability at threshold t was therefore:
where clip(z, a, b) constrains z to the interval [a,b].
The class probabilities were then derived from the corrected cumulative probabilities as follows:
where P(Yi = k|xi) is the probability that the i-th sample belongs to class k.
After conversion using Equation (6), any class probability below 10−12 was set to 10−12. For each sample, the resulting probabilities were then divided by their sum so that they summed to one. The class with the highest normalized probability was selected as the prediction.
The five class components obtained using the conversion in Equation (6) sum to 1 before the lower bound is applied and the components are normalized. When this conversion is applied to the uncorrected cumulative probability estimates, the component for class t + 1 is negative if qi,t+1 > qi,t. In a separate ablation of monotonicity correction, we quantified the total magnitude of the negative components for each test sample as .
A separate group of ordinal models comprised CORAL-MLP [72] and CORN-MLP [73]. To ensure a controlled comparison, both used the same baseline MLP architecture and hyperparameter search space as the standard MLP implemented in PyTorch. They differed primarily in the formulation of the output layer and loss function. All three neural models used standardization, ReLU, Dropout, AdamW, and the same candidate architectures.
In CORAL-MLP, the hidden network generated a single latent score that was compared with four ordered cutpoints. The cutpoints were parameterized using positive increments, which ensured their correct ordering and, consequently, monotonically decreasing cumulative probabilities. The training targets used a cumulative representation consistent with Equation (4), and optimization used binary cross-entropy with logits across all ordinal thresholds simultaneously. During prediction, the cumulative probabilities were converted into probabilities for the five classes according to Equation (6). CORN-MLP also used four ordinal outputs, but each successive threshold was evaluated conditionally for observations that had passed the preceding thresholds. Consequently, the cumulative probability for a higher class threshold was calculated as the product of the successive conditional probabilities. This conditional formulation ensured ordinal consistency without using independent multiclass outputs. The resulting cumulative probabilities were also converted into class probabilities using Equation (6).
Thus, the experimental design enabled comparisons of linear, tree based, boosting, and neural approaches under two formulations. Multiclass models estimated probabilities for the five classes without explicitly using their order, whereas the cumulative ordinal models, CORAL-MLP, and CORN-MLP directly incorporated the ordinal structure of the target variable. The specific hyperparameter spaces and selection procedure within nested cross validation are described in Section 2.5.
2.5. Nested Cross-Validation and Hyperparameter Optimization
Model evaluation and hyperparameter selection were performed using repeated stratified nested cross validation, which kept model selection separate from the independent evaluation of predictive performance [74,75]. The outer loop used fivefold RepeatedStratifiedKFold with five repetitions, yielding 25 outer test folds for each model. Stratification preserved the proportions of the five water quality classes in the training and test subsets. The random state was set to 42 to ensure reproducibility.
The outer folds were stratified by water quality class without grouping samples by water body, sampling site, or sampling period. Consequently, samples from the same site or from nearby dates could occur in both the training and test sets of the same split. The reported scores reflect internal validation on pooled data from the four water bodies.
For each outer fold, hyperparameter optimization was performed exclusively on the corresponding outer training subset. This subset was further divided using fourfold StratifiedKFold, with the observations shuffled. Each candidate configuration was trained on three inner folds and evaluated on the fourth. Scores were then averaged across the four inner validation folds. Macro-F1 was the primary metric for hyperparameter selection. Candidate configurations were ranked in descending order of their mean inner Macro-F1. If two configurations had the same mean score, the one with the lower standard deviation across the inner folds was preferred.
To limit computational cost, up to 12 candidate hyperparameter configurations were evaluated in each outer fold. When the total number of possible combinations did not exceed 12, the full ParameterGrid was used. For larger search spaces, ParameterSampler was used to draw 12 configurations from the specified search space [76]. Thus, hyperparameter search was performed independently within each outer training subset, without using the corresponding outer test fold.
For Multinomial Logistic Regression and Cumulative Ordinal Logistic Regression, the regularization parameter C was varied over {0.01, 0.1, 1, 10, 100}, and class_weight was set to either None or balanced. StandardScaler was included in the model pipeline, so its parameters were estimated using only the training data in each fold. The same transformation was then applied to the corresponding validation and test data. This prevented information from the validation or test subsets from leaking into model training.
For Random Forest and Cumulative Ordinal Random Forest, the search space included n_estimators values of 300 and 600, max_depth values of None, 8, and 16, min_samples_leaf values of 1, 2, and 4, max_features values of sqrt, 0.7, and 1.0, and class_weight values of None and balanced. For XGBoost and Cumulative Ordinal XGBoost, the search space included n_estimators values of 200, 400, and 700, max_depth values of 3, 5, and 7, learning_rate values of 0.02, 0.05, and 0.1, subsample and colsample_bytree values of 0.8 and 1.0, and reg_lambda values of 1.0 and 5.0. For CatBoost and Cumulative Ordinal CatBoost, the search space included iterations values of 300, 600, and 900, depth values of 4, 6, and 8, learning_rate values of 0.02, 0.05, and 0.1, and l2_leaf_reg values of 3.0, 7.0, and 12.0.
The three PyTorch models, MLP, CORAL-MLP, and CORN-MLP, used the same search space to enable a controlled comparison of the multiclass and ordinal neural formulations. The search covered hidden layer architectures of (64, 32) and (128, 64, 32), Dropout values of 0, 0.10, and 0.25, learning_rate values of 3 × 10−4 and 10−3, and weight_decay values of 10−5, 10−4, and 10−3.
The three neural network models implemented in PyTorch were trained using AdamW for up to 400 epochs. For each fit, the first fold of a shuffled seven-fold stratified split with random seed 42 served as the early stopping subset. The other six folds were used to update the network weights. During hyperparameter tuning, this split was created within the training portion of the corresponding inner fold. Its validation portion was used only to score the configuration. After hyperparameter selection, the same splitting procedure was applied to the entire outer training set. At this stage, the early stopping subset could include observations previously assigned to inner validation folds. Training stopped after 40 consecutive epochs without a decrease in validation loss of more than 10−6 relative to the best recorded value. The weights associated with that value were restored after training. The outer test fold was used only for final evaluation. Before this split, the pipeline fitted StandardScaler on all observations supplied for that fit, including those subsequently assigned to the early stopping subset.
After inner cross validation, the configuration with the highest mean inner Macro-F1 was used to retrain the model on the full outer training subset. The resulting model was evaluated once on the corresponding outer test fold. Predicted classes, class probabilities, performance metric values, and selected hyperparameters were recorded for each fold. This process was repeated across all 25 outer folds and for each model.
Because each observation appeared in the outer test subset once in each of the five repetitions, class probabilities from the corresponding out of fold predictions were averaged across the five repetitions for observation level aggregate analyses. The predicted class was then assigned as the class with the highest mean probability, producing one aggregate out of fold prediction for each observation. The primary model evaluation was based on metrics calculated separately for each of the 25 outer test folds and then aggregated at the model level.
The main experiments used NumPy 1.26.4, pandas 2.3.3, scikit-learn 1.6.1, SciPy 1.13.1, XGBoost 2.1.4, CatBoost 1.2.10, PyTorch 2.7.1+cu118, and SHAP 0.49.1. The random seeds used to generate the outer splits were 42 for the main experiment, 271,870 for the separate calibration experiment, and 100,042 for the original single-feature ablation. In the main experiment, the seed for inner stratified splitting and hyperparameter configuration sampling was 42 + 10,000 m + s, where m denotes the model’s position in the script’s registry and s denotes the outer split index. Both indices start at 1. In the out-of-fold SHAP stability analysis, the seed 161,845 + s was used to select background samples from the training subset and samples for explanation from the test subset.
2.6. Performance Metrics and Ordinal Error Analysis
The models’ predictive performance was evaluated on each held out outer test fold generated by the nested cross validation procedure described in Section 2.5. Because the target classes have a natural ordinal order, the evaluation included both standard multiclass classification metrics [77] and measures that account for the distance between the true and predicted classes. This approach distinguishes errors between adjacent classes from more substantial errors spanning several ordinal levels.
For each outer fold, the script calculated Accuracy, Balanced Accuracy [78], Macro-F1, Weighted-F1, Quadratic Weighted Kappa [79], Mean Absolute Class Error, Root Mean Squared Class Error, Exact Rate, measures of adjacent, severe, and critical errors, error direction, and Asymmetric Cost. The main classification and ordinal metrics are presented in Table 2.
Table 2.
Performance metrics and ordinal error measures used for model evaluation.
If all predictions in an outer test fold were correct, the denominator of AES was zero and AES was treated as undefined for that fold. The mean and standard deviation of AES were calculated only across folds with at least one incorrect prediction.
In the ordinal error analysis, ei = 0 denoted an exact prediction. Errors with |ei| = 1 were classified as adjacent errors, those with |ei| ≥ 2 as severe errors, and those with |ei| ≥ 3 as critical errors. This classification made it possible to assess not only the frequency of incorrect predictions but also their ordinal severity [80]. In particular, an error of one class level was considered separately from errors of two or more levels. These thresholds were used in the metric calculations.
The direction of the error was also analyzed separately. A positive signed class error indicated overestimation, meaning that the predicted water quality class was higher than the true class. A negative value indicated underestimation. Because the classes were coded from 1 for Very poor to 5 for Excellent, overestimation meant that the predicted water quality was better than its actual class. Asymmetric Cost was used to account for the different practical significance of the two error directions. In these calculations, c0 was set to 2 for overestimation, while cu was set to 1 for underestimation. Thus, an overestimation by the same number of class levels received twice the penalty. This weighting reflects the greater undesirability of a model predicting better water quality than the actual class indicates.
Accuracy and Exact Rate are numerically equivalent, but they were used in different contexts in this study. Accuracy was part of the standard set of classification metrics, whereas Exact Rate was considered alongside the adjacent, severe, and critical error rates as part of the ordinal error analysis. Macro-F1 was the primary metric for hyperparameter optimization. QWK, MACE, RMSCE, and the error distance indicators were used to assess how well the predictions aligned with the ordinal structure of the target classes.
All metrics were calculated separately for each of the 25 outer test folds, after which the results were aggregated at the model level. In addition to the metrics listed above, Log Loss, Multiclass Brier Score, and Expected Calibration Error were calculated for the predicted probabilities. Their use in assessing probability quality and calibration is described separately in Section 2.7.
2.7. Probability Calibration and ROC/PR Analysis
In addition to assessing the correctness of class predictions, the quality of the predicted probabilities was analyzed. Log Loss, Multiclass Brier Score, Expected Calibration Error (ECE), and reliability diagrams were used for this purpose [81,82]. Lower values of these metrics indicate better probabilistic performance. Log Loss penalizes confident incorrect predictions more heavily. The Multiclass Brier Score measures the mean squared deviation of predicted class probabilities from the observed class indicators, while ECE assesses agreement between prediction confidence and empirical accuracy. All three metrics were calculated using outer test predictions.
The Multiclass Brier Score was defined as follows:
where N is the number of observations, K is the number of classes, pik is the predicted probability that the i-th sample belongs to class k, and zik is the binary indicator equal to 1 when the i-th sample belongs to class k and 0 otherwise.
The ECE was calculated after dividing predictions into 10 confidence bins. For each observation, confidence was defined as the highest predicted class probability. Mean confidence and empirical accuracy were then compared within each bin [83]. The overall metric was calculated as follows:
where B is the number of confidence bins equal to 10, nb is the number of observations in the b-th bin, N is the total number of observations, accb is the empirical accuracy in the b-th bin, and confb is the mean predicted confidence in the b-th bin.
Sigmoid calibration [84] was evaluated separately for multiclass XGBoost and Cumulative Ordinal XGBoost. In each outer split, hyperparameters were selected using only the outer training subset. With the selected configuration, out-of-fold probabilities for that subset were generated by shuffled four-fold stratified cross-validation. The seed for inner hyperparameter selection and the cross-fitting splits used to train the calibrators was 600,042 + 10,000 m + s, where m denotes the model index in the calibration experiment and s denotes the outer split index. Both indices start at 1.
Before fitting and applying the calibrators, input probabilities p were clipped to [10−9, 1−10−9] and transformed to logits log[p/(1−p)]. Each calibrator was implemented using scikit-learn’s LogisticRegression with solver = “lbfgs”, max_iter = 5000, and the default regularization settings of C = 1.0 and an L2 penalty. For the multiclass model, five calibrators were fitted with binary targets I(Y = k), one for each class. The calibrated probabilities were clipped to a lower bound of 10−12 and divided by their sum. For the ordinal model, four cumulative probabilities P(Y > k) were derived from the class probabilities. A separate calibrator was fitted for each threshold using I(Y > k) as the binary target. The calibrated cumulative probabilities were corrected using the cumulative minimum and clipped to [10−9, 1−10−9]. Class probabilities were then reconstructed using Equation (6), clipped to a lower bound of 10−12, and normalized. Monotonicity correction was therefore applied twice to Cumulative Ordinal XGBoost in the calibration experiment. The raw threshold probabilities from the base model were first corrected as described in Section 2.4. The correction was applied again after the four threshold probabilities had been calibrated separately to restore their monotonic order before conversion to class probabilities using Equation (6).
Before evaluation, the base model was refitted on the full outer training subset. The calibrators were applied to its predictions for the outer test subset. The calibrated and uncalibrated variants were compared on the same outer test folds using Macro-F1, QWK, MACE, Log Loss, Multiclass Brier Score, and ECE.
A separate threshold specific calibration analysis was conducted to account for the ordinal structure of the task. Cumulative probabilities for the four thresholds Y > 1, Y > 2, Y > 3, and Y > 4 were derived from the class probabilities. For each threshold, a reliability diagram with 10 probability bins was constructed, and the binary Brier Score and threshold specific ECE were calculated. This analysis assessed how well the probability estimates represented not only class membership but also the probability of exceeding each boundary on the ordinal scale.
The additional calibration analysis covered XGBoost, Cumulative Ordinal XGBoost, Cumulative Ordinal CatBoost, and CORAL-MLP. For each sample, class probabilities were averaged over five out-of-fold predictions, one from each repetition of the outer cross-validation. Sensitivity to binning was assessed by computing ECE with 5, 10, and 20 equal-width bins. Class-wise calibration was assessed by comparing the predicted probability of each class with its observed frequency in a one-versus-rest analysis. For ordinal-threshold calibration, the predicted probability P(Y > k) was compared with the observed proportion of samples with Y > k, for k = 1, …, 4. The reliability diagrams show pointwise 95% Wilson intervals for the observed proportions in nonempty bins. These intervals are descriptive given possible spatial and temporal dependence among samples. For predictions with a maximum class probability of at least 0.9, we also report the number of errors and the total number of predictions. Class-wise estimates are reported alongside class counts to show differences that aggregate metrics may obscure.
The models’ discriminative ability was also evaluated using receiver operating characteristic (ROC) and precision–recall (PR) analyses [85,86]. The multiclass formulation used a one versus rest strategy. For each class, observations belonging to that class were treated as positive, and observations belonging to the other four classes were treated as negative. Class specific area under the ROC curve (ROC AUC) and average precision (AP) were calculated for each model, along with micro, macro, and weighted averages. The macro average assigned equal weight to each class, while the weighted average accounted for class frequency.
Given the ordinal nature of the target variable, ROC and PR analyses were also performed for the cumulative thresholds. For each threshold t ∈ {1, 2, 3, 4}, the binary target was defined as Y > t, and the corresponding prediction score was the cumulative probability of exceeding that threshold. This assessed the models’ ability to distinguish observations on opposite sides of each ordinal boundary. ROC AUC and AP were calculated for each threshold, along with micro, macro, and weighted averages.
The main ROC and PR curves were constructed using repeated out of fold probabilities averaged for each observation across the five outer cross validation repetitions. This aggregation provided one probability estimate per sample and was used to construct the multiclass one versus rest and cumulative threshold curves. ROC AUC and AP were also calculated separately for each of the 25 outer test folds. The mean, standard deviation, and 95% confidence interval were then determined for each model.
For the mean values of metrics calculated across the 25 outer folds, 95% confidence intervals were determined using the two-sided Student’s t distribution: , where and s are the mean and sample standard deviation of the fold level values for the corresponding metric. The conventional t intervals provide a descriptive summary of uncertainty around the mean metric values across folds. Because they do not account for dependence among folds arising from overlapping training sets in repeated cross-validation, they may understate uncertainty. Section 2.8 describes the Nadeau–Bengio correction used to account for this dependence when constructing intervals for paired differences between models.
This combined approach allowed the assessment of both the models’ overall discriminative ability and their ability to distinguish adjacent levels of ordinal water quality.
2.8. Statistical Comparison of Models
The main research hypothesis was that the ordinal formulation improves classification performance over the multiclass formulation when the underlying algorithm is held constant. To assess this hypothesis, the ordinal and multiclass versions of logistic regression, Random Forest, XGBoost, and CatBoost were compared on the same outer splits using Macro-F1, QWK, MACE, and Severe Error Rate.
Statistical comparisons were based on fold level results obtained from the same outer test folds within the repeated stratified nested cross validation procedure. Comparisons were conducted separately for Macro-F1, Quadratic Weighted Kappa (QWK), Mean Absolute Class Error (MACE), and Severe Error Rate. Thus, the statistical analysis covered both standard classification performance and ordinal agreement and error severity.
For each metric, a paired matrix was constructed, with rows corresponding to the 25 outer folds and columns to the individual models. Only folds with available results for all models being compared were included. The Friedman test [87,88] was used to test for overall differences among three or more models. The null hypothesis was that there were no systematic differences in model ranks across the same outer folds. Average ranks were also calculated for each model and metric. For metrics where higher values were better, the highest fold level result received the lowest rank. MACE and Severe Error Rate were ranked in the opposite direction because lower values are better.
Pairwise comparisons across all models were conducted using the two sided Wilcoxon signed rank test [89] on paired outer fold values. For each model pair, the mean and median paired differences, the proportion of outer folds in which each model performed better, the proportion of ties, and the rank biserial effect size were calculated. To control the family wise error rate, multiple pairwise p values were adjusted using the Holm method [90]. Statistical significance was defined as an adjusted p < 0.05.
Because results from repeated cross validation are not statistically independent due to overlap among training sets, conventional pairwise tests were supplemented with an analysis that accounts for this dependence. The Nadeau–Bengio corrected test [91] was used for this purpose. It adjusts the standard error of paired differences to account for the ratio of test and training subset sizes:
where SEcorr is the corrected standard error, n is the number of paired outer-fold comparisons, ntest is the mean number of observations in the outer test subset, ntrain is the mean number of observations in the outer training subset, and is the sample variance of paired performance differences.
The test statistic was calculated using the corrected standard error:
where tcorr is the corrected t-statistic, is the mean oriented paired difference between two models, and SEcorr is the corrected standard error defined in Equation (24).
For metrics where lower values indicate better performance, specifically MACE and Severe Error Rate, the signs of the paired differences were reversed before applying the correction. Consequently, for all four metrics, a positive oriented difference indicated that the first model in a pair performed better than the second, while a negative value indicated that the second model performed better. A 95% corrected confidence interval for the mean difference was also calculated for each model pair.
Frequentist comparisons were supplemented with a Bayesian correlated t test [92], using the same correction for dependence due to cross validation. The region of practical equivalence (ROPE) was set to [−0.005, 0.005]. For each model pair, posterior probabilities were calculated for three outcomes: the first model was practically better, the models were practically equivalent, or the second model was practically better. Differences within the ROPE were treated as practically negligible. The common interval of [−0.005, 0.005] was used as a working threshold for small absolute differences in the original units of each metric. For Severe Error Rate, the threshold of 0.005 corresponds to 0.5 percentage points. For MACE, it corresponds to 0.005 class levels in mean absolute error. For Macro-F1 and QWK, it represents an absolute difference of 0.005 in the respective score. The posterior probabilities of practical equivalence depend on the chosen threshold.
Friedman tests, Wilcoxon signed rank tests with Holm correction, and dependence corrected frequentist and Bayesian comparisons were used to assess three distinct aspects of model performance. The Friedman test assessed whether overall differences in model ranks were present. The Wilcoxon analysis characterized paired differences across the same outer folds, while the corrected frequentist and Bayesian analyses accounted for dependence arising from repeated cross validation. Pairwise comparisons were interpreted by considering small differences in mean performance metrics alongside the corrected statistical tests and Bayesian analysis. Frequentist test results were interpreted using the corresponding p-values and confidence intervals. Practical equivalence was assessed separately using the posterior probability that the difference between models lay within the specified ROPE.
2.9. Explainability and Feature Importance Analysis
The contribution of predictors to model predictions was assessed using two complementary approaches, permutation importance and Shapley Additive exPlanations (SHAP) [93,94]. Permutation importance was applied to all models directly on the outer test folds, whereas SHAP analysis was performed for the selected best multiclass and ordinal models after their hyperparameters were retuned and they were fitted to the full dataset. This separation provided fold-based estimates of predictive importance for all models and a more detailed analysis of the prediction mechanisms of the two leading models.
Permutation importance was calculated separately for each feature on each outer test fold. After the values of a feature were randomly permuted, predictions were generated again, and importance was defined as the decrease in Macro-F1 relative to performance on the unchanged test data. The permutation was repeated 10 times per feature using different random realizations. The measure was summarized as follows:
where PIj is the permutation importance of the j-th feature, R is the number of permutation repeats equal to 10, S is the Macro-F1 on the unchanged outer test fold, and is the Macro-F1 after permuting the j-th feature in the r-th repeat.
Permutation importance was calculated only on observations in the corresponding outer test fold, which had not been used to fit the model for that fold. For each model, fold, and feature combination, the mean importance and within fold standard deviation across the 10 permutations were recorded. After repeated nested cross validation, the values were aggregated across the outer folds. For each model and feature, the mean importance, between fold standard deviation, and mean within fold standard deviation were calculated.
For more detailed model interpretation, SHAP was used with the model agnostic Permutation Explainer. SHAP analysis was conducted for the best multiclass and ordinal models, selected based on the results of the main model comparison. Before interpretation, these models were retuned and fitted to the full dataset. This analysis characterized feature contributions to the predictions of models fitted on the full dataset. The observations used for explanation were drawn from the same dataset.
For the primary SHAP analysis, the explained output was the expected water quality class derived from the predicted class probabilities:
where is the expected predicted class for the i-th sample, K is the number of classes equal to 5, k is the class index, and pik is the predicted probability that the i-th sample belongs to class k.
For the Permutation Explainer, separate background and evaluation samples of 100 and 150 observations, respectively, were randomly selected from the dataset using a fixed random state. The Independent masker was used for masking. Each explanation involved 100 model evaluations.
Global feature importance based on SHAP was defined as the mean absolute SHAP value for each feature:
where is the global SHAP importance of the j-th feature, M is the number of observations in the evaluation sample, and ϕij is the SHAP value of the j-th feature for the i-th observation.
Mean absolute SHAP values were used to rank predictors by the magnitude of their contribution to model output. SHAP bar plots and beeswarm plots were also generated. Bar plots showed the global importance of predictors, while beeswarm plots displayed both the magnitude and direction of SHAP contributions for individual observations. Numerical SHAP values and corresponding global importance scores were stored separately for each selected model.
SHAP ranking stability was assessed for multiclass XGBoost and Cumulative Ordinal XGBoost across the 25 outer splits of the main nested cross-validation. For each split, the models were refitted using only the outer training subset and the hyperparameters selected by inner cross-validation for that split. Within each outer split, we sampled background observations without replacement from the outer training subset and evaluation observations without replacement from the outer test fold. We compared four combinations of background and evaluation sample sizes (40/40, 100/40, 40/150, and 100/150). Each larger sample included all observations from its corresponding smaller sample. For each model within a split, all four configurations used the same refitted model. For each model output, we assessed agreement between configurations by counting the splits with the same top-ranked predictor and averaging the Spearman correlations between the rankings of all seven predictors across splits. With seven predictors, Shapley values were computed by enumerating all 128 feature subsets and marginalizing over the background observations. Predictors were ranked by their mean absolute SHAP values within each split. Stability was summarized by the mean rank and the number of splits in which each predictor ranked first.
In addition to explaining the expected class, class probabilities were analyzed for the best multiclass model, XGBoost, and threshold probabilities were analyzed for the best ordinal model, Cumulative Ordinal XGBoost. For XGBoost, the predicted probabilities of membership in each of the five classes, P(Y = k), where k = {1, 2, 3, 4, 5}, were explained separately. For Cumulative Ordinal XGBoost, the four cumulative probabilities of exceeding the ordinal thresholds, P(Y > t), where t = {1, 2, 3, 4}, were explained according to the ordinal formulation described in Section 2.4. Mean absolute SHAP values were calculated for each output, and bar plots and beeswarm plots were generated.
2.10. Feature Ablation Analysis
To determine how strongly the predictive performance of the selected models depended on each predictor, feature ablation was performed by sequentially removing one predictor from the best multiclass and best ordinal models selected in the main model comparison [95]. The analysis included a baseline variant with all seven predictors and seven reduced variants, each omitting one of the following features: pH, Ni, Co, Zn, Fe, Cu, or Mn. Thus, eight predictor configurations were evaluated for each selected model.
To ensure paired comparisons, the same RepeatedStratifiedKFold splits were used for both selected models and all feature removal variants. Cross validation consisted of five folds and five repeats, yielding 25 train/test splits. The same train/test indices were used for the baseline, all reduced predictor sets, and both selected models. This enabled direct comparison of performance changes after removing a specific predictor on the same test observations.
The ablation analysis used a separate set of 25 stratified splits generated with random_state = 100,042. For each of the two models, hyperparameters were selected once by cross-validation on the full dataset using all seven predictors. The resulting configuration was held fixed for the baseline and all variants with one predictor removed. For each variant, the model was refitted on the training subset of each split and evaluated on the corresponding test subset. In the single-feature ablation, hyperparameters were selected on the full dataset, so observations in the subsequent test subsets influenced the choice of configuration. This introduces information leakage at the tuning stage. The single-feature ablation results were interpreted as paired changes in performance under a fixed configuration. The magnitude of any resulting bias was not quantified.
To assess the sensitivity of the ablation results to hyperparameter retuning, we reused the same 25 outer splits. Within each split, hyperparameters for both models were tuned separately for the full set of seven features and for each set obtained by removing one feature. The full and reduced feature sets shared the same four inner stratified folds and the same 12 candidate configurations within each model and split. The configuration with the highest mean inner Macro-F1 was selected. After refitting on the entire outer training subset, degradation in each metric was evaluated on the corresponding outer test fold relative to the retuned model using all seven features. The fixed-hyperparameter ablation was also rerun in the same computational environment for comparison.
Grouped ablation for multiclass XGBoost and Cumulative Ordinal XGBoost used the 25 outer splits from the main nested cross-validation experiment. For each split and model, we reused the hyperparameters selected in the main experiment using only the corresponding outer training subset and all seven features. Both variants were refitted on the same training subset and evaluated on the same test subset. The baseline used all seven features, and the reduced variant used only pH, Zn, and Fe. Performance changes were calculated relative to the baseline refitted in the same computing environment. For each model, we calculated a 95% confidence interval for the mean paired decrease in Macro-F1 across the 25 outer folds using the Nadeau–Bengio correction described in Section 2.8.
For each model, feature removal variant, and outer split, predicted classes and class probabilities were generated, and the same classification, ordinal error, and probability metrics used in the main analysis were calculated. Fold level results were aggregated across the 25 splits. For each metric, the mean and sample standard deviation were calculated. The 95% confidence interval for the mean was computed using the two sided t method described in Section 2.7, based on 25 fold level values and 24 degrees of freedom.
The effect of removing each predictor was assessed relative to the baseline variant containing all seven predictors. For metrics where higher values indicate better performance, degradation was calculated as the baseline performance minus the performance after feature removal. For metrics where lower values are better, the difference was calculated in the opposite direction. Thus, a positive degradation value consistently indicated a decrease in predictive performance after a predictor was removed.
The primary direct comparison between the best multiclass and best ordinal models was based on Macro-F1, Balanced Accuracy, QWK, MACE, RMSCE, Severe Error Rate, Critical Error Rate, Overestimation Rate, and Asymmetric Cost. For each feature, degradation in each metric was calculated separately for both models, along with the difference between the ordinal and multiclass formulations. A positive difference indicated that the best ordinal model lost more performance after the feature was removed, whereas a negative difference indicated greater sensitivity in the best multiclass model. Paired fold level degradations from the same outer splits were used to statistically compare the effects of feature removal. For each removed feature and metric, degradation in the best ordinal and best multiclass models was compared using a two-sided Wilcoxon signed rank test. The rank biserial effect size, mean degradation for each model, mean difference between formulations, proportion of splits in which degradation was greater for the ordinal model, and proportion of ties were also calculated. p values were adjusted for multiple comparisons using the Holm method separately for each metric. Statistical significance was defined as an adjusted p < 0.05.
Feature ablation complemented permutation importance and SHAP. Unlike permutation-based assessment, which temporarily permutes a predictor in the test data, ablation by removing one feature at a time assessed performance after a predictor was removed entirely and the model refitted without it. This made it possible to determine how strongly each selected model depended on individual hydrochemical predictors and whether this dependence differed between the multiclass and ordinal formulations.
3. Results and Discussion
3.1. Predictive Performance and Ordinal Error Results
This subsection presents the models’ predictive performance and classification error patterns, taking the ordering of water quality classes into account. The evaluation followed the methodology described in Section 2.6. Results for each model are reported as the mean and standard deviation across the 25 outer test folds. The metrics cover overall classification quality, agreement between predictions and the true classes, and the magnitude of the difference between predicted and true classes.
Table 3 presents the mean Accuracy, Balanced Accuracy, Macro-F1, Weighted-F1, and QWK values, allowing the models to be compared in terms of accuracy and agreement while accounting for the ordinal structure of the classes.
Table 3.
Predictive performance and quadratic weighted kappa across models.
As shown in Table 3, Cumulative Ordinal XGBoost and Cumulative Ordinal CatBoost achieved the highest mean metric values. The differences between them were small across all reported metrics. Accuracy was 0.9818 and 0.9817, respectively, while QWK was 0.9955. The standard XGBoost and CatBoost models also performed well, ranking immediately below their cumulative ordinal counterparts.
The rankings based on Balanced Accuracy and Macro-F1 generally agreed with the ranking based on Accuracy. Thus, the two cumulative boosting models retained their advantage on metrics that reflect classification performance across classes. Weighted-F1 values for the leading models were close to their Accuracy values. This consistency across metrics provides a more complete picture of predictive performance than the proportion of correct classifications alone.
Multinomial Logistic Regression and Cumulative Ordinal Logistic Regression had the lowest mean values across the overall metrics. Cumulative Ordinal Logistic Regression had the lowest mean Accuracy, Balanced Accuracy, Macro-F1, Weighted-F1, and QWK among the models compared. The standard deviations across folds reflect variability in the estimates. For Accuracy, they ranged from 0.0072 for Random Forest to 0.0117 for Cumulative Ordinal Logistic Regression. These values describe the spread of results across folds but do not, on their own, establish whether differences between models are statistically significant.
Figure 8a shows the distribution of Macro-F1 across the outer test folds. Figure 8b shows the proportions of observations by absolute class error, calculated from one aggregated out-of-fold prediction for each observation.
Figure 8.
Fold-wise predictive performance and absolute ordinal error: (a) Macro-F1 distribution and (b) absolute class error distribution.
Figure 8a allows comparison of Macro-F1 distributions across models, while Figure 8b shows the proportions of observations by absolute ordinal error, |ei|. The proportion of exact classifications (|ei| = 0) ranges from 95.54% to 98.66%. Errors of one class level (|ei| = 1) account for 1.34% to 4.46%. Errors spanning two class levels occurred only for Random Forest, at 0.074%. No errors spanning three or four class levels occurred in the baseline distribution. Thus, incorrect predictions generally differed from the true class by one ordinal step. Together, Figure 8a,b complement Table 3: the former shows variability in Macro-F1, while the latter shows the magnitude of classification errors.
Table 4 presents the mean MACE, RMSCE, Exact Rate, Adjacent Error Rate, and AES values.
Table 4.
Ordinal error magnitude and adjacent error metrics across models.
The ordinal error metrics in Table 4 complement the overall performance measures. The lowest MACE and RMSCE values were obtained by Cumulative Ordinal XGBoost and Cumulative Ordinal CatBoost, while the logistic models had the highest mean values for both metrics. This pattern is generally consistent with the Accuracy and F1 results. Models with higher overall predictive performance also had lower class error values.
Adjacent Error Rate is the proportion of predictions that differ from the true class by one level, whereas AES is the proportion of such errors among incorrect predictions. Mean AES was 1.0 for all models except CORAL-MLP (0.9971) and Random Forest (0.9520). For Cumulative Ordinal XGBoost, all errors in the 24 folds with incorrect predictions were between adjacent classes. Adjacent Error Rate was lower for the boosting models and higher for the logistic regression models. To assess sensitivity to the aggregation method, we also calculated pooled AES as the total number of adjacent-class errors divided by the total number of errors across the outer test folds. Pooled AES was 1.0000 (122 of 122 errors) for Cumulative Ordinal XGBoost, 0.9949 (194 of 195) for CORAL-MLP, and 0.9655 (168 of 174) for Random Forest. Pooled AES was 1.0000 for the remaining eight models.
Table 5 reports Severe Error Rate, Critical Error Rate, Overestimation Rate, Underestimation Rate, and Asymmetric Cost.
Table 5.
Severe, critical, directional, and asymmetric ordinal error metrics across models.
Nonzero mean Severe Error Rate values were observed only for Random Forest and CORAL-MLP. Critical Error Rate was zero for all models. Under the criteria defined in Section 2.6, this indicates that no critical errors occurred in the test folds, while severe errors occurred in only a small number of folds for these two models.
Overestimation Rate and Underestimation Rate show the direction of prediction errors. For Cumulative Ordinal XGBoost, Cumulative Ordinal CatBoost, and standard XGBoost, the mean overestimation rate was slightly higher than the underestimation rate. The pattern was reversed for Cumulative Ordinal Random Forest, for which Underestimation Rate exceeded Overestimation Rate. Both logistic models had higher values for both measures than the boosting models. Figure 9 visualizes this comparison.
Figure 9.
Directional ordinal error rates across predictive models.
The Asymmetric Cost results are consistent with the overall model rankings based on predictive performance and ordinal error metrics. Cumulative Ordinal XGBoost had the lowest mean value, followed by Cumulative Ordinal CatBoost and standard XGBoost. The two logistic models had the highest values. Taken together, the overall metrics, ordinal error measures, and rates of overestimation and underestimation indicate that the cumulative boosting models performed best in this evaluation. For sustainable water quality monitoring, assessing the direction and magnitude of errors alongside probability calibration characterizes model properties that are important for interpreting WQI class predictions and planning future monitoring.
3.2. Pairwise Statistical Results of Model Comparisons
Statistical comparisons followed the procedure described in Section 2.8 and used paired results for 11 models across the same 25 outer folds. The analysis covered Macro-F1, QWK, MACE, and Severe Error Rate. The Friedman test was first used for the overall comparison, followed by pairwise comparisons using the Wilcoxon signed rank test with Holm correction. Dependence among repeated cross validation results was also addressed using the Nadeau–Bengio corrected test and the Bayesian correlated t test with a ROPE of [−0.005, 0.005].
Table 6 reports the Friedman test statistics and corresponding p values for comparing the 11 models across the four metrics.
Table 6.
Friedman test results for model comparisons.
The Friedman test detected overall differences among the models for all four metrics. The largest test statistics were observed for QWK and MACE. The statistic for Severe Error Rate was lower, but the result remained statistically significant. This indicates overall differences in model ranks, but does not mean that every pair of models differs significantly. Pairwise results are presented separately.
Figure 10.
Average outer-fold ranks for predictive performance metrics: (a) Macro-F1 and (b) QWK.
Figure 11.
Average outer-fold ranks for ordinal error metrics: (a) MACE and (b) Severe Error Rate.
For each metric, a lower mean rank indicates better performance. Cumulative Ordinal CatBoost and Cumulative Ordinal XGBoost had the two best ranks for Macro-F1, QWK, and MACE. Their mean ranks for Macro-F1 were 3.04 and 3.32, respectively, and for QWK they were 3.10 and 3.26. Both models ranked ahead of standard CatBoost and XGBoost. The logistic models had the highest, and therefore worst, ranks for these metrics. This ranking is consistent with the overall Friedman test result, but it does not establish a significant difference between the two leading models.
For Severe Error Rate, most models had the same mean rank, reflecting the large number of ties for this metric.
For MACE, the lowest mean ranks were also observed for Cumulative Ordinal CatBoost (3.06) and Cumulative Ordinal XGBoost (3.26). Nine models had a mean rank of 5.88 for Severe Error Rate. The mean rank was 6.10 for CORAL-MLP and 6.98 for Random Forest. Despite the significant overall Friedman test result, pairwise testing with Holm correction revealed no significant differences between models for Severe Error Rate. Thus, this metric distinguished between models overall but did not establish statistically significant pairwise differences after correction for multiple comparisons.
Table 7 summarizes the pairwise statistical comparisons across the four metrics. Full results for all 55 model pairs are provided in Supplementary Table S1. They include mean and median paired differences, the proportions of folds in which each model performed better, tie proportions, rank biserial effect sizes, adjusted p values, corrected 95% confidence intervals, and Bayesian posterior probabilities.
Table 7.
Summary of pairwise statistical comparisons.
After Holm correction, 34 of the 55 pairwise comparisons were statistically significant for Macro-F1, 39 for QWK, and 37 for MACE. No significant pairs were found for Severe Error Rate. In particular, the comparison between Cumulative Ordinal CatBoost and Cumulative Ordinal Logistic Regression was significant for Macro-F1, QWK, and MACE after Holm correction (pHolm = 3.28 × 10−6 for each metric), but not for Severe Error Rate. Cumulative Ordinal CatBoost performed better in all 25 folds for Macro-F1 and QWK and had lower MACE in all 25 folds. The two models had identical Severe Error Rate results across all folds.
Pairwise differences between the two models with the best mean ranks were not significant after Holm correction. The Holm adjusted Wilcoxon p values were 1.0 for Macro-F1, QWK, and MACE. This is consistent with the Nadeau–Bengio test, for which p values for this pair ranged from 0.9667 to 1.0, and the 95% corrected confidence intervals included zero. The Bayesian analysis also showed that practical equivalence had the highest posterior probability for these models across all four measures. The posterior probabilities of equivalence within the ROPE were 0.7645 for Macro-F1, 1.0 for QWK, 0.8237 for MACE, and 1.0000 for Severe Error Rate.
Table 8 compares the cumulative ordinal and multiclass versions of logistic regression, Random Forest, XGBoost, and CatBoost using paired scores from the same 25 outer folds. The table presents the corresponding results from Supplementary Table S1. The Holm-adjusted p-values were taken from the original analysis of all 55 model pairs for each metric.
Table 8.
Direct comparisons of cumulative ordinal and multiclass models within each algorithm.
The Holm-adjusted Wilcoxon test identified a significant difference only for Random Forest on QWK. The cumulative ordinal version had a mean QWK 0.0015 higher than the multiclass version (pHolm = 0.0261). The corresponding Nadeau–Bengio corrected confidence interval included zero, and the posterior probability of practical equivalence was 0.9929. For XGBoost and CatBoost, neither frequentist test detected significant differences on any of the four metrics. For all four model pairs and metrics, practical equivalence within the specified ROPE was the most probable Bayesian outcome.
The Friedman test detected overall differences in ranks among the 11 models for all four metrics (Table 6). Cumulative Ordinal CatBoost and Cumulative Ordinal XGBoost had the best mean ranks for Macro-F1, QWK, and MACE. The Nadeau–Bengio corrected test detected no statistically significant differences on any of the four metrics between these two models (Table 7) or between either ordinal model and its multiclass counterpart (Table 8). For each of the three pairs and each metric, practical equivalence within the specified ROPE had the highest posterior probability.
3.3. Probability Calibration and Discrimination Results
Prediction quality depends not only on whether a model correctly assigns an observation to a class but also on how closely its confidence estimates correspond to observed outcomes. This subsection therefore examines the calibration of predicted probabilities and the models’ ability to distinguish among water quality classes. These characteristics complement one another. A model may distinguish classes well while systematically overestimating or underestimating its predicted probabilities. Analyzing both aspects makes it possible to assess the reliability of probabilistic predictions as well as the models’ ability to distinguish among classes and ordinal thresholds.
Log Loss, Multiclass Brier Score, and ECE were calculated separately for each of the 25 outer test folds of the main experiment and then averaged across folds. For the comparison of uncalibrated and sigmoid-calibrated models, metrics were likewise calculated separately on the 25 outer test folds of the calibration experiment and then averaged. For the threshold-specific Binary Brier Score and ECE and for Figure 12, Figure 13 and Figure 14, the predicted probabilities for each class were first averaged across the five out-of-fold predictions per sample from the main experiment. The resulting probability vectors were used to derive the maximum class probability for Figure 12 and the exceedance probabilities P(Y > k) for the threshold-specific metrics and Figure 13 and Figure 14.
Figure 12.
Reliability diagrams for the predicted class for (a) XGBoost, (b) Cumulative Ordinal XGBoost, (c) Cumulative Ordinal CatBoost, and (d) CORAL-MLP. Error bars show pointwise 95% Wilson intervals for the observed proportion of correct predictions in nonempty bins.
Figure 13.
Reliability diagrams for the four ordinal exceedance probabilities. Panels show Cumulative Ordinal XGBoost at thresholds (a) Y > 1, (b) Y > 2, (c) Y > 3, and (d) Y > 4; Cumulative Ordinal CatBoost at thresholds (e) Y > 1, (f) Y > 2, (g) Y > 3, and (h) Y > 4; and CORAL-MLP at thresholds (i) Y > 1, (j) Y > 2, (k) Y > 3, and (l) Y > 4. Error bars show pointwise 95% Wilson intervals for the observed exceedance proportions in nonempty bins.
Figure 14.
Cumulative-threshold discrimination of Cumulative Ordinal CatBoost: (a) ROC curves and (b) Precision–Recall curves.
Table 9 reports Log Loss, Multiclass Brier Score, and ECE for the 11 models across the 25 outer folds. Values are reported as means with 95% confidence intervals.
Table 9.
Probability-quality metrics across 25 outer test folds.
The lowest mean Log Loss was observed for XGBoost, at 0.0587. Cumulative Ordinal CatBoost had the lowest Multiclass Brier Score and ECE, at 0.0285 and 0.0140, respectively. Thus, the best results across the probability metrics were not concentrated in a single model. CORAL-MLP had the highest values for all three metrics, including an ECE of 0.1048. This indicates a greater mismatch between the model’s predicted confidence and its observed accuracy than for the other models evaluated.
Figure 12 shows reliability diagrams for the predicted class for XGBoost, Cumulative Ordinal XGBoost, Cumulative Ordinal CatBoost, and CORAL-MLP. Each point compares the mean predicted confidence with the observed proportion of correct predictions in the corresponding bin.
Table S4 shows how ECE varied with the number of bins. For example, for Cumulative Ordinal CatBoost, ECE increased from 0.0115 with 10 bins to 0.0146 with 20 bins. Among predictions with confidence of at least 0.9, the four models made between three and five errors, while the number of predictions in this group ranged from 581 to 1254. Table S4 therefore reports error counts together with the corresponding denominators and descriptive 95% Wilson intervals. The ECE values in Table S4 were calculated from probabilities averaged across repetitions. The probability-quality table in the main text summarizes metrics calculated separately for each outer test fold.
The class-wise reliability diagrams and ECE values are presented in Figure S1 and Table S5, respectively. Class III (Satisfactory) had the highest class-wise ECE for all four models, with values ranging from 0.0095 for XGBoost to 0.0731 for CORAL-MLP. Reporting results separately for each class makes these differences visible despite the unequal class sizes.
Sigmoid calibration was assessed for the selected best multiclass model, XGBoost, and the best ordinal model, Cumulative Ordinal XGBoost. Table 10 reports the results for all six metrics specified in the methodology.
Table 10.
Comparison of uncalibrated and Sigmoid-calibrated selected models.
Probability calibration was evaluated in a separate experiment using repeated nested stratified cross-validation with five folds and five repeats. A separate fixed random state of 271,870 was used to generate the outer folds in this experiment. Hyperparameters were retuned within the training subset of each outer fold. Table 10 reports the mean values across the 25 outer test folds. Therefore, the uncalibrated values in this table differ from the main cross-validation results reported in Table 3, Table 4 and Table 9.
For both models, sigmoid calibration reduced Log Loss, Multiclass Brier Score, and ECE. XGBoost also showed small improvements in Macro-F1, QWK, and MACE. For Cumulative Ordinal XGBoost, Macro-F1 decreased slightly, MACE increased slightly, and QWK was 0.9958 in both variants at the reported precision. Thus, in this comparison, calibration improved the probability quality metrics for both models, while changes in classification and ordinal metrics remained small. These descriptive differences were not tested separately for statistical significance.
The calibration of probabilities for exceeding each of the four ordinal thresholds, P(Y > 1), P(Y > 2), P(Y > 3), and P(Y > 4), was analyzed separately. Table 11 presents the full Binary Brier Score and threshold specific ECE values for all 11 models.
Table 11.
Threshold-specific binary brier scores and expected calibration error.
Cumulative Ordinal CatBoost had the lowest Binary Brier Score for the Y > 1, Y > 2, and Y > 3 thresholds. XGBoost had the lowest value for Y > 4. Cumulative Ordinal CatBoost also had the lowest ECE for Y > 1 and Y > 4, while CORN-MLP had the lowest ECE for Y > 2 and Y > 3. CORAL-MLP had the highest threshold specific ECE at all four thresholds.
A separate analysis of monotonicity correction showed that independently estimated cumulative probabilities could produce negative components when converted into class probabilities. The mean total magnitude of these negative components across the outer folds was 0.0888% of unit probability mass for Cumulative Ordinal Logistic Regression, 0.2307% for Cumulative Ordinal Random Forest, 0.1966% for Cumulative Ordinal XGBoost, and 0.1776% for Cumulative Ordinal CatBoost. After monotonicity correction, all five class probabilities obtained using Equation (6) were nonnegative.
Figure 13 shows threshold-specific reliability diagrams for Cumulative Ordinal XGBoost, Cumulative Ordinal CatBoost, and CORAL-MLP. The number of samples exceeding each threshold was 1139 for Y > 1, 902 for Y > 2, 687 for Y > 3, and 374 for Y > 4. For the two cumulative ordinal boosting models, Y > 2 had the highest binary Brier score, while Y > 3 had the highest threshold-specific ECE. These results show that the assessment of calibration depends on both the ordinal threshold and the metric used.
ROC AUC and Average Precision were used to assess discriminative ability. Table 12 summarizes the lowest and highest results among the 11 models for the one versus rest and cumulative threshold analyses. The table reports the mean, standard deviation, and 95% confidence interval across the 25 outer folds.
Table 12.
Cross-model ranges of ROC-AUC and average Precision across 25 outer folds.
In the one versus rest analysis, Cumulative Ordinal Logistic Regression had the lowest results across all three averaging schemes. XGBoost achieved the highest ROC AUC values, while Cumulative Ordinal CatBoost had the highest macro and weighted Average Precision values. In the cumulative threshold analysis, Cumulative Ordinal CatBoost achieved the best results across all three averaging schemes. Overall, all ROC AUC and Average Precision values were high, although one versus rest Average Precision varied more than ROC AUC for some models.
Table 13 presents the ranges of class specific one versus rest metrics across the five classes and the metrics across the four cumulative thresholds. Supplementary Table S3 provides the full ROC AUC and Average Precision values for each of the 11 models, each class, and each threshold, as well as for the micro, macro, and weighted averaging schemes.
Table 13.
Class-wise and ordinal-threshold ROC-AUC and average Precision ranges from averaged OOF probabilities.
The lowest class-specific metric values were observed for Satisfactory, with ROC-AUC ranging from 0.9879 to 0.9975 and Average Precision from 0.9296 to 0.9864. For Very poor and Excellent, ROC-AUC ranged from 0.9999 to 1.0000, while Average Precision ranged from 0.9998 to 1.0000 and from 0.9999 to 1.0000, respectively. Among the cumulative thresholds, Y > 2 had the lowest values, with ROC-AUC ranging from 0.9945 to 0.9991 and Average Precision from 0.9973 to 0.9995. For the remaining thresholds, both metrics ranged from 0.9999 to 1.0000. Thus, despite strong overall class discrimination, performance varied by class and ordinal threshold.
Figure 14 shows the ROC and Precision–Recall curves for the same predictions after conversion to the four cumulative thresholds. For this model, the lowest values across the thresholds occurred for Y > 2, with an ROC AUC of 0.9991 and Average Precision of 0.9995. Values for the other thresholds were close to 1.
Taken together, the results show that high discriminative ability, as measured by ROC AUC and Average Precision, does not necessarily coincide with equally good calibration. This was particularly evident for CORAL-MLP, which had high ROC and PR metrics but also the highest ECE among the models. Sigmoid calibration reduced Log Loss, Brier Score, and ECE for the two selected models, with little change to their classification metrics. However, Satisfactory and the Y > 2 threshold remained relatively more difficult to distinguish than the other classes and ordinal thresholds.
3.4. Permutation Importance and SHAP Results
High classification accuracy alone does not reveal which hydrochemical indicators have the greatest influence on model predictions or whether their roles are consistent across water quality classes. This subsection presents the results of two complementary analyses described in Section 2.9. Permutation importance measures the change in Macro-F1 after feature values are permuted in the outer test folds, while SHAP characterizes feature contributions to the predictions of the two selected models. The primary SHAP output was the expected water quality class. Class specific probabilities and probabilities of exceeding ordinal thresholds were also assessed.
Permutation importance was calculated for all 11 models and seven features. Table 14 reports the mean decrease in Macro-F1 after permuting each feature, the standard deviation of this measure across the 25 outer folds, and the mean within fold standard deviation across the 10 permutations. Each cell reports the mean ± standard deviation across folds, with the mean within fold standard deviation in parentheses.
Table 14.
Outer-fold Permutation Importance by model and predictor.
Cobalt (Co) had the highest permutation importance in all 11 models. The mean decrease in Macro-F1 after permuting Co ranged from 0.3293 for CORAL-MLP to 0.4462 for Cumulative Ordinal XGBoost. This indicates that the predictions of every model relied most heavily on information associated with Co. The importance ranking of the other features varied by model. For multiclass Random Forest and XGBoost, pH ranked second after Co. In their cumulative ordinal counterparts, Cu ranked second for Random Forest and Mn ranked second for XGBoost. Mn, Cu, or Ni had high importance values for CatBoost and the neural models. Thus, Co’s dominance was consistent across models, while the contributions of the remaining features depended on the algorithm and how it accounted for class order. This ranking was obtained from the pooled samples from all four water bodies. Industrial and mining activities in Kryvyi Rih may contribute to locally elevated Co concentrations in the Burulka and Leninsky ponds. The contribution of samples from these ponds to the overall feature ranking was not assessed separately.
For a more detailed interpretation of the two selected models, SHAP values were calculated for the expected water quality class. Table 15 reports the mean absolute SHAP values for all seven features. These values indicate the magnitude of each feature’s contribution to the expected class value, but not its direction.
Table 15.
Global mean absolute SHAP values for the expected water-quality class.
In both models, Co had the highest mean absolute SHAP value. For XGBoost, Ni and pH ranked next in importance, whereas for Cumulative Ordinal XGBoost the next most important features were Cu, Mn, and Ni. This agreement with permutation importance on the top ranked feature reinforces the conclusion that Co played a leading role in the predictions of both models. The rankings of the other features did not fully coincide, consistent with the differences between the multiclass and cumulative ordinal formulations. In the aquatic environment, Co occurs predominantly as mobile Co2+ ions and generally migrates together with Fe and Ni. Its solubility and accumulation in bottom sediments are closely related to the acid–base status of the water, represented by pH, and to the content of Fe and Mn hydroxides.
Global SHAP bar plots enable comparison of feature contribution magnitudes between the two models. Figure 15 presents this comparison.
Figure 15.
Global SHAP importance for the expected water-quality class: (a) XGBoost; (b) Cumulative Ordinal XGBoost.
Figure 16 presents beeswarm plots for the same outputs. Unlike bar plots, these show the distribution of SHAP values across observations and allow the direction of each contribution to be compared with the corresponding feature value.
Figure 16.
SHAP Beeswarm plots for the expected water-quality class: (a) XGBoost; (b) Cumulative Ordinal XGBoost.
In the beeswarm plots for both models, higher Co values were predominantly associated with negative SHAP contributions, while lower values were associated with positive contributions. Because the output was the expected class value, this pattern indicates that, within these models, higher Co values generally lowered the expected water quality class, whereas lower Co values raised it. Class specific and threshold SHAP analyses showed that feature rankings varied depending on the predicted output.
Table 16 reports the mean absolute SHAP values for the seven features across the outputs. For XGBoost, it shows feature contributions to the probabilities of the five classes, P(Y = k). For Cumulative Ordinal XGBoost, it shows contributions to the four probabilities of exceeding the ordinal thresholds, P(Y > t).
Table 16.
Class-specific and threshold-specific mean absolute SHAP values.
For XGBoost, Co had the highest mean absolute SHAP value for P(Y = 1), at 0.2389. Co also ranked first for P(Y = 2), at 0.1382, followed by Ni at 0.0833 and Mn at 0.0575. For P(Y = 3), the highest values were for Cu at 0.1295 and Co at 0.1237. For P(Y = 4), pH, Co, and Cu were the leading features, at 0.1435, 0.1240, and 0.1105, respectively. For P(Y = 5), pH had the highest value, at 0.1574. Thus, feature rankings varied by class. Co dominated the predictions for the first two classes, Cu for Satisfactory, and pH for the two highest classes.
For Cumulative Ordinal XGBoost, Co had the highest mean absolute SHAP values for the first three threshold outputs: 0.2481 for P(Y > 1), 0.2279 for P(Y > 2), and 0.2107 for P(Y > 3). For P(Y > 2), the next highest values were for Ni at 0.0734 and Mn at 0.0704. For P(Y > 3), they were for Cu at 0.1448 and Mn at 0.0906. At the highest threshold, P(Y > 4), pH ranked first at 0.1093, followed by Co at 0.0871 and Zn at 0.0591. This indicates that Co had a substantial influence on the model outputs at several thresholds, while pH contributed most to predicting whether the highest threshold was exceeded.
Figure 17 shows the distribution of feature contributions to the P(Y = 3) and P(Y = 4) class probabilities for XGBoost.
Figure 17.
Class-specific SHAP beeswarm plots for XGBoost: (a) P(Y = 3); (b) P(Y = 4).
In Figure 17a, Cu has the highest mean absolute SHAP value for P(Y = 3), consistent with Table 16. High Cu values are predominantly associated with positive SHAP values. In Figure 17b, pH has the highest mean absolute SHAP value for P(Y = 4), and high pH values are also predominantly associated with positive SHAP values. The plots show associations between features and model outputs but do not establish causal effects.
Figure 18 shows the distributions of SHAP contributions for P(Y > 2) and P(Y > 3) in Cumulative Ordinal XGBoost.
Figure 18.
Threshold-specific SHAP beeswarm plots for Cumulative Ordinal XGBoost: (a) P(Y > 2); (b) P(Y > 3).
For both outputs, Co had the highest mean absolute SHAP value. The beeswarm plots show that high Co values were generally associated with negative contributions to these model probabilities, whereas low values more often corresponded to positive contributions. For P(Y > 3), Cu also made a notable contribution, consistent with its second place in Table 16 for this threshold.
Taken together, permutation importance and SHAP indicate that Co makes a substantial contribution to the models’ predictive behavior. At the same time, the class probability analysis for XGBoost and the threshold probability analysis for Cumulative Ordinal XGBoost revealed differences in feature rankings. In particular, Cu was the leading feature for Satisfactory, pH for Good and Excellent and for the P(Y > 4) threshold, while Co ranked highest for most of the other outputs examined. This refines the overall assessment of feature importance by showing that it depends on the specific class or threshold.
In the pooled dataset from the four water bodies, Co ranked first in permutation importance across all 11 models and had the highest global mean absolute SHAP value in both XGBoost models. This ranking describes the contribution of Co to the prediction of water quality classes under the WQI definition used in this dataset. Pairwise Spearman correlations among Ni, Co, Mn, and Cu ranged from 0.76 to 0.88 (Figure 3). Permuting a single feature can disrupt its relationships with other predictors, and SHAP attributions depend on how the method handles feature dependence. When one metal is removed, the remaining correlated predictors can retain some of the shared information. Co’s high ranking therefore describes its role in the model predictions for the predictor set used. The individual feature analyses cannot separate the contribution of Co from the information it shares with the other metals.
Under the WQI calculation used in this study, Co and Cu had the same normalized weight of 0.277726. Thus, the weight alone does not explain why Co ranked first in feature importance. Because the same indicators were used to derive the WQI classes and as model predictors, this ranking describes model dependence on the features under the WQI definition used, rather than establishing independent predictive value for Co. The dataset did not include an independent ecological or biological endpoint; therefore, model performance could not be evaluated against an outcome independent of the WQI-derived classes.
In the outer-fold analysis, Co had the highest mean absolute SHAP value for the expected water quality class in all 25 splits for both models. In multiclass XGBoost, Cu ranked first for class III in 19 of 25 splits, while pH ranked first for classes IV and V in 24 and 25 splits, respectively. In Cumulative Ordinal XGBoost, Co ranked first at each of the three lower thresholds in all 25 splits, while pH ranked first at P(Y > 4) in 23 splits. Co’s leading rank for the expected class was therefore stable across the splits, while the rankings for individual outputs varied by class or threshold. Table S6 summarizes the stability of the leading predictors across outer splits for the 40/40 configuration. Table S7 compares all four sample size configurations. Co ranked first for the expected class in both models in all 25 splits under every configuration. In multiclass XGBoost, Cu ranked first for class III in 19 to 22 splits, while pH ranked first for class IV in 23 to 25 splits and for class V in all 25 splits. For P(Y > 4) in Cumulative Ordinal XGBoost, pH ranked first in 23 splits with 40 evaluation observations and in 25 splits with 150 evaluation observations at both background sample sizes. Between the 40/40 and 100/150 configurations, the top-ranked predictor agreed in at least 22 of 25 splits for each model output, and the mean Spearman correlation between predictor rankings was at least 0.923.
3.5. Effects of Feature Removal on Model Performance
This section presents the single-feature and grouped ablation results for multiclass XGBoost and Cumulative Ordinal XGBoost using the protocols described in Section 2.10.
Table 17 presents the baseline results for both models using all seven features. For each metric, the mean, standard deviation, and 95% confidence interval across the 25 splits are reported.
Table 17.
Baseline Performance with All Seven Predictors.
The values in Table 17 differ slightly from the corresponding results in Table 3, Table 4 and Table 5 because the main evaluation and the ablation analysis used different hyperparameter selection procedures and data splits. In the main evaluation, hyperparameters were selected separately within the training subset of each outer fold. The ablation analysis used a separate set of 25 splits and a fixed hyperparameter configuration for each model, as described in Section 2.10. For example, for Cumulative Ordinal XGBoost, mean Macro-F1 and Balanced Accuracy were 0.9788 and 0.9787, respectively, in Table 3 and 0.9776 and 0.9777 in the ablation baseline in Table 17. In the main evaluation, Cumulative Ordinal XGBoost achieved a mean Accuracy of 0.9818 (Table 3). For multiclass XGBoost, mean Macro-F1 was 0.9774 in the main evaluation and 0.9751 in the ablation baseline. In both evaluations, Cumulative Ordinal XGBoost achieved higher Macro-F1 and QWK and lower mean absolute class error than multiclass XGBoost. The baseline values in Table 17 served as the reference for quantifying changes in performance after removing each predictor.
The methodology specifies nine metrics for the primary model comparison. Table 18 reports the mean oriented degradation across these nine metrics after removing each feature. Standard deviations and 95% confidence intervals for each combination of model, removed feature, and metric are provided in Supplementary Table S2. A positive value indicates that the metric worsened after feature removal, while a negative value indicates an improvement.
Table 18.
Mean oriented performance degradation after feature removal.
Removing Co caused the greatest degradation for both models across most metrics. Macro-F1 decreased by 0.0586 for XGBoost and 0.0674 for Cumulative Ordinal XGBoost. Balanced Accuracy degradation was 0.0574 and 0.0669, respectively. The largest increase in RMSCE was also observed after removing Co, at 0.1881 and 0.1897. These results are consistent with the models relying substantially on this feature.
Removing Cu produced the second largest decline in Macro-F1, Balanced Accuracy, QWK, MACE, and RMSCE. Removing Ni also had a notable effect, particularly on Cumulative Ordinal XGBoost. For example, Macro-F1 degradation was 0.0378 for the ordinal model, compared with 0.0278 for XGBoost. The effect of removing Mn was moderate, while removing Fe and Zn generally led to smaller changes.
Removing pH had the smallest effect on Macro-F1 in both models. For XGBoost, degradation values for Macro-F1, Balanced Accuracy, Overestimation Rate, and Asymmetric Cost were slightly negative, indicating small improvements in these metrics. For Cumulative Ordinal XGBoost, degradation was positive for seven metrics and zero for Severe Error Rate and Critical Error Rate. Removing pH resulted in little change to the XGBoost metrics, while Cumulative Ordinal XGBoost showed small declines in Macro-F1 and Balanced Accuracy. This reflects differences between the models in their responses to pH removal in the ablation analysis.
After hyperparameter retuning, removing Co produced the largest mean decrease in Macro-F1 for both models, followed by Cu, Ni, and Mn. Compared with the fixed-hyperparameter rerun, the mean decrease in Macro-F1 after removing Co fell from 0.0605 to 0.0515 for XGBoost and from 0.0676 to 0.0610 for Cumulative Ordinal XGBoost. Supplementary Table S8 reports the results for all removed features across the nine metrics.
Figure 19 visualizes the overall degradation profiles across the nine primary metrics for both models. The heatmap allows comparison of the effects of removing each feature across models and metrics.
Figure 19.
Mean degradation after removing each predictor in the best multiclass and ordinal models across nine primary metrics.
Paired statistical comparisons of model degradation across the same 25 splits were conducted using the two-sided Wilcoxon signed rank test. Table 19 lists the nine comparisons that remained statistically significant after Holm correction. For each comparison, the table reports the mean degradation for both models, the difference between them, the test statistic, the adjusted p value, the rank biserial effect size, and the proportions of splits in which ordinal degradation was greater or the values were tied.
Table 19.
Holm-adjusted significant paired comparisons of feature-removal degradation.
After Holm correction, 9 of the 63 features had significant metric comparisons. All involved removing Co or Ni. For Co removal, the ordinal model had significantly greater degradation in Macro-F1, Balanced Accuracy, and Overestimation Rate. For Ni removal, its degradation was significantly greater for Macro-F1, Balanced Accuracy, MACE, RMSCE, and Asymmetric Cost. For Severe Error Rate after Co removal, the direction was reversed: mean degradation was greater for XGBoost than for Cumulative Ordinal XGBoost. No significant differences in model degradation were found for the other feature and metric combinations.
In the grouped ablation experiment, the full-feature baseline models were refitted as described in Section 2.10, yielding mean Macro-F1 values of 0.9773 for multiclass XGBoost and 0.9800 for Cumulative Ordinal XGBoost. Removing Co, Ni, Mn, and Cu together reduced these values to 0.6325 and 0.6267, respectively. Performance decreases were calculated relative to these refitted baselines. The mean paired decreases were 0.3449 and 0.3534, with corrected 95% confidence intervals of [0.3174, 0.3723] and [0.3250, 0.3817], respectively. Macro-F1 decreased in all 25 outer folds for both models. The proportion of predictions that differed from the observed class by two or more levels increased from zero to 0.1488 and 0.1481, respectively. These results show that after the four metals were removed, pH, Zn, and Fe preserved only part of the models’ ability to distinguish water quality classes.
4. Conclusions
This study compared two machine learning approaches to predicting water quality: multiclass classification, which treated the five classes as separate categories, and ordinal classification, which accounted for their order from Very poor to Excellent. Eleven models were evaluated using the same seven hydrochemical indicators (pH, Ni, Co, Zn, Fe, Cu, and Mn) and 1344 samples from four different aquatic ecosystems in Ukraine: a mountain river, a karst lake, and urban ponds subject to varying degrees of industrial and recreational pressure. This design enabled the approaches to be compared in terms of accuracy, ordinal error magnitude, and the quality of predicted probabilities.
Cumulative Ordinal XGBoost and Cumulative Ordinal CatBoost achieved the highest mean Accuracy, Macro-F1, and QWK. The values were 0.9818, 0.9788, and 0.9955 for Cumulative Ordinal XGBoost and 0.9817, 0.9786, and 0.9955 for Cumulative Ordinal CatBoost, respectively. Both models also had a lower mean absolute class error than their multiclass counterparts. The Nadeau–Bengio corrected test detected no statistically significant differences in Macro-F1, QWK, MACE, or Severe Error Rate between the two ordinal models or between either ordinal model and its multiclass counterpart. For both XGBoost and CatBoost, practical equivalence within the specified ROPE had the highest posterior probability for each of these four metrics.
The comparison also revealed differences in the quality of predicted probabilities. Cumulative Ordinal CatBoost had the lowest mean Multiclass Brier Score (0.0285) and ECE (0.0140), while multiclass XGBoost had the lowest Log Loss (0.0587). Model selection therefore also depends on whether the priority is accurate class assignment or the quality of probability estimates.
In the pooled samples from the four water bodies, Co ranked first in permutation importance across all 11 models and had the highest global mean absolute SHAP value in both XGBoost models. Feature rankings varied across model outputs. In multiclass XGBoost, pH had the highest mean absolute SHAP value for the predicted probabilities of classes IV (Good) and V (Excellent), while Cu ranked first for class III (Satisfactory). In Cumulative Ordinal XGBoost, Co ranked first at the three lower thresholds, and pH ranked first at the highest threshold, P(Y > 4). Ablation analysis confirmed the leading role of Co. Removing it reduced Macro-F1 by 0.0586 for multiclass XGBoost and by 0.0674 for Cumulative Ordinal XGBoost. Removing Cu and Ni also reduced performance, and the ordinal model was more sensitive to Ni removal across several metrics. The feature importance and ablation analyses characterize the contributions of Co, Ni, Cu, and other predictors to model predictions. These contributions varied by model, class, or ordinal threshold and pertain to classification under the WQI definition used in this dataset.
These findings provide a comparative basis for interpreting WQI-based surface water monitoring results. Considering error direction, probability calibration, and feature contributions may help identify predictions that warrant further review. Because the study used WQI classes derived from the same hydrochemical indicators supplied to the models, its conclusions concern classification under this WQI definition. Future work will compare direct multiclass and ordinal classification with regression of continuous WQI values followed by discretization using the class thresholds. It will also examine whether adjacent-class errors concentrate among samples with WQI values close to the thresholds of 50, 100, 200, and 300. Future work will validate the models on data from additional water bodies and sampling periods using independent ecological indicators. This will help assess their applicability to operational monitoring and sustainable water resource management.
Supplementary Materials
The following supporting information can be downloaded at https://www.mdpi.com/article/10.3390/su182312079/s1, Table S1. Full Pairwise Model Comparisons; Table S2. Uncertainty of Oriented Feature Ablation Effects; Table S3. Complete ROC-AUC and Average Precision Results; Table S4. Sensitivity of top-label ECE to binning and high-confidence errors; Table S5. Class-wise ECE and binary Brier scores; Table S6. Stability of leading SHAP predictors across the 25 outer test splits; Table S7. SHAP summaries by predictor and sample size; Table S8. Paired degradation for each outer split. Figure S1 presents one-versus-rest reliability diagrams for the five water quality classes, with pointwise 95% Wilson intervals for the observed class proportions.
Author Contributions
Conceptualization, H.H. and D.T.; methodology, D.T. and H.H.; software, D.T.; validation, D.T.; formal analysis, A.S.; investigation, H.H.; resources, A.S.; data curation, H.H.; writing—original draft preparation, D.T. and H.H.; writing—review and editing, D.T. and H.H.; visualization, D.T.; supervision, A.S.; project administration, A.S.; funding acquisition, A.S. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The raw data supporting the conclusions of this article will be made available by the authors on request. The data that support the findings of this study are available in the Mendeley Data repository at https://data.mendeley.com/datasets/9tt8cxpfkt/1 (accessed on 28 October 2026). The dataset is subject to an embargo, and the files will become publicly available after 31 December 2029. Until the end of the embargo period, this dataset is available from the corresponding author upon reasonable request.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| AP | Average Precision |
| AUC | Area Under the Curve |
| AES | Adjacent Error Share |
| CORAL | COnsistent RAnk Logits |
| CORN | Conditional Ordinal Regression for Neural Networks |
| CV | Cross-Validation |
| ECE | Expected Calibration Error |
| LR | Logistic Regression |
| MACE | Mean Absolute Class Error |
| ML | Machine Learning |
| MLP | Multilayer Perceptron |
| OOF | Out-of-Fold |
| PR | Precision–Recall |
| QWK | Quadratic Weighted Kappa |
| RF | Random Forest |
| RMSE | Root Mean Squared Error |
| RMSCE | Root Mean Squared Class Error |
| ROC | Receiver Operating Characteristic |
| SDG | Sustainable Development Goal |
| SHAP | SHapley Additive exPlanations |
| SVM | Support Vector Machine |
| WQI | Water Quality Index |
| XGBoost | eXtreme Gradient Boosting |
References
- Arora, N.K.; Mishra, I. Sustainable development goal 6: Global Water Security. Environ. Sustain. 2022, 5, 271–275. [Google Scholar] [CrossRef] [Scilit]
- Lynnyk, P.M.; Zhezherya, V.A.; Batoh, S.V.; Zhezherya, T.P.; Klochenko, P.D.; Shevchenko, T.F.; Savytskyi, O.L.; Zubenko, I.B.; Ivanechko, Y.S. Ecological State of Water Bodies in Urbanized Areas: Kytaiiv Ponds; Lynnyk, P.M., Ed.; Lohos: Kyiv, Ukraine, 2015. (In Ukrainian) [Google Scholar]
- Paschoalini, A.L.; Bazzoli, N. Heavy metals affecting Neotropical freshwater fish: A review of the last 10 years of research. Aquat. Toxicol. 2021, 237, 105906. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Jenkins, J.A.; Musgrove, M.; White, S.J.O. Outlining Potential Biomarkers of Exposure and Effect to Critical Minerals: Nutritionally Essential Trace Elements and the Rare Earth Elements. Toxics 2023, 11, 188. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Al Jufaili, S.M.; Adel, M.; Shekarabi, S.P.H.; Copat, C.; Velisek, J. Trace elements in the muscle and liver tissues of Garra shamal from the freshwater ecosystem of Oman: An exposure risk assessment. Environ. Sci. Pollut. Res. 2024, 31, 15199–15208. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Sfakianakis, D.G.; Renieri, E.; Kentouri, M.; Tsatsakis, A.M. Effect of heavy metals on fish larvae deformities: A review. Environ. Res. 2015, 137, 246–255. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Piwowarska, D.; Kiedrzyńska, E. A global perspective on the nature and fate of heavy metals polluting water ecosystems, and their impact and remediation. Crit. Rev. Environ. Sci. Technol. 2024, 54, 19. [Google Scholar] [CrossRef] [Scilit]
- Emon, F.J.; Rohani, M.F.; Sumaiya, N.; Tuj Jannat, M.F.; Akter, Y.; Shahjahan, M.; Abdul Kari, Z.; Tahiluddin, A.B.; Goh, K.W. Bioaccumulation and Bioremediation of Heavy Metals in Fishes—A Review. Toxics 2023, 11, 510. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Nasier, M.; Abdulrazzaq, K.A. Using water quality index to assess drinking water for AL-Muthana Project. J. Eng. 2022, 28, 68–85. [Google Scholar] [CrossRef] [Scilit]
- Makubura, R.; Meddage, D.P.P.; Azamathulla, H.M.; Pandey, M.; Rathnayake, U. A simplified mathematical formulation for Water Quality Index (WQI): A case study in the Kelani River Basin, Sri Lanka. Fluids 2022, 7, 147. [Google Scholar] [CrossRef] [Scilit]
- Menberu, Z.; Mogesse, B.; Reddythota, D. Evaluation of water quality and eutrophication status of Hawassa Lake based on different water quality indices. Appl. Water Sci. 2021, 11, 61. [Google Scholar] [CrossRef] [Scilit]
- El-Rawy, M.; Wahba, M.; Fathi, H.; Alshehri, F.; Abdalla, F.; El Attar, R.M. Assessment of groundwater quality in arid regions utilizing principal component analysis, GIS, and machine learning techniques. Mar. Pollut. Bull. 2024, 205, 116645. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Masood, A.; Niazkar, M.; Zakwan, M.; Piraei, R. A machine learning-based framework for Water Quality Index estimation in the Southern Bug River. Water 2023, 15, 3543. [Google Scholar] [CrossRef] [Scilit]
- Jibrin, A.M.; Al-Suwaiyan, M.; Aldrees, A.; Dan’azumi, S.; Usman, J.; Abba, S.I.; Yassin, M.A.; Scholz, M.; Sammen, S.S. Machine learning predictive insight of water pollution and groundwater quality in the Eastern Province of Saudi Arabia. Sci. Rep. 2024, 14, 20031. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zhang, H.; Wan, T.; Li, X.; Abbas, G.; Lu, J. Using machine learning to predict heavy metal concentrations and induced health risks in drinking water distribution systems from key cities in China. Water Res. 2026, 291, 125148. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Lap, B.Q.; Phan, T.-T.-H.; Nguyen, H.D.; Quang, L.X.; Hang, P.T.; Phi, N.Q.; Hoang, V.T.; Linh, P.G.; Hang, B.T.T. Predicting Water Quality Index (WQI) by feature selection and machine learning: A case study of An Kim Hai irrigation system. Ecol. Inform. 2023, 74, 101991. [Google Scholar] [CrossRef] [Scilit]
- Derdour, A.; Jodar-Abellan, A.; Pardo, M.Á.; Ghoneim, S.S.M.; Hussein, E.E. Designing efficient and sustainable predictions of Water Quality Indexes at the regional scale using machine learning algorithms. Water 2022, 14, 2801. [Google Scholar] [CrossRef] [Scilit]
- Abbas, F.; Cai, Z.; Shoaib, M.; Iqbal, J.; Ismail, M.; Arifullah; Alrefaei, A.F.; Albeshr, M.F. Machine learning models for water quality prediction: A comprehensive analysis and uncertainty assessment in Mirpurkhas, Sindh, Pakistan. Water 2024, 16, 941. [Google Scholar] [CrossRef] [Scilit]
- El Morabet, R.; Barhazi, L.; Bouhafa, S.; Dahim, M.A.; Khan, R.A.; Khan, N.A. Geospatial distribution and machine learning algorithms for assessing water quality in surface water bodies of Morocco. Sci. Rep. 2023, 13, 20599. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Akhlaq, M.; Ellahi, A.; Niaz, R.; Khan, M.; Sammen, S.S.; Scholz, M. Comparative analysis of machine learning algorithms for water quality prediction. Tellus A Dyn. Meteorol. Oceanogr. 2024, 76, 177–192. [Google Scholar] [CrossRef] [Scilit]
- Kara, H. The prediction of heavy metal contamination in groundwater using machine learning algorithms: A case study from the Harran Plain, a major agricultural irrigation area in Türkiye. Environ. Geochem. Health 2025, 47, 328. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kyndiuk, B.V.; Ovcharuk, V.A. Features of the formation of the hydrographic network of Transcarpathia. Ukr. Geogr. J. 2005, 2, 36–39. (In Ukrainian) [Google Scholar]
- Susidko, M.M.; Lukianets, O.I. Possibilities of river runoff assessment in the Carpathians for the coming years considering its long-term fluctuations. Nauk. Pr. UkrNDHMI 1998, 246, 46–55. (In Ukrainian) [Google Scholar]
- Khilchevskyi, V.K.; Sherstiuk, N.P. Long-term changes in the chemical composition of the water of the Inhulets and Saksahan rivers within the Kryvorizkyi Iron Ore Basin (1980–2020). J. Geol. Geogr. Geoecol. 2021, 30, 470–479. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Alokhina, T.M. Influence of the mining industry on gully-ravine system transformation: Using the example of Kryvyi Rih Iron-Ore Basin, Ukraine. SWorldJournal 2025, 33-02, 238–247. [Google Scholar] [CrossRef] [Scilit]
- Oriekhova, O.V.; Kharlamova, A.V.; Pavlichenko, O.F. Environmental and chemical features of water in natural water bodies of the Kryvyi Rih iron ore basin. Bull. Probl. Biol. Med. 2025, 4, 94–105. [Google Scholar] [CrossRef] [Scilit]
- Biedunkova, O.; Kuznietsov, P.; Tsos, O.; Karaim, O. Hydrochemical typology of natural lakes in the Polissia region based on self-organizing maps: Implications for sustainable water resources management. Water 2026, 18, 926. [Google Scholar] [CrossRef] [Scilit]
- Koltun, I.; Khamar, I. Diversity of mollusc communities in some aquatic habitats of Shatsk Lake Area. Stud. Biol. 2022, 16, 71–82. [Google Scholar] [CrossRef] [Scilit]
- DSTU ISO 5667-6:2009; Water Quality—Sampling—Part 6: Guidance on Sampling of Rivers and Streams (ISO 5667-6:2005, IDT). Derzhspozhyvstandart Ukrainy: Kyiv, Ukraine, 2012; 22p. (In Ukrainian)
- Romanenko, V.D. (Ed.) Methods of Hydroecological Research of Surface Waters; Lohos: Kyiv, Ukraine, 2006. (In Ukrainian) [Google Scholar]
- DSTU EN ISO 5667-3:2025; Water Quality—Sampling—Part 3: Guidance on the Preservation and Handling of Samples (EN ISO 5667-3:2024, IDT; ISO 5667-3:2024, IDT). SE “UkrNDNC”: Kyiv, Ukraine, 2025. (In Ukrainian)
- DSTU ISO 5667-4:2003; Water Quality—Sampling—Part 4: Guidance on Sampling from Lakes, Natural and Man-Made (ISO 5667-4:1987, IDT). Derzhspozhyvstandart Ukrainy: Kyiv, Ukraine, 2004; 11p. (In Ukrainian)
- ISO 5667-1:2023; Water Quality—Sampling—Part 1: Guidance on the Design of Sampling Programmes and Sampling Techniques. 4th ed. International Organization for Standardization: Geneva, Switzerland, 2023; 39p.
- Ali, S.Y.; Sunar, S.; Saha, P.; Mukherjee, P.; Saha, S.; Dutta, S. Drinking water quality assessment of River Ganga in West Bengal, India through integrated statistical and GIS techniques. Water Sci. Technol. 2021, 84, 2997–3017. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Romanenko, V.D.; Zhukinskiy, V.M.; Oksiyuk, O.P.; Yatsyk, A.V.; Chernyavskaya, A.P.; Vasenko, O.G.; Vernichenko, G.A.; Lavrik, V.I. Methodology of Ecological Assessment of Surface Water Quality by Relevant Categories; Symbol-T: Kyiv, Ukraine, 2001. (In Ukrainian) [Google Scholar]
- Ramakrishnaiah, C.R.; Sadashivaiah, C.; Ranganna, G. Assessment of Water Quality Index for the Groundwater in Tumkur Taluk, Karnataka State, India. J. Chem. 2009, 6, 523–530. [Google Scholar] [CrossRef] [Scilit]
- Oksiyuk, O.P.; Zhukinskiy, V.M.; Braginskiy, L.P.; Linnik, P.N.; Kuz’menko, M.I.; Klenus, V.G. A complex ecological classification of quality of land surface waters. Hydrobiol. J. 1994, 30, 60–95. [Google Scholar]
- Mukaka, M.M. Statistics corner: A guide to appropriate use of correlation coefficient in medical research. Malawi Med. J. 2012, 24, 69–71. [Google Scholar] [PubMed]
- Wei, H.; Yu, H.; Zhang, G.; Pan, H.; Lv, C.; Meng, F. Revealing the correlations between heavy metals and water quality, with insight into the potential factors and variations through canonical correlation analysis in an upstream tributary. Ecol. Indic. 2018, 90, 485–493. [Google Scholar] [CrossRef] [Scilit]
- Withanachchi, S.S.; Ghambashidze, G.; Kunchulia, I.; Urushadze, T.; Ploeger, A. Water quality in surface water: A preliminary assessment of heavy metal contamination of the Mashavera River, Georgia. Int. J. Environ. Res. Public Health 2018, 15, 621. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Hussain, S.; Habib-Ur-Rehman, M.; Khanam, T.; Sheer, A.; Kebin, Z.; Jianjun, Y. Health risk assessment of different heavy metals dissolved in drinking water. Int. J. Environ. Res. Public Health 2019, 16, 1737. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Saeed, O.; Székács, A.; Jordán, G.; Mörtl, M.; Abukhadra, M.R.; Eid, M.H. Investigating the impacts of heavy metal(loid)s on ecology and human health in the lower basin of Hungary’s Danube River: A Python and Monte Carlo simulation-based study. Environ. Geochem. Health 2023, 45, 9757–9784. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- U.S. Environmental Protection Agency. pH. Available online: https://www.epa.gov/caddis/ph (accessed on 30 August 2026).
- Miranda, L.S.; Wijesiri, B.; Ayoko, G.A.; Egodawatta, P.; Goonetilleke, A. Water-sediment interactions and mobility of heavy metals in aquatic environments. Water Res. 2021, 202, 117386. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Equeenuddin, S.M.; Tripathy, S.; Sahoo, P.K.; Panigrahi, M.K. Metal behavior in sediment associated with acid mine drainage stream: Role of pH. J. Geochem. Explor. 2013, 124, 230–237. [Google Scholar] [CrossRef] [Scilit]
- Santore, R.C.; Croteau, K.; Ryan, A.C.; Schlekat, C.; Middleton, E.; Garman, E.; Hoang, T. A review of water quality factors that affect nickel bioavailability to aquatic organisms: Refinement of the biotic ligand model for nickel in acute and chronic exposures. Environ. Toxicol. Chem. 2021, 40, 2121–2134. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Peters, A.; Wilson, I.; Merrington, G.; Schlekat, C.; Middleton, E.; Garman, E. Assessing the extent of environmental risks from nickel in European freshwaters: A critical reflection of the European Commission’s current approach. Environ. Toxicol. Chem. 2022, 41, 1604–1612. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Rinklebe, J.; Shaheen, S.M. Redox chemistry of nickel in soils and sediments: A review. Chemosphere 2017, 179, 265–278. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Collins, R.N.; Kinsela, A.S. The aqueous phase speciation and chemistry of cobalt in terrestrial environments. Chemosphere 2010, 79, 763–771. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Van Genderen, E.; Adams, W.; Cardwell, R.; Volosin, J.; Santore, R.; Rodriguez, P. An evaluation of the bioavailability and aquatic toxicity attributed to ambient zinc concentrations in fresh surface waters from several parts of the world. Integr. Environ. Assess. Manag. 2009, 5, 426–434. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Price, G.A.V.; Stauber, J.L.; Jolley, D.F.; Koppel, D.J.; Van Genderen, E.J.; Ryan, A.C.; Holland, A. Natural organic matter source, concentration, and pH influences the toxicity of zinc to a freshwater microalga. Environ. Pollut. 2023, 318, 120797. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- DeForest, D.K.; Van Genderen, E.J. Application of U.S. EPA guidelines in a bioavailability-based assessment of ambient water quality criteria for zinc in freshwater. Environ. Toxicol. Chem. 2012, 31, 1264–1272. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- British Columbia Ministry of Environment, Lands and Parks. Ambient Water Quality Guidelines for Zinc: Overview Report; Water Management Branch: Victoria, BC, Canada, 1999. Available online: https://www2.gov.bc.ca/assets/gov/environment/air-land-water/water/waterquality/water-quality-guidelines/approved-wqgs/bc_env_zinc_waterqualityguidelines_overview.pdf (accessed on 30 August 2026).
- Li, M.; Wang, Y.; Liu, Z.; Sha, Y.; Korshin, G.V.; Chen, Y. Metal-release potential from iron corrosion scales under stagnant and active flow, and varying water quality conditions. Water Res. 2020, 175, 115675. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Heikkinen, K.; Saari, M.; Heino, J.; Ronkanen, A.-K.; Kortelainen, P.; Joensuu, S.; Vilmi, A.; Karjalainen, S.-M.; Hellsten, S.; Visuri, M.; et al. Iron in boreal river catchments: Biogeochemical, ecological and management implications. Sci. Total Environ. 2022, 805, 150256. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Natsuike, M.; Kikuchi, T.; Lee, Y.P.; Ito, H.; Fujii, M.; Yoshimura, C.; Watanabe, T. Chemical speciation and bioavailability of iron in natural waters—Linkage of forest, river and sea in view of dynamics of iron and organic matter. J. Jpn. Soc. Water Environ. 2016, 39, 197–210. [Google Scholar] [CrossRef] [Scilit]
- Adams, W.; Blust, R.; Dwyer, R.; Mount, D.; Nordheim, E.; Rodriguez, P.H.; Spry, D. Bioavailability assessment of metals in freshwater environments: A historical review. Environ. Toxicol. Chem. 2020, 39, 48–59. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Di Toro, D.M.; Allen, H.E.; Bergman, H.L.; Meyer, J.S.; Paquin, P.R.; Santore, R.C. Biotic ligand model of the acute toxicity of metals. 1. Technical basis. Environ. Toxicol. Chem. 2001, 20, 2383–2396. [Google Scholar] [CrossRef]
- Santore, R.C.; Di Toro, D.M.; Paquin, P.R.; Allen, H.E.; Meyer, J.S. Biotic ligand model of the acute toxicity of metals. 2. Application to acute copper toxicity in freshwater fish and Daphnia. Environ. Toxicol. Chem. 2001, 20, 2397–2402. [Google Scholar] [CrossRef] [Scilit]
- Godwin, C.M.; Zehnpfennig, J.R.; Learman, D.R. Biotic and abiotic mechanisms of manganese(II) oxidation in Lake Erie. Front. Environ. Sci. 2020, 8, 57. [Google Scholar] [CrossRef] [Scilit]
- Humeniuk, H.; Khomenchuk, V.; Tymoshchuk, D.; Sverstiuk, A. Hydrochemical Data and WQI-Based Water Quality Classes from Four Water Bodies in Ukraine. In Mendeley Data; Version 1; Elsevier: Amsterdam, The Netherlands, 2026; Available online: https://data.mendeley.com/datasets/9tt8cxpfkt/1 (accessed on 30 August 2026).
- McCullagh, P. Regression Models for Ordinal Data. J. R. Stat. Soc. Ser. B Methodol. 1980, 42, 109–127. [Google Scholar] [CrossRef] [Scilit]
- Frank, E.; Hall, M. A Simple Approach to Ordinal Classification. In Machine Learning: ECML 2001; De Raedt, L., Flach, P., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Heidelberg, 2001; Volume 2167, pp. 145–156. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Friedman, J.; Hastie, T.; Tibshirani, R. Regularization Paths for Generalized Linear Models via Coordinate Descent. J. Stat. Softw. 2010, 33, 1–22. [Google Scholar] [CrossRef] [Scilit]
- Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Scilit]
- Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In 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] [Scilit]
- CatBoost. CatBoost: A Fast, Scalable, High-Performance Gradient Boosting on Decision Trees Library. GitHub. Available online: https://github.com/catboost/catboost (accessed on 24 October 2026).
- Hornik, K.; Stinchcombe, M.; White, H. Multilayer Feedforward Networks Are Universal Approximators. Neural Netw. 1989, 2, 359–366. [Google Scholar] [CrossRef] [Scilit]
- Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems 32; Curran Associates, Inc.: New York, NY, USA, 2019; pp. 8024–8035. Available online: https://proceedings.neurips.cc/paper/2019/hash/bdbca288fee7f92f2bfa9f7012727740-Abstract.html (accessed on 24 October 2026).
- Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. J. Mach. Learn. Res. 2014, 15, 1929–1958. Available online: https://www.jmlr.org/papers/v15/srivastava14a.html (accessed on 24 October 2026).
- Loshchilov, I.; Hutter, F. Decoupled Weight Decay Regularization. In International Conference on Learning Representations; ICLR: Appleton, WI, USA, 2019; Available online: https://openreview.net/forum?id=Bkg6RiCqY7 (accessed on 24 October 2026).
- Cao, W.; Mirjalili, V.; Raschka, S. Rank Consistent Ordinal Regression for Neural Networks with Application to Age Estimation. Pattern Recognit. Lett. 2020, 140, 325–331. [Google Scholar] [CrossRef] [Scilit]
- Shi, X.; Cao, W.; Raschka, S. Deep Neural Networks for Rank-Consistent Ordinal Regression Based on Conditional Probabilities. Pattern Anal. Appl. 2023, 26, 941–955. [Google Scholar] [CrossRef] [Scilit]
- Varma, S.; Simon, R. Bias in Error Estimation When Using Cross-Validation for Model Selection. BMC Bioinform. 2006, 7, 91. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Cawley, G.C.; Talbot, N.L.C. On Over-Fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation. J. Mach. Learn. Res. 2010, 11, 2079–2107. Available online: https://www.jmlr.org/papers/v11/cawley10a.html (accessed on 24 October 2026).
- Bergstra, J.; Bengio, Y. Random Search for Hyper-Parameter Optimization. J. Mach. Learn. Res. 2012, 13, 281–305. Available online: https://www.jmlr.org/papers/v13/bergstra12a.html (accessed on 24 October 2026).
- Sokolova, M.; Lapalme, G. A Systematic Analysis of Performance Measures for Classification Tasks. Inf. Process. Manag. 2009, 45, 427–437. [Google Scholar] [CrossRef] [Scilit]
- Brodersen, K.H.; Ong, C.S.; Stephan, K.E.; Buhmann, J.M. The Balanced Accuracy and Its Posterior Distribution. In Proceedings of the 20th International Conference on Pattern Recognition; IEEE: Istanbul, Turkey, 2010; pp. 3121–3124. [Google Scholar] [CrossRef] [Scilit]
- Cohen, J. Weighted Kappa: Nominal Scale Agreement with Provision for Scaled Disagreement or Partial Credit. Psychol. Bull. 1968, 70, 213–220. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Cardoso, J.S.; Sousa, R. Measuring the Performance of Ordinal Classification. Int. J. Pattern Recognit. Artif. Intell. 2011, 25, 1173–1195. [Google Scholar] [CrossRef] [Scilit]
- Brier, G.W. Verification of Forecasts Expressed in Terms of Probability. Mon. Weather Rev. 1950, 78, 1–3. [Google Scholar] [CrossRef] [Scilit]
- Gneiting, T.; Raftery, A.E. Strictly Proper Scoring Rules, Prediction, and Estimation. J. Am. Stat. Assoc. 2007, 102, 359–378. [Google Scholar] [CrossRef] [Scilit]
- Naeini, M.P.; Cooper, G.; Hauskrecht, M. Obtaining Well Calibrated Probabilities Using Bayesian Binning. In Proceedings of the 29th AAAI Conference on Artificial Intelligence; AAAI: Austin, TX, USA, 2015; Volume 29, pp. 2901–2907. [Google Scholar] [CrossRef] [Scilit]
- Niculescu-Mizil, A.; Caruana, R. Predicting Good Probabilities with Supervised Learning. In Proceedings of the 22nd International Conference on Machine Learning; ACM: New York, NY, 2005; pp. 625–632. [Google Scholar] [CrossRef] [Scilit]
- Fawcett, T. An Introduction to ROC Analysis. Pattern Recognit. Lett. 2006, 27, 861–874. [Google Scholar] [CrossRef] [Scilit]
- Davis, J.; Goadrich, M. The Relationship between Precision-Recall and ROC Curves. In Proceedings of the 23rd International Conference on Machine Learning; ACM: New York, NY, 2006; pp. 233–240. [Google Scholar] [CrossRef] [Scilit]
- Friedman, M. The Use of Ranks to Avoid the Assumption of Normality Implicit in the Analysis of Variance. J. Am. Stat. Assoc. 1937, 32, 675–701. [Google Scholar] [CrossRef]
- Demšar, J. Statistical Comparisons of Classifiers over Multiple Data Sets. J. Mach. Learn. Res. 2006, 7, 1–30. Available online: https://www.jmlr.org/papers/v7/demsar06a.html (accessed on 24 October 2026).
- Wilcoxon, F. Individual Comparisons by Ranking Methods. Biom. Bull. 1945, 1, 80–83. [Google Scholar] [CrossRef] [Scilit]
- Holm, S. A Simple Sequentially Rejective Multiple Test Procedure. Scand. J. Stat. 1979, 6, 65–70. Available online: https://www.jstor.org/stable/4615733 (accessed on 24 October 2026).
- Nadeau, C.; Bengio, Y. Inference for the Generalization Error. Mach. Learn. 2003, 52, 239–281. [Google Scholar] [CrossRef] [Scilit]
- Benavoli, A.; Corani, G.; Demšar, J.; Zaffalon, M. Time for a Change: A Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis. J. Mach. Learn. Res. 2017, 18, 1–36. Available online: https://www.jmlr.org/papers/v18/16-305.html (accessed on 24 October 2026).
- Fisher, A.; Rudin, C.; Dominici, F. All Models Are Wrong, but Many Are Useful: Learning a Variable’s Importance by Studying an Entire Class of Prediction Models Simultaneously. J. Mach. Learn. Res. 2019, 20, 1–81. Available online: https://www.jmlr.org/papers/v20/18-760.html (accessed on 24 October 2026).
- Lundberg, S.M.; Lee, S.-I. A Unified Approach to Interpreting Model Predictions. In Advances in Neural Information Processing Systems 30; NeurIPS: San Diego, CA, USA, 2017; pp. 4765–4774. Available online: https://proceedings.neurips.cc/paper_files/paper/2017/hash/8a20a8621978632d76c43dfd28b67767-Abstract.html (accessed on 24 October 2026).
- Guyon, I.; Elisseeff, A. An Introduction to Variable and Feature Selection. J. Mach. Learn. Res. 2003, 3, 1157–1182. Available online: https://www.jmlr.org/papers/v3/guyon03a.html (accessed on 24 October 2026). [CrossRef] [Scilit]
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.




















