The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
💧 Water Potability Prediction: Classification Model Analysis
Author: [Emilie Levenbach] Date: [12-11-2025] Project Goal: To classify water samples as either potable (safe to drink) or non-potable based on their chemical properties.
1. Dataset Selection & Preparation (Part 1)
Chosen Dataset: Water Potability (Source: Kaggle)
| Criterion | Status |
|---|---|
| Size | 3,276 rows, 10 features |
| Type | Mostly numerical |
| Target Variable | Potability (Binary: 1=Potable, 0=Not Potable) |
| ML Task | Classification |
Data Cleaning Decisions
- Missing Values: Missing values were found in
ph,Sulfate, andTrihalomethanes. We used mean imputation to fill these gaps. - Duplicates: Duplicate rows were checked for and removed.
2. Exploratory Data Analysis (EDA) & Research (Part 2)
A. Core Insights (Visual Research)
Research Question 1: What is the distribution of Potable vs. Non-Potable water in the dataset?
[Image of Potability Status Distribution Plot]
Insight: The count plot clearly demonstrates significant class imbalance. The Non-Potable class (0) heavily outweighs the Potable class (1). This imbalance is critical as it biases the model towards predicting the majority class.
Research Question 2: Are water samples with high Hardness more likely to be Potable or Non-Potable?
[Image of Hardness Distribution by Potability Status Box Plot]
Insight: The box plots show that the median and IQR of the Hardness feature are almost identical for both potable and non-potable groups. This indicates that water hardness alone is not an effective feature for differentiating safe drinking water from unsafe water.
Research Question 3: Does the level of Trihalomethanes show any difference between Potable and Non-Potable water?
[Image of Trihalomethanes Distribution by Potability Status KDE Plot]
Insight: The density plot (KDE) shows that the distributions for both classes overlap heavily. This confirms that Trihalomethanes is not an effective feature when used in isolation to predict potability.
B. Outlier Handling Decision
- Decision: Outliers were kept in the dataset.
- Justification: Outliers often represent rare but real events (e.g., pollution spikes) that are valuable for training a robust model.
3. Modeling and Evaluation (Part 3)
A. Model Selection & Training
- Model: Random Forest Classifier
- Preprocessing: Data was scaled using
StandardScalerafter the train-test split.
B. Evaluation Results
The model was tested on the held-out test set (20%).
| Metric | Score |
|---|---|
| Accuracy Score | 0.6784 |
Classification Report:
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| 0 | 0.70 | 0.86 | 0.77 | 412 |
| 1 | 0.61 | 0.38 | 0.47 | 244 |
| Accuracy | 0.68 | 656 | ||
| Macro Avg | 0.65 | 0.62 | 0.62 | 656 |
| Weighted Avg | 0.67 | 0.68 | 0.66 | 656 |
C. Feature Importance This section includes the list of scores that rank all the features based on how much the model relied on them for prediction (e.g., Sulfate: 0.1257, pH: 0.1243).
Part 4: Conclusion & Next Steps This section provides the analysis:
Conclusion This summarizes the main findings using the metrics: "The overall accuracy was 67.84%, but there is a critical issue: poor performance on the minority class (Potable water, Class 1), evidenced by a low Recall of 0.38."
It then attributes the problem to the severe class imbalance and notes which features (Sulfate, pH, and Hardness) were most influential.
Screen record - https://www.loom.com/share/d85e8dd15837430eb726ad0852451773
- Downloads last month
- 9