CoolFace
Modelpublic

sanjibkuanr/pm25-pollution-predictor

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
Model Card

PM2.5 Air Pollution Prediction Model ๐ŸŒซ๏ธ

This project predicts the level of air pollution (PM2.5 concentration) using historical environmental data collected from Beijing between 2010 and 2014. It uses a machine learning model trained on weather and pollution-related features.

๐Ÿ“Š Dataset

  • โ€”Source: UCI Machine Learning Repository
  • โ€”Data File: PRSA_data_2010.1.1-2014.12.31.csv
  • โ€”Features Used:
  • โ€”Temperature
  • โ€”Dew Point
  • โ€”Pressure
  • โ€”Wind direction (CBWD)
  • โ€”Cumulated wind speed (Iws)
  • โ€”Cumulated hours of snow (Is)
  • โ€”Cumulated hours of rain (Ir)

๐Ÿง  Model

  • โ€”Type: Random Forest Regressor
  • โ€”Framework: Scikit-learn
  • โ€”Target Variable: PM2.5 concentration
  • โ€”Evaluation: Rยฒ Score, Mean Squared Error (MSE)

๐Ÿ“ Files

  • โ€”pm25_model.pkl: Trained ML model
  • โ€”README.md: Project documentation
  • โ€”pm25_predict.py: Python script for inference (optional)

๐Ÿš€ Usage

You can use this model with the following steps

import pandas as pd import joblib from huggingfacehub import hfhub_download

Download the model

repoid = "sanjibkuanr/pm25-pollution-predictor" filename = "pm25model.pkl" modelpath = hfhubdownload(repoid=repoid, filename=filename) model = joblib.load(modelpath)

Check model's expected feature names

expectedfeatures = model.featurenamesin print("Model expects features:\n", expected_features)

Prepare only the required features for input

sampleinput = pd.DataFrame([{ "dewp": -21, "temp": -12, "pres": 1020, "iws": 2.0, "is": 0, "ir": 0, "cbwdNW": 1, "cbwdSE": 0, "cbwdcv": 0, "no": 100 }])

Select only columns the model expects

sampleinput = sampleinput[expected_features]

Predict

prediction = model.predict(sample_input) print("Predicted PM2.5 level:", prediction[0])

Developed by Sanjib Kuanr as part of a Machine Learning learning initiative. Feel free to connect with me on LinkedIn! You are free to use, modify, and distribute.