MasumBhuiyan's picture
Update README.md
a311404 verified

A newer version of the Gradio SDK is available: 5.43.1

Upgrade
metadata
title: Air Quality Predictor
emoji: 🌍
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.36.2
app_file: app.py
pinned: false

Air Quality Prediction and Classification

This Gradio app predicts the Air Quality Index (AQI) and classifies air quality as "Safe" or "Unsafe" based on pollutant levels (PM2.5, PM10, NO2, CO) and weather conditions (temperature, humidity). It addresses urban air pollution, a critical public health issue, making it a compelling showcase for machine learning applications.

How to Use

  1. Use the sliders to input pollutant levels (PM2.5, PM10, NO2, CO) and weather conditions (temperature, humidity).
  2. View predicted AQI values from four models: Linear Regression, Polynomial Regression, Ridge Regression, and Random Forest.
  3. See classification results (Safe/Unsafe) from Logistic Regression and Random Forest.
  4. Check the bar plot comparing AQI predictions across models.

Model Details

  • Dataset: Synthetic air quality data inspired by real-world datasets (e.g., UCI Air Quality Dataset).
  • Features: PM2.5, PM10, NO2, CO, Temperature, Humidity, and a K-means cluster label for feature engineering.
  • Models:
    • Regression: Linear Regression, Polynomial Regression (degree 2), Ridge Regression, Random Forest Regressor.
    • Classification: Logistic Regression, Random Forest Classifier.
  • Machine Learning Concepts:
    • Introduction to Machine Learning: Data preprocessing and feature engineering.
    • Unsupervised Learning: K-means clustering to create cluster features.
    • Gradient Descent and Multiple Linear Regression: Linear and Ridge models.
    • Polynomial Regression and Regularization: Polynomial features with Ridge to prevent overfitting.
    • Logistic Regression and Classification: Binary classification (Safe/Unsafe).
    • Ensemble Learning: Random Forest for robust predictions.
    • Model Evaluation and Bias-Variance Tradeoff: Bar plot compares model performance, highlighting tradeoffs.

Real-World Impact

This app can assist cities in monitoring air quality and issuing health advisories, contributing to public health and environmental awareness. The predicted AQI values (e.g., ~120, classified as "Unsafe") indicate conditions that may require action, such as reducing outdoor activities.

Setup

  • Dependencies: Listed in requirements.txt (Gradio, scikit-learn, pandas, numpy, matplotlib, seaborn, joblib).
  • Model Files: Pre-trained models and scalers (scaler_initial.pkl, scaler_with_cluster.pkl, kmeans.pkl, etc.) are included.
  • Source Code: The app is implemented in app.py using Gradio for an interactive interface.

Authors

Created as a capstone project for an Introduction to Machine Learning course, demonstrating a complete ML pipeline from data preprocessing to deployment.

Try It Out

Interact with the app using the sliders and explore how different pollutant levels affect AQI predictions and classifications!