## 3 Materials and Methods  
### Data Acquisition and Preprocessing  
The dataset comprises 3276 water samples with nine physicochemical attributes: pH (unitless, range 0-14), hardness (mg/L CaCO\({}_{3}\)), total dissolved solids (mg/L), chloramines (mg/L), sulfate (mg/L), conductivity (\(\mu\)S/cm), organic carbon (mg/L), trihalomethanes (ug/L), and turbidity (NTU). Approximately 10% of entries contained missing values due to sensor limitations, addressed via median imputation. Attribute distributions were analyzed using kernel density estimation to confirm suitability for classification tasks. This investigation employed a comprehensive water potability dataset encompassing multiple physicochemical parameters to develop a binary classification framework distinguishing between potable (drinkable) and non-potable water samples. The dataset incorporates various water quality metrics, including, but not limited to, pH, hardness, solids content, chloramines, sulfates, conductivity, organic carbon, trihalomethanes, and turbidity parameters established by international drinking water standards organizations as critical determinants of water safety. The dataset utilized in this study was obtained from an open-access water quality repository made publicly available via the Data. World platform [24]. It comprises physicochemical measurements relevant to potability classification tasks, including parameters such as pH, hardness, total dissolved solids (TDS), chloramines, sulfate, conductivity, organic carbon, trihalomethanes, and turbidity. This dataset has been widely used in prior water quality modeling studies due to its balanced representation of real-world water samples and diverse feature attributes. Before analytical implementation, a thorough examination of the dataset's characteristics was conducted to ensure robust model development. Statistical analysis revealed several distributional properties inherent to environmental monitoring data, including the presence of missing values attributed to sensor malfunctions or field collection limitations. To address this common challenge in environmental datasets, we implemented a median-based imputation strategy. This methodological choice was predicated on the median's robustness to outliers frequently encountered in water quality parameters, particularly in cases where contamination events may produce extreme values. We employed a median-based imputation strategy, a standard preprocessing technique known for its robustness to outliers frequently observed in water quality parameters, particularly during contamination events [25]. The median imputation can be mathematically represented as follows:  
\[\widehat{x_{i,j}}=\text{median}\big{(}x_{1,i},x_{2,i},\dots,x_{n,j}\big{)} \tag{1}\]  
here, \(\widehat{x_{i,j}}\) denotes the imputed value for the \(i\)-th missing entry in the \(j\)-th feature column, which is derived from the median of all observed values within that feature. To characterize the dataset, we conducted a statistical analysis of attribute distributions using kernel density estimation, confirming their suitability for classification tasks. Frequency analysis revealed the class distribution between potable and nonpotable samples, guiding the selection of a stratified 70:15:15 train-validation-test split to maintain class balance [26]. This split balance training data availability with robust evaluation ensures reliable performance estimates. To ensure complete reproducibility of the computational workflow, deterministic behavior was enforced across all stochastic processes by implementing fixed seed initialization (seed value: 42) across the numerical computational framework, including all random number generators in the NumPy library (2.3.0), PyTorch tensors (2.0), and CUDA (11.8)operations when applicable. This aligns with the standard first-order Markov property, ensuring that the probability of the next state depends only on the current state [27].