This repository contains the code for my university time series modelling assignment.
The project focuses on forecasting daily oil prices using two different approaches:
- ARIMA (classical statistical model)
- LSTM (deep learning model)
The aim is to compare their performance, generate 24‑month forecasts, and evaluate how well the models generalise to unseen data.
This repo is intended both as part of my coursework submission and as a reference for anyone learning time series forecasting in Python.
├── notebook.ipynb # Main Jupyter Notebook with full workflow
├── code.py # Exported .py version of the notebook
├── data/ # Input dataset (oil prices 2024–2026)
├── figures/ # All plots saved automatically by the notebook
└── README.md # Project overview (this file)
- Install Python 3.10+
- Install the required libraries:
pip install numpy pandas matplotlib statsmodels scikit-learn tensorflow- Open the notebook:
jupyter notebook notebook.ipynb- Run all cells from top to bottom.
All figures will be saved automatically in thefigures/folder.
- Stationarity testing (ADF, KPSS)
- Differencing and ACF/PACF analysis
- Grid search over (p, d, q)
- Residual diagnostics
- Train/test evaluation
- 24‑month forecast with confidence intervals
- Sequence generation with lookback windows
- Normalisation without data leakage
- Stacked LSTM architecture with dropout
- Early stopping during training
- Hyperparameter tuning
- Monte Carlo dropout for uncertainty estimation
- 24‑month forecast with confidence intervals
The notebook automatically saves all key plots, including:
- Raw series and rolling statistics
- ACF/PACF plots
- Differenced series
- ARIMA residual diagnostics
- Train/test performance for both models
- 24‑month forecasts
- ARIMA vs LSTM comparison
- Forecast vs real post‑Feb 2026 prices
These are stored in the figures/ directory.
The full written report (methods, results, interpretation, and discussion) is submitted separately as part of the assignment.
This repository focuses on the code and reproducibility of the modelling process.
Bhavin Thakur
Student ID: 23079699
This project was created by me as part of my university coursework.
I used standard tutorials, documentation, and university resources for learning, but all code and analysis were written by me.
Please use this repository only as a reference — do not copy it for academic submissions.