![]() |
VOOZH | about |
Air pollution is a growing concern globally, and with increasing industrialization and urbanization, it becomes crucial to monitor and predict air quality in real-time. One of the most reliable ways to quantify air pollution is by calculating the Air Quality Index (AQI). In this article, we will explore how to predict AQI using Python, leveraging data science tools and machine learning algorithms.
The Air Quality Index (AQI) is a standardized indicator used to communicate how polluted the air currently is or how polluted it is forecast to become. The AQI is calculated based on pollutants such as:
Each pollutant has a sub-index, and the highest sub-index among them becomes the AQI.
Where:
We can see how air pollution is by looking at the AQI
| AQI Level | AQI Range |
|---|---|
| Good | 0 - 50 |
| Moderate | 51 - 100 |
| Unhealthy | 101 - 150 |
| Unhealthy for Strong People | 151 - 200 |
| Hazardous | 201+ |
Let's find the AQI based on Chemical pollutants using Machine Learning Concept.
It contains 7 attributes, of which 6 are chemical pollution quantities and one is Air Quality Index. AQI Value, CO AQI Value, Ozone AQI Value, NO2 AQI Value, PM2.5 AQI Value, lat,LNG are independent attributes. air_quality_index is a dependent attribute. Since air_quality_index is calculated based on the 7 attributes.
As the data is numeric and there are no missing values in the data, so no preprocessing is required. Our goal is to predict the AQI, so this task is either Classification or regression. So as our class label is continuous, regression technique is required.
We’ll use a dataset with pollutant concentration levels and corresponding AQI values.
Handle missing values, rename columns, and check data types.
Visualizing relationships between variables.
Choose relevant features for training.
6. Train-Test Split
7. Model Training (Random Forest)
8. Model Evaluation
9. Plotting Results
Output:
Model Evaluation Metrics: Mean Absolute Error: 0.09 Mean Squared Error: 2.59 R2 Score: 1.00
Dataset Link: click here.