A machine learning project that predicts flight arrival delays using a two-stage pipeline — combining a classifier to detect whether a flight will be delayed, and a regressor to estimate the delay duration in minutes.
Flight delays are a major disruption in the aviation industry, affecting millions of passengers each year. This project builds a two-stage prediction pipeline using real-world flight data and weather data collected from 15 major US airports across 2016–2017.
Weather conditions at both origin and destination airports are incorporated as features, given weather’s significant impact on flight delays.
| Notebook | Description |
|---|---|
Pre-Processing.ipynb |
Merges raw flight and weather datasets for 2016 & 2017; handles nulls |
Sampling.ipynb |
Addresses class imbalance using SMOTE (oversampling) and NearMiss (undersampling) |
Classification.ipynb |
Trains and evaluates classification models; selects best classifier |
Regression .ipynb |
Trains and evaluates regression models; builds the final pipeline |
Project.ipynb |
End-to-end project notebook |
The datasets are merged on airport ID and time (departure/arrival) to align weather conditions with each flight record.
Since non-delayed flights significantly outnumber delayed flights, two sampling strategies were evaluated:
| Model | Notes | |—|—| | Decision Tree | Baseline classifier | | XGBoost | Gradient-boosted ensemble | | Random Forest ✅ | Selected — highest recall on delayed class | | Logistic Regression | Linear baseline |
| Model | Notes | |—|—| | Gradient Boosting | Robust ensemble regressor | | XGBoost ✅ | Selected — best R² (0.95), lowest RMSE & MAE | | Random Forest | Ensemble regressor | | Decision Tree | Baseline regressor |
Input Flight + Weather Features
│
▼
Random Forest Classifier
├── Not Delayed → output: 0 min delay
└── Delayed ──▶ XGBoost Regressor → output: predicted delay (minutes)
| Metric | Score |
|---|---|
| RMSE | 18.56 |
| MAE | 14.15 |
| R² Score | 0.94 |
Scores may vary depending on the train/test split ratio.
| Metric | Score |
|---|---|
| R² Score | 0.95 |
| RMSE | 16.42 |
| MAE | 11.45 |
git clone https://github.com/AMVamsi/Flight_Delay_Prediction.git
cd Flight_Delay_Prediction
pip install pandas numpy scikit-learn xgboost imbalanced-learn matplotlib seaborn jupyter
Pre-Processing.ipynb → Sampling.ipynb → Classification.ipynb → Regression .ipynb
The two-stage pipeline successfully predicts flight arrival delays. Key findings:
This project is licensed under the MIT License.