Crude Oil Price Prediction - project details

Crude oil price forecasting with classical ML, deep learning and hybrid models

Interactive dashboard

Open dashboard in full screen

Project information

  • Category: Data Science / Machine Learning
  • Stack: Python, Pandas, Scikit-learn, XGBoost, TensorFlow/Keras, Plotly
  • Link to github: GitHub repo →
  • Live Dashboard (model comparison): View live →

Crude oil price forecasting & model benchmarking

An end-to-end forecasting study of the Saharan Blend price (2000–2022), in a context where oil revenue accounts for roughly 75% of Algeria's economy. The project covers data cleaning and denoising, outlier handling, and exploratory analysis of how geopolitical risk (GPR index) and the USD/DZD exchange rate relate to price movements over time.

Seven models — SVR, Random Forest, XGBoost, LSTM, CNN, and two hybrids (CNN-LSTM and RF-XGBoost) — were trained and evaluated on a proper train/validation/test split, across two data granularities: daily and monthly. The RF-XGBoost hybrid came out on top on both, while deep learning models excelled on the large daily dataset but broke down on the much smaller monthly one, highlighting how model choice should follow data volume as much as architecture.

All results are explorable in the interactive dashboard above (built with Chart.js), which lets you switch between daily and monthly data and compare RMSE and R² across all seven models.

Project deep dive

Problem statement

Crude oil underpins roughly 19% of Algeria's GDP, 93% of exports, and 75% of budget revenue, yet traditional econometric models struggle with the nonlinear, volatile nature of oil prices. The core question this project investigates: how do different machine learning models and dataset characteristics influence the accuracy of crude oil price forecasts, and which approaches yield the most reliable predictions? — with secondary questions on whether hybrid models beat individual ones, whether more data helps, and how much feature richness matters.

Dataset

Saharan Blend crude oil price series, 2000–2022, at two granularities:

  • Daily — large sample, well suited to deep learning
  • Monthly — much smaller sample, a real stress test for data-hungry models
  • Enriched with the geopolitical risk (GPR) index and the USD/DZD exchange rate

Methodology

  1. Data cleaning & denoising — outlier handling on the raw price series before any modeling.
  2. Exploratory analysis — examining how the GPR index and USD/DZD exchange rate relate to price movements over time.
  3. Model training — seven models trained and evaluated on a proper train/validation/test split, across both daily and monthly granularity:
    • Individual: SVR, Random Forest, XGBoost, LSTM, CNN
    • Hybrid: CNN‑LSTM, Random Forest‑XGBoost
  4. Comparison — models scored by RMSE and R² across time granularity and architecture, all explorable in the interactive dashboard above.

Key findings

  • The RF‑XGBoost hybrid came out on top on both daily and monthly data — hybrid models outperformed standalone models overall, confirming the project's central hypothesis.
  • Deep learning models (LSTM, CNN, CNN‑LSTM) excelled on the large daily dataset but broke down on the much smaller monthly one — model choice needs to follow data volume as much as architecture.
  • Larger datasets generally improved performance, especially for tree-based models; feature richness meaningfully affected how well the deep learning models generalized.

Tech stack

Python pandas scikit-learn XGBoost TensorFlow / Keras Plotly Matplotlib / Seaborn

Data sourced from Kaggle, the U.S. EIA, World Bank, and IMF. Full notebooks (daily & monthly) in the GitHub repo →