Random Forest Regressor · R² 0.94

Six pollutants. One air quality number.

AeroSense turns raw PM2.5, PM10, NO₂, SO₂, CO and O₃ readings into a live AQI prediction, using an ensemble model trained on historical pollution data.

Scroll
Ambient AQI (demo) 42
The Pipeline

From raw sensor data to a served prediction

The four stages that turn a table of pollutant readings into a number an application can request over HTTP.

01
Clean & prepare
Handle missing readings, align timestamps, and normalize pollutant units across the dataset.
02
Explore & select
EDA surfaces correlations between PM2.5, PM10, NO₂, SO₂, CO, O₃ and the AQI target.
03
Train & evaluate
A Random Forest Regressor is fit across many decision trees and validated on a held-out split.
04
Serve a prediction
The trained model loads into a small prediction API, with input validation baked in.
The Theory

What's actually happening under the hood

A short primer on the model and the pollutants it reasons about.

A Random Forest is an ensemble of many decision trees, each trained on a random subset of the data and a random subset of features. Every tree makes its own AQI guess from the six pollutant readings; the forest's final prediction is the average across all of them. That averaging is what makes it work well here: pollutant-to-AQI relationships are non-linear and interact with each other (PM2.5 matters more when NO₂ is also high, for instance), individual trees can overfit noisy sensor readings, but averaging many imperfect trees cancels out that noise while keeping the non-linear pattern. It also comes with a useful side effect — the model can report which pollutants it actually leaned on, shown in the feature importance breakdown below.
PM2.5
Fine particulate matter under 2.5 micrometers — small enough to reach deep into the lungs and bloodstream. Usually the single biggest driver of AQI.
PM10
Coarser particles — dust, pollen, construction debris. Complements PM2.5 to capture the full particulate load in the air.
NO₂
Nitrogen dioxide from vehicle and industrial combustion. Reacts in sunlight to help form ground-level ozone.
SO₂
Sulfur dioxide from burning fossil fuels, especially coal and diesel. A respiratory irritant and precursor to fine sulfate particles.
CO
Carbon monoxide from incomplete combustion. Reduces how much oxygen the blood can carry, even at moderate concentrations.
O₃
Ground-level ozone — a secondary pollutant formed when NOx and other emissions react in sunlight. Tends to peak in the afternoon.
GOOD0–50
MODERATE51–100
UNHEALTHY101–200
HAZARDOUS200+
Try It

Set the pollutant levels, get a live AQI

These sliders call your running prediction API directly. Adjust the readings and press predict.

PM2.5 µg/m³55
PM10 µg/m³80
NO₂ ppb30
SO₂ ppb12
CO ppm0.8
O₃ ppb40
Calling POST /predict on http://127.0.0.1:5000
— Predicted AQI
Awaiting input
Good Moderate Unhealthy Hazardous
Performance

How the model scores

Evaluated on a held-out test split after training the Random Forest Regressor.

0
R² Score
0
Mean Absolute Error
0
Input features
0
API endpoints
Feature Importance

Which pollutants drive the prediction

PM2.5
88%
PM10
74%
NO₂
52%
O₃
41%
CO
33%
SO₂
27%

Illustrative — replace with your model's real feature importance output.

Built With

Tech stack

Python Pandas NumPy Scikit-learn Matplotlib Flask