STLF using LSTM

Here, we present the code for performing a short-term load forecasting with the help of LSTM. The data for training and testing is taken from the UCI ML website (https://archive.ics.uci.edu/ml/datasets/Individual+household+electric+power+consumption#). The code for STLF has been adapted from GitHub (https://github.com/demmojo/lstm-electric-load-forecast):

  1. We import the necessary modules and set random seeds, shown as follows:
import timefrom keras.layers import LSTMfrom keras.layers import Activation, Dense, Dropoutfrom keras.models import Sequential, load_modelfrom numpy.random import seedfrom tensorflow import set_random_seedset_random_seed(2) # seed random numbers for Tensorflow backendseed(1234) # seed random numbers ...

Get Hands-On Artificial Intelligence for IoT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.