Skip to content

Python script for regression of multivariable LSTM neural network.

License

Notifications You must be signed in to change notification settings

iamarchisha/multistep-io-timeseries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multistep Input-Output Timeseries using LSTM

Probabilistic forecast a complex wind generator system with multiple parameters in assisting decision making and for predictive maintenance through data-driven techniques; in this case, recurrent neural networks.

Requirements

  • python == 3.9.1
  • tensorflow == 2.5.0
  • pandas == 1.2.4
  • numpy == 1.19.5
  • seaborn == 0.11.1
  • matplotlib == 3.4.2
  • scikit-learn == 0.24.2
  • keras == 2.4.3

Input Specifications

  • Sample dataset is contained as data.csv
  • inputs number of inputs for model training/testing
  • Number of hidden neurons per LSTM and FC layers
  • Moving Window of m number of time step inputs
  • n day output Multistep forecasting

Script Specifications

  • Load time series dataset CSV with specified (variables inputs inputs) – denoted in the sample dataset.
  • Input preprocessed (StandardScalar) and using TimeSeriesSplit Cross-Validation
  • Each LSTM model architecture has:
    • 2x LSTM layer (with their “number of hidden neurons” as variables) followed by 1x FC

    • Specifications:

      i. Moving Window Time Step Input i.e. where x multivariable inputs {x(t-m)…x(t-1) and x(t)}, where m is a variable

      ii. EarlyStopping Callback with patience = 20 during the training phase

      iii. Loss function: MSE

  • Prediction phase to predict n days where y is output: y(t),y(t+1),…y(t+n)
  • A multi-step approach, and where n is a variable

Implementation

Make changes in this part of the script to customise it to your dataset

obj = TSLSTM(
        path_to_csv="./data.csv", 
        inputs=[0,1,2,3,4,5], 
        neurons=50, 
        m=2, 
        n=1,
        approach="lstmd"
        )

To run the script, simply use python tslstm.py

Output

Two images will be stored in ./images and a logs.log file will be generated. image image

References

Contributions

I am looking forward to implementing the following 2 papers:

  1. BAYESIAN RECURRENT NEURAL NETWORKS
  2. Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning

Any contributions to the current script or in implementing the above 2 papers are welcome.

About

Python script for regression of multivariable LSTM neural network.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages