{"id":29673127,"url":"https://github.com/admacpherson/flight-delay-predictor","last_synced_at":"2025-07-22T21:37:48.489Z","repository":{"id":303464874,"uuid":"1015602826","full_name":"admacpherson/Flight-Delay-Predictor","owner":"admacpherson","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-07T19:45:43.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-07T20:43:09.741Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/admacpherson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-07T18:49:55.000Z","updated_at":"2025-07-07T19:45:46.000Z","dependencies_parsed_at":"2025-07-07T20:43:36.583Z","dependency_job_id":"38ff52b5-2a6d-4ecb-b998-bcc7c8b54b38","html_url":"https://github.com/admacpherson/Flight-Delay-Predictor","commit_stats":null,"previous_names":["admacpherson/flight-delay-predictor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/admacpherson/Flight-Delay-Predictor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/admacpherson%2FFlight-Delay-Predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/admacpherson%2FFlight-Delay-Predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/admacpherson%2FFlight-Delay-Predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/admacpherson%2FFlight-Delay-Predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/admacpherson","download_url":"https://codeload.github.com/admacpherson/Flight-Delay-Predictor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/admacpherson%2FFlight-Delay-Predictor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266578771,"owners_count":23951151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-22T21:37:32.196Z","updated_at":"2025-07-22T21:37:48.478Z","avatar_url":"https://github.com/admacpherson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✈️ PyTorch Flight Delay Predictor\n\nA neural network model built with PyTorch to predict flight delays using historical U.S. airline performance data. The model classifies whether a flight will be delayed at departure based on key operational features.\n\n## 📊 Overview\n\nDelays in commercial aviation have wide-reaching impacts. This project uses supervised learning on real-world flight data to predict delays before they happen. The model is trained on cleaned data from the U.S. Department of Transportation, using PyTorch for model definition and training and TensorBoard for logging.\n\n## 🧠 Features Used\n\nThe model uses the following **processed and engineered features** as inputs:\n\n* `DEP_TIME_SIN` and `DEP_TIME_COS`: Sinusoidal encoding of scheduled departure time (from `CRS_DEP_TIME`) to represent time cyclicality\n* `DEP_DELAY`: Departure delay in minutes\n* `DAY_OF_WEEK`: Day of the week extracted from flight date\n* `ORIGIN_FLIGHT_COUNT`: Number of flights from the origin airport on that date (proxy for congestion)\n* `IS_HOLIDAY`: Binary flag indicating whether the flight date is a U.S. holiday\n* Encoded categorical variables:\n\n  * `OP_UNIQUE_CARRIER` (airline code)\n  * `ORIGIN` (origin airport)\n  * `DEST` (destination airport)\n\n**Target variable:**\n\n* `ARR_DEL15`: Binary label indicating if arrival delay exceeds 15 minutes (`1 = delayed`, `0 = on time`)\n\n*Note:* Raw columns like `CRS_DEP_TIME`, `FL_DATE`, `OP_UNIQUE_CARRIER`, `ORIGIN`, and `DEST` are transformed and encoded during preprocessing before being fed into the model.\n\n## 🗂️ Project Structure\n```text\nFlight-Delay-Predictor/\n├── data/\n│   ├── raw/                # Too large for GitHub - download on user machine\n│   └── processed/\n│       └── cleaned_T_ONTIME_MARKETING.csv\n├── preprocessed.py         # Data cleaning and encoding\n├── classification.py       # PyTorch model training \u0026 evaluation\n├── models/\n│   └── model.pt            # Saved PyTorch model\n├── tensorboard_logs/\n│   └── run1/\n├── notebooks/\n│   └── exploration.ipynb   # Optional EDA and prototyping\n├── requirements.txt\n└── README.md\n```\n\n## ⚙️ How to Use\n\n### 1. Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 2. Preprocess the Data\n\n```bash\npython preprocessed.py\n```\n\n### 3. Train the Model\n\n```bash\npython classification.py\n```\n\n### 4. View Training Logs with TensorBoard\n\n```bash\ntensorboard --logdir=tensorboard_logs\n```\n\n## 📈 Model Performance\n\nThe model is evaluated using:\n\n* Accuracy\n* Precision, Recall, F1-Score\n* Confusion Matrix\n* TensorBoard loss/accuracy curves\n\nClass imbalance is addressed using weighted loss functions or resampling techniques.\n\n### Results *(Auto Generated)*\n\n| Date | Accuracy | Precision (0) | Recall (0) | F1 (0) | Precision (1) | Recall (1) | F1 (1) | ROC AUC |\n|------|----------|----------------|------------|--------|----------------|------------|--------|---------|\n| 2025-07-10 | 0.20 | 0.95 | 0.03 | 0.05 | 0.18 | 0.99 | 0.31 | 0.670 |\n\n\n### Confusion Matrix *(Auto Generated)*\n\n```\n   2377   92178\n    137   20711\n```\n\n## 🚀 Future Enhancements\n\n* Integrate weather data\n* Add more features\n* Web dashboard for live predictions\n\n**Data Source:**\n[U.S. DOT Bureau of Transportation Statistics](https://www.transtats.bts.gov/)\n\n### Performance Metrics *(Auto Generated)*| Date | Accuracy | Precision (0) | Recall (0) | F1 (0) | Precision (1) | Recall (1) | F1 (1) | ROC AUC |\n|------|----------|----------------|------------|--------|----------------|------------|--------|---------|\n| 2025-07-11 | 0.82 | 0.82 | 1.00 | 0.90 | 0.00 | 0.00 | 0.00 | 0.661 |\n\n\n### Confusion Matrix *(Auto Generated)*\n\n```\n  94555       0\n  20848       0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadmacpherson%2Fflight-delay-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadmacpherson%2Fflight-delay-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadmacpherson%2Fflight-delay-predictor/lists"}