# 🏆 UmojaHack Africa 2022 — Beginner Track | Air Quality Fault Detection
> **Competition Result: 🥇 Ranked #17 out of all participants**
---
## 📜 Certificate of Achievement
---
## 📌 Competition Overview
**Event:** UmojaHack Africa 2022 — Beginner Track
**Challenge:** Air Quality Sensor Fault Detection
**Task:** Predict `Offset_fault` — a multiclass classification label indicating sensor faults in air quality monitoring devices
**Platform:** Zindi
Air quality sensors sometimes develop faults due to environmental conditions. The goal of this challenge was to build a machine learning model that could detect the type of offset fault (if any) in PM2.5 sensors based on readings from two sensors alongside temperature and relative humidity data.
---
## đź“‚ Repository Structure
```
├── Last_notebook.ipynb # Main competition notebook
├── README.md # This file
└── certificate.png # Certificate of participation (add yours here)
```
---
## 🔍 Approach & Methodology
### 1. Exploratory Data Analysis (EDA)
- Visualized **missing values** across all columns using horizontal bar charts
- Identified significant **outliers** in `Sensor1_PM2.5` and `Sensor2_PM2.5` using box plots
- Analyzed **class imbalance** in the target variable `Offset_fault`
### 2. Data Preprocessing
- Filled missing values in `Sensor1_PM2.5` and `Sensor2_PM2.5` with a fixed value of `200` (empirically found to work best)
- Imputed missing values in `Temperature` and `Relative_Humidity` using the **median** (robust to outliers)
- Outliers were intentionally retained as they were deemed informative for fault detection
### 3. Feature Engineering
- **Sensor ratio:** `Sensor1_PM2.5 / Sensor2_PM2.5` — captures the relative difference between sensors
- **Humidity level:** Binned `Relative_Humidity` into `low`, `medium`, and `high` categories
- **Datetime features:** Extracted `month` and `hour` from the timestamp
- Applied `pd.get_dummies()` for one-hot encoding of categorical …