/Predicting-Water-Quality-using-Machine-Learning

Predicting water quality using ML. Comparative study of classification algorithms. Dataset cleaning, EDA, algorithm comparison. Random Forest performs well in accuracy, precision. Decision Tree excels in recall, F1_score

Primary LanguageJupyter Notebook

Predicting Water Quality using Machine Learning

This project aims to predict water quality using various classification algorithms and compare their performance metrics. The dataset used for this project can be obtained from Kaggle.

Project Overview

  1. Data Cleaning: The dataset is preprocessed by removing rows with incorrect data and modifying data types to ensure data quality.

  2. Data Analysis: Histograms are plotted for each column to gain insights into the distribution of data.

  3. Classification Algorithms:

    • Decision Tree Classifier
    • Random Forest Classifier
    • K Nearest Neighbor Classifier
    • Gaussian Naive Bayes
    • Voting Ensemble
    • Stacking Ensemble
  4. Performance Metrics: The accuracy, precision, recall, and F1-score are computed for each algorithm.

Results

Based on the evaluation of performance metrics, the following observations were made:

  1. Random Forest Classifier performs well in terms of accuracy.
  2. Random Forest Classifier performs well in terms of precision.
  3. Decision Tree Classifier performs well in terms of recall.
  4. Decision Tree Classifier performs well in terms of F1-score.

Usage

To run the project, follow these steps:

  1. Download the dataset from Kaggle.

  2. Place the dataset in the appropriate directory.

  3. Execute the provided code file water_quality_prediction.py.

Dependencies

The following Python libraries are required to run the project:

  • pandas
  • numpy
  • matplotlib
  • scikit-learn

Make sure to install these dependencies before running the project.

Contact

For any queries or suggestions, feel free to contact me at ahmadtalha963@gmail.com.

Note

This project does not have a specific license. You are welcome to explore, modify, and distribute the code.