Skip to content

Repository files navigation

predict-AQI

Predicting air pollution.

Project Proposal

Detailed proposal

This project is to make AQI predictions in the near future, given past AQI measurements of nearby locations (AQI is an integer measurement of air pollution). More specifically, the project aims to predict:

For a given location at a given point in time, what will the air pollution be every hour for the next 24 hours?

The baseline model to beat is one that predicts that the AQI for the next 24 hours will be the same AQI as right now.

Project Report

Detailed report. (printscreened pdf)

Four hypotheses were explored:

The final model ended up being structured like this:

original model

Exploring these hypotheses gradually built up preprocessing, a pipeline, and a model. In the end, a hyperparameter grid search was performed and compared against the baseline model.

Model Visualizations

No one set of hyperparameters for the model was optimal across all locations. That being said, different hyperparameters for the model performed better than the baseline model.

These are the results for 50 different sets of hyperparameters on a single location compared to the baseline model. The x-axis represents predictions n hours in the future. The y-axis represents the average absolute error for the predictor. That means a single point is the average absolute error for a given predictor predicting n hours ahead for a given location. The red line is the baseline model error.

Error on top 50 models

Small improvements to the model and some changes to the testing process would be necessary to make the model production-ready (see improvements).

Setup to Reproduce

Either use this docker setup for postgres / jupyter notebook or use your own setup of postgres / jupyter notebook and change the database config in predict_aqi/load_data.py, line 7.

If you want to use docker

$ cd predict-AQI
$ docker-compose up -d
Starting predictaqi_postgis_1
Starting predictaqi_notebook_1

Retrieving the data

Libraries Used

For data transformation and prediction:

  • Python 3
  • NumPy
  • Pandas
  • Matplotlib
  • Scikit Learn

For storing / querying data:

  • Postgres
  • Postgres GIS
  • SQLAlchemy

For running everything:

  • Docker
  • Docker-compose
  • Jupyter Notebook (jupyter/datascience-notebook)

About

Predicting air pollution (machine learning project)

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages