/Power_consumption_prediction

Time series forecasting with TensorFlow

Primary LanguageJupyter Notebook

Power_consumption_prediction

Content


Summary

It was developed a new model of daily energy consumption from renewables in Germany. The predicting algoritm uses a machine learning model from Tensorflow library.

Project description

National government and energy companies are interested in forecasting future energy consumption to prevent power outages and create new power facilities. Their power development strategies typically requires accurate modelling of the data to plan future investments.

The power consumption has several remarkable periods of change: weekly and monthly as shown on the fig.2. Unfortunately, simple models like linear regression or decision trees cannot learn seasonal changes and, therefore, should not be applied. On the other hand, neural networks and autoregressive models spot seasonal data much better.

Data and methods

The renewable energy generation datataset in Germany between the years 2006–2017 was acquired form the Open Power System Data (OPSD) storage; it was partly described in a popular tutorial. To increase the accuracy of prediction, the energy consumprion vector (N=4383) was transformed to a two-dimensional array of a shape 4383 rows by 7 columns. Each row represents daily consumption of the electricity plus that in the next 6 days. The goal is to predict the consumption beyond the given timeframe.

The data was split by 3 samples without shuffling data entries: Train, validation, and test. The last set contained 100 values.

ML model

Based on author's experience, the model has following architecture: 256 hidden layers of the Long-Short Term Memory (LSTM) with the linear activation function.

After 70 epochs the model didn't overfit (fig.4).

Results

Although the model satisfactory predicts the consumption, its mean squared error is quite high and reaches some 14100 on the test sample. This happened because of small dataset size.

Project structure

display project structure
├── config                      # configuration settings
│   └── config.json              
├── data                        # data archive
│   └── energy_demand_OPSD.zip   
├── figures
│   ├── fig_1.png
.....
│   └── fig_4.png
├── models                      # models and weights
│   ├── linear_model.hdf5
│   ├── model_LSTM.hdf5
│   └── scaler.gz
├── notebooks                   # notebooks
│   └── power_consumption.ipynb
├── README.md
├── requirements.txt
├── utils                       # functions and data loaders
│   ├── config_reader.py
│   ├── functions.py
│   ├── inference.py
│   ├── models.py
│   └── __pycache__
├── .git
└── .gitignore