{"id":31915509,"url":"https://github.com/edjoukou/forecasting-air-passengers","last_synced_at":"2026-07-18T20:36:55.777Z","repository":{"id":318125615,"uuid":"1070073220","full_name":"EDJOUKOU/Forecasting-Air-Passengers","owner":"EDJOUKOU","description":"Prediction of air passenger numbers using SARIMA and XGBOOST","archived":false,"fork":false,"pushed_at":"2025-10-05T08:22:19.000Z","size":403,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T10:09:15.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/EDJOUKOU.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-05T07:54:13.000Z","updated_at":"2025-10-05T08:22:22.000Z","dependencies_parsed_at":"2025-10-09T00:18:36.421Z","dependency_job_id":null,"html_url":"https://github.com/EDJOUKOU/Forecasting-Air-Passengers","commit_stats":null,"previous_names":["edjoukou/forecasting-air-passengers"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/EDJOUKOU/Forecasting-Air-Passengers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EDJOUKOU%2FForecasting-Air-Passengers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EDJOUKOU%2FForecasting-Air-Passengers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EDJOUKOU%2FForecasting-Air-Passengers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EDJOUKOU%2FForecasting-Air-Passengers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EDJOUKOU","download_url":"https://codeload.github.com/EDJOUKOU/Forecasting-Air-Passengers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EDJOUKOU%2FForecasting-Air-Passengers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016832,"owners_count":26085889,"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-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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-10-13T19:48:09.790Z","updated_at":"2025-10-13T19:48:11.576Z","avatar_url":"https://github.com/EDJOUKOU.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Air Passenger Forecasting**\n\n## **Project Overview**\n\nThis project analyzes and forecasts monthly air passenger numbers using two approaches: a statistical time-series model (**SARIMA**) and a machine-learning model (**XGBoost**).\nThe main objective is to understand the trend and seasonality patterns of air travel demand and produce reliable short- and medium-term forecasts that support strategic decision-making for the aviation sector.\n\n---\n\n## **Data Source**\n\nThe analysis uses the classic **AirPassengers** dataset — a benchmark time-series dataset representing monthly totals of international airline passengers.\n\n* **Frequency:** Monthly\n* **Date Range:** 1949 – 1960\n* **Observations:** 144\n\nThe dataset is available on the link: \u003ca href='https://www.kaggle.com/datasets/ashfakyeafi/air-passenger-data-for-time-series-analysis'\u003eAir passengers data\u003c/a\u003e\n\n---\n\n## **Tools**\n\n* **Python (Jupyter Notebook)** — main environment for analysis\n* **Pandas, NumPy** — for data manipulation and preprocessing\n* **Matplotlib, Seaborn** — for visualizations and time series plots\n* **Statsmodels** — for SARIMA model building and diagnostics\n* **Scikit-learn** — for preprocessing and evaluation\n* **XGBoost** — for gradient boosting regression modeling\n\n---\n\n## **Data Cleaning and Preparation**\n\nThe data preparation phase included the following steps:\n\n1. **Data Loading and Inspection** — The AirPassengers dataset was imported and reviewed for structure and completeness.\n2. **Datetime Conversion** — The “Month” column was converted to a proper `DatetimeIndex` for time series operations.\n3. **Missing Values Check** — Confirmed no missing data in the series.\n4. **Decomposition** — The series was decomposed into **trend**, **seasonal**, and **residual** components to explore underlying patterns.\n5. **Stationarity Test** — An Augmented Dickey-Fuller (ADF) test was applied to determine differencing needs for the SARIMA model.\n6. **Feature Engineering for XGBoost** — Lag and time-based features (month, year, etc.) were created to enable supervised learning.\n7. **Train-Test Split** — The dataset was split into **80% training** and **20% testing** for performance evaluation.\n\n---\n\n## **Exploratory Data Analysis**\n\nExploratory analysis was conducted to understand the structure and behavior of the time series:\n\n* **Trend Identification:** Revealed a strong upward trend in passenger numbers over time.\n* **Seasonality Detection:** Each year showed repeating peaks and troughs, confirming monthly seasonality.\n* **Stationarity Check:** Non-stationary at the original level but became stationary after first differencing.\n* **Autocorrelation (ACF) and Partial Autocorrelation (PACF):** Used to guide parameter selection for SARIMA.\n\n---\n\n## **Modeling Approaches**\n\n### **1. SARIMA Model**\n\n* The Seasonal ARIMA model captures both **trend** and **seasonality**.\n* Model parameters (p, d, q) × (P, D, Q, s) were chosen based on ACF/PACF plots and diagnostic checks.\n* The model was fitted, residuals were analyzed to ensure white noise behavior, and forecasts were generated for the test period.\n\n### **2. XGBoost Model**\n\n* A machine learning regression model was trained using lag features as predictors.\n* GridSearchCV was used to find optimal hyperparameters (learning rate, max depth, estimators).\n* The model predicted future passenger numbers using prior time-lagged values.\n* Predictions were compared against the actual test data for evaluation.\n\n---\n\n## **Model Evaluation (MAPE)**\n\nBoth models were evaluated using the **Mean Absolute Percentage Error (MAPE)** metric on the test set.\n\n| Model       | MAPE (%)  |\n| ----------- | --------- |\n| **SARIMA**  | **4.66**  |\n| **XGBoost** | **12.96** |\n\n**Conclusion:**\nThe **SARIMA model** outperformed XGBoost, achieving a **lower MAPE (4.66%)** compared to **XGBoost (12.96%)**.\nThis indicates that the SARIMA model, which directly models the trend and seasonal structure, was better suited for this dataset’s strong periodic patterns.\n\n---\n\n## **Results / Findings**\n\n1. The time series demonstrates a clear **upward trend** and **strong monthly seasonality**.\n2. The **SARIMA model** provided superior accuracy and reliability for forecasting compared to XGBoost.\n3. **XGBoost** captured general patterns but struggled to model consistent seasonality.\n4. Model diagnostics confirmed that SARIMA residuals followed random noise, validating the fit.\n5. Future forecasts suggest continuous growth in air passenger numbers year over year.\n\n---\n\n## **Recommendations**\n\n* **Adopt SARIMA for Forecasting:** Given its accuracy and interpretability, SARIMA should be the preferred model for this dataset.\n* **Feature Enhancement for XGBoost:** Introduce Fourier terms or additional calendar features to improve its seasonal performance.\n* **Hybrid Modeling:** Combine SARIMA and XGBoost (SARIMA for linear patterns and XGBoost for nonlinear residuals) to further enhance prediction accuracy.\n* **Capacity Planning:** Use the forecasts to inform strategic decisions such as fleet management, staffing, and pricing.\n* **Continuous Validation:** Update models periodically as new data becomes available to maintain predictive performance.\n\n---\n\n## **Repository Contents**\n\n* `Air_passenger.ipynb` → Jupyter Notebook with complete analysis and model comparison\n* `README.md` → Project documentation\n* `data/` → check link provided in the readme file\n\n---\n\n## **Notes on Evaluation**\n\n* MAPE values were computed on the test portion of the data (20% holdout).\n* Additional metrics such as **MAE** and **RMSE** can be used to supplement evaluation.\n* Residual plots and Q-Q diagnostics confirmed good model assumptions for SARIMA.\n* Results may vary slightly depending on random seed, split ratio, and parameter tuning.\n\n---\n\n## **Author**\n\n**Dr. EDJOUKOU Yessoh Gaudens Thecle**\n*Mathematics and Science Educator | Data Science Enthusiast | Researcher in Applied Machine Learning*\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedjoukou%2Fforecasting-air-passengers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedjoukou%2Fforecasting-air-passengers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedjoukou%2Fforecasting-air-passengers/lists"}