GithubHelp home page GithubHelp logo

ki-ljl / lstm-load-forecasting Goto Github PK

View Code? Open in Web Editor NEW
188.0 3.0 47.0 6.8 MB

Implementation of Electric Load Forecasting Based on LSTM(BiLSTM). Including Univariate-SingleStep forecasting, Multivariate-SingleStep forecasting and Multivariate-MultiStep forecasting.

License: MIT License

Python 100.00%
lstm load pytorch

lstm-load-forecasting's Introduction

LSTM-Load-Forecasting

Implementation of Electric Load Forecasting Based on LSTM(BiLSTM). Including Univariate-SingleStep forecasting, Multivariate-SingleStep forecasting and Multivariate-MultiStep forecasting.

Environment

pytorch==1.10.1+cu111

numpy==1.18.5

pandas==1.2.3

Tree

.
│  args.py
│  data_process.py
│  LICENSE
│  models.py
│  README.md
│  tree.txt
│  util.py
│          
├─data
│      data.csv
│      
├─LSTMs
│      multivariate_multi_step.py
│      multivariate_single_step.py
│      univariate_single_step.py
│      
└─models
        multivariate_multi_step.pkl
        multivariate_single_step.pkl
        univariate_single_step.pkl
  1. args.py is a parameter configuration file, where you can set model parameters and training parameters.
  2. data_process.py is the data processing file. If you need to use your own data, then you can modify the load_data function in data_process.py.
  3. Two models are defined in models.py, including LSTM and bidirectional LSTM.
  4. util.py defines the training and testing functions of the models in the three prediction methods.
  5. The trained model is saved in the models folder, which can be used directly for testing.
  6. Data files in csv format are saved under the data file.

Usage

First switch the working path:

cd LSTMs/

Then, execute in sequence:

python multivariate_multi_step.py --epochs 50 --batch_size 30
python multivariate_single_step.py --epochs 30 --batch_size 30
python univariate_single_step.py --epochs 30 --batch_size 30

If you need to change the parameters, please modify them manually in args.py.

Result

在这里插入图片描述

lstm-load-forecasting's People

Contributors

ki-ljl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lstm-load-forecasting's Issues

about the pred = pred[:, -1, :]

Hi, I am learning your wonderful code.
Now i met a problem about the code : pred = pred[:, -1, :]
Why does just get the last column about the pred?
Could you explain in more detail to me, Thanks a lot!

data source

Hello, if you can, please provide the source of the dataset, thank you very much!

how about multi lstm?

I have the data:
图片
I want use the pre 10 colums to predict the 11th colums,and want use the multi lstm to forecast,as:
model = Sequential()
layers = [1, 75, 100, prediction_steps]
model.add(LSTM(layers[1], input_shape=(None, layers[0]), return_sequences=True)) # add first layer
model.add(Dropout(0.2)) # add dropout for first layer
model.add(LSTM(layers[2], return_sequences=False)) # add second layer
model.add(Dropout(0.2)) # add dropout for second layer
model.add(Dense(layers[3])) # add output layer
model.add(Activation('linear')) # output layer with linear activation
start = time.time()
model.compile(loss="mse", optimizer="rmsprop")
print('Compilation Time : ', time.time() - start)
return model
how shoul i do?

Get the future forecast value.

Hello, good work. I have some doubts. The code is a prediction of testdata, and it doesn't output future results. How can I get the values that didn't happen in the future?

Question for plotting

hi

I have an issue with plotting, why the range of x is from 1 to 151? What is the meaning of the .T[150:300]) in the plot section?

looking forward to your answer
thanks

IndexError: list index out of range

I use my data, have two colums, one is timestamp, one is value.
And use the Multivariate-SingleStep-LSTM and Multivariate-MultiStep-LSTM, the list index out of range:

图片

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.