Air Quality Prediction and MLOps Deployment
A forecasting platform built to production standards: sensor readings arrive as a stream, are cleaned and governed once, feed a loop that trains and promotes models, and are served and monitored as containerised services.
- Course
- Fundamentals of Operationalizing AI
- School
- Carnegie Mellon University
- Term
- Fall 2025
- Role
- ML Engineer
- Stack
- Python
- Redpanda
- Apache Kafka
- scikit-learn
- statsmodels
- XGBoost
- MLflow
- FastAPI
- Evidently
- Streamlit
- Docker Compose
Problem
Any operation that runs on sensors, from city air monitoring to plants and utilities, faces the same question: readings arrive every hour, and a forecast is only worth having if it is ready before the next one, keeps working as conditions shift, and can be trusted enough to act on. The hard part is rarely the model. It is the system around it: taking a live stream in, cleaning it once for everyone, retraining as data lands, promoting a better model safely, and noticing when the world has changed. This project builds that system end to end, on a public air quality dataset.
Solution
An event stream decouples the sensors from everything that consumes them, so either side can change alone. One stream processor cleans and scores each reading once and writes a single governed dataset, the contract every other stage reads. A training loop fits candidate models on that dataset, logs every run, and promotes the best on measured error while keeping earlier versions for rollback. A prediction service serves the promoted model behind a stable API, a drift monitor compares recent data with the recent past, and a dashboard shows both. Everything runs as declared services that start only when what they need is ready, so the whole platform comes up in order from one command.
- moves data
- holds the governed data
- learns and judges
- shows
- platform component, configured not written
- governed data
- promoted model
- on demand
Learnings
- Learning
An event stream as the backbone
A queue between the sensors and everything that consumes them turns a script into a system. Either side can fail, restart or change on its own, order is kept, and every later stage reads the same feed. This is what lets ingestion, training and serving evolve at different speeds without breaking each other.
- Learning
Forecasting on a time series
A forecast is a bet on the next few hours, so the model has to be built and judged on a clock: lag features, a chronological split, a fixed horizon. A model that looks good on a random split can be worthless in time order, and its quality depends on how fresh and clean the last few hours of data are, which ties the model to the pipeline that feeds it.
- Learning
Continuous retraining and promotion
A model is a moving part, not a deliverable. Logging every run, comparing candidates on the same window, promoting on evidence and keeping the previous version, with a drift check watching the input, is the loop that makes a forecast safe to leave running unattended.