In this example, we predict electricity consumption for a consumer using a stateful and stateless LSTM network and compare their behaviors. As you will recall, RNNs in Keras are stateless by default. In case of stateful models, the internal states computed after processing a batch of input is reused as initial states for the next batch. In other words, the state computed from element i in a batch will be used as initial state for for the element i in the next batch.
The dataset we will use is the electricity load diagram dataset from the UCI Machine Learning Repository (https://archive.ics.uci.edu/ml/datasets/ElectricityLoadDiagrams20112014), and contains consumption information ...