YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
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 modelREADME.md: Project documentationpm25_predict.py: Python script for inference (optional)
π Usage
You can use this model with the following steps
import pandas as pd import joblib from huggingface_hub import hf_hub_download
Download the model
repo_id = "sanjibkuanr/pm25-pollution-predictor" filename = "pm25_model.pkl" model_path = hf_hub_download(repo_id=repo_id, filename=filename) model = joblib.load(model_path)
Check model's expected feature names
expected_features = model.feature_names_in_ print("Model expects features:\n", expected_features)
Prepare only the required features for input
sample_input = pd.DataFrame([{ "dewp": -21, "temp": -12, "pres": 1020, "iws": 2.0, "is": 0, "ir": 0, "cbwd_NW": 1, "cbwd_SE": 0, "cbwd_cv": 0, "no": 100 }])
Select only columns the model expects
sample_input = sample_input[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.