This repo provides a sample code that analyses market data from Nord Pool Electricity Market and develop a Machine Learning model for price forecasting.
The aim of the work is to understand the feasibility of Long Short Term Memory Neural Networks for Time Series Forecasting when dealing with electricity market analysis. This is a state-of-the-art algorithm, compared to classic ARIMA approach, that may lead to important benefits in terms of forecast performance.
- Python 3.5 or higher
- Python libraries: numpy, pandas, scipy, matplotlib, keras, tensorflow
git clone https://github.com/matteobonanomi/dsnd-capstone.git
You have two possibilities:
-
Download the original dataset from the historical data download page: Market Data by Nord Pool. You can select any dataset you want. This analysis is performaned using huorly market price data from 2013 to 2018.
-
Use the data already contained in the repository (data folder). I have already cleaned some stuff and converted each file into a CSV. The notebooks are supposed to work out-of-the-box with the CSV files I made.
Launch Jupyter from your Anaconda terminal (or any UNIX command line after loading your Python environment):
jupyter-notebook
Open the notebooks BASELINE.ipynb and LSTM.ipynb contained in the repo. Run them cell by cell to understand what is going on. Markdown and comments will help you understand each line of code. Each Jupyter containes mostly functions, so that the code is modular and re-usable, easily convertible in class objects for a more efficient .py software.
The content of each notebook is breifly explained:
- BASELINE notebook. A simple persistence model is set as a benchmark for predicting huorly electricity price.
- LSTM notebook. An advanced LSTM model is developed using Keras library. Its performance are assessed with different forecast time horizons. A comparison with baseline allows to understand the benefits of the model.
For an high-level document summarizing the most relevent results from this analysis, please refer to thi Story on Medium.
- Python - Python programming language
- Jupyter - iPython Notebook
- PyCharm - Python IDE by JetBrains
- Brackets - My favourite text editor
We use Git for versioning. Look for new available versions, check the list of commits.
- Matteo Bonanomi - My GitHub
- This project is licensed under the GPL v3 License - see the LICENSE.txt file for details
- Acknowledgement is given to Nord Pool for providing such an extensive and uncommonly clean dataset
- Medium Story about this code
- YouTube lesson A simple LSTM practical explanation
- MachineLearningMastery.com A wonderful website containing many sample codes to learn LSTM applied to different scenarios