A Machine Learning-based decision support tool designed to predict flight departure delays from New York (JFK, EWR, LGA) based on local weather conditions and temporal factors.
Flight delays cost the aviation industry billions of dollars annually. This project leverages the well-known nycflights13 dataset (over 330,000 flights) combined with local weather reports to identify the underlying risk factors for departure delays (>15 minutes).
Key Achievements:
- Robust database merging (Data Engineering) with strict prevention of data leakage.
- Temporal Feature Engineering (Creation of Time of Day, Day of Week features).
- Training and hyperparameter tuning of an XGBoost model via
RandomizedSearchCV. - End-to-End deployment using a REST API and an Interactive Web Interface.
The champion model is an optimized XGBoost Classifier (n_estimators=250, max_depth=8, learning_rate=0.2).
It was specifically selected and tuned for its ability to generalize well without overfitting on a highly imbalanced dataset.
- F1-Score (Test Set): 0.53
- Recall: 65%
- Precision: 45%
Top 3 Feature Importances (Model Explainability):
time_of_day_Morning: Morning flights are the #1 indicator of punctuality (absence of the operational "domino effect").precip&visib: Stormy weather and low visibility (fog) are the primary environmental disruptors.carrier_EV: Smaller regional carriers are statistically more prone to delays during heavy Air Traffic Control regulations compared to major airlines.
This repository demonstrates proficiency in two distinct deployment architectures:
- Cloud Architecture (Monolith) -
app_cloud.py: The model inference is integrated directly within Streamlit for seamless, serverless hosting (optimized for Streamlit Community Cloud). - Microservices Architecture -
app.py+api.py: A clean separation of Front-End and Back-End via FastAPI. This approach is highly scalable and represents enterprise-grade production standards.
flight_delay_predictor/
│
├── data/ # (Git Ignored) Raw and processed datasets
├── models/ # Serialized XGBoost model and features (.joblib)
├── src/
│ ├── feature_engineering.py # Data cleaning and joins
│ ├── train_xgboost.py # Model training and optimization script
│ ├── train_model.py # Baseline Model training script
│ ├── api.py # FastAPI Server (Back-end)
│ ├── app.py # Streamlit Interface (Microservice)
│ └── app_cloud.py # Streamlit Interface (Monolith for Cloud hosting)
│
├── requirements.txt # Project dependencies
└── README.md # This file