Predicting flight delays at LAX
Python│Machine Learning│Logistical Regression
Project Overview
I built an automated workflow combining over one million LAX flight records with archived weather forecasts to predict arrivals delayed by at least 15 minutes.
Adding weather improved predictions modestly. Testing different warning thresholds revealed the practical challenge: detecting more delays also generated many false alarms.
1.07 million flights analysed │ 435,720 flights evaluated │ Five years of historical data
At the illustrative 0.20 threshold, the model detected 69.2% of delays. Only 23.6% of its warnings were correct.
Why this project?
I wanted to assess whether flight schedules and weather forecasts could give airport operations teams useful advance warning of late arrivals. Earlier warning could help teams adjust staffing and turnaround plans before disruption builds.
The business question was whether those warnings would be reliable enough to act on. Missed delays leave teams unprepared, while false alarms can prompt unnecessary changes. I compared delay detection with warning volume to assess that trade-off and identify what further evidence would be needed before considering an operational pilot.
Methodology
1. Automated data collection and preparation
Used Python to download and combine five years of flight records and archived weather forecasts. Checked coverage, missing values and flight outcomes, then excluded cancelled and diverted flights.
2. Matched forecasts to flights
Aligned scheduled flight times and forecast timestamps in UTC. Applied an issue-time cutoff so each flight used a forecast available by its scheduled departure, rather than later weather information.
3. Built comparable models
Created scikit-learn pipelines for missing-value handling, scaling, categorical encoding and logistic regression. Fitted preprocessing on training data and compared flight-only and weather-enhanced models using the same flights.
4. Evaluated performance and practical trade-offs
Trained on 2015–2017 and reviewed predictions on 2018–2019. Compared models against a simple baseline, then tested how different thresholds changed delay detection, false alarms and warning volume.
Key insights
1. Weather added a modest predictive improvement.
Adding the expanded weather features increased ROC-AUC from 0.626 to 0.637 and average precision from 0.269 to 0.284. The improvement supports including weather in further investigation, but these features alone did not produce strong warning precision.
2. Threshold choice substantially changed the workload.
Raising the threshold from 0.20 to 0.30 reduced the share of flights flagged from 54.1% to 20.1%. However, the share of delays detected also fell from 69.2% to 33.2%.
Choosing between those settings requires a clear purpose for each warning and an understanding of the cost of missed delays and false alarms.
3. Accuracy alone concealed poor delay detection.
The majority-class baseline achieved 81.5% accuracy while identifying no delays. This showed why a high accuracy score was insufficient: the evaluation needed to account for the less common delayed flights and the warnings generated to find them.
Further development should start by defining who would act on a warning and what they could do. I would then investigate additional operational inputs, such as earlier delays, aircraft turnaround history and airport congestion, before spending more time tuning the existing features.
This is a historical, retrospective study. The 2018–2019 results informed model development, so they are not an independent final test. The notebook documents the schedule and forecast-matching assumptions.