Forecasting Electrical Energy Consumption using Artificial Neural Networks

DOI : 10.17577/IJERTV8IS110152

Download Full-Text PDF Cite this Publication

Text Only Version

Forecasting Electrical Energy Consumption using Artificial Neural Networks

Ayanangshu Das1

1Data Scientist

Cognizant Technologies Solutions United States

Anirban Sengupta2

2Asst. Professor

Sikkim Manipal Institute of Technology India

Abstract Knowing how much the demandfor energy would be for the coming months would be very useful for electricity producing companies. Electricity cant be stored and energy companies face a challenge where the demand is always more and the supply is less. Hence the companies look for factors that affect electricity consumption and accurately forecast its usage. In this paper Neural Network methodology is proposed as an effective methodology for load forecasting

Keywords:- Neural Network, Random Forest,LSTM

  1. INTRODUCTION

    In the contemporary energy sector, the prediction of energy consumption is done by traditional forecasting methods

    such as machine learning models. This paper aims at establishing the fact that Artificial Neural Networks play a better role in making more accurate predictions provided that there is no restriction on the time to make the predictions and resources in terms of hardware to be used

    The electrical energy consumption depends on the following factors/ loads

      1. Social Load

        The consumption varies during the holidays, the weekdays and the weekends

        Fig 1: Variation of social load with time

      2. Weather Dependent Load

        Factors of weather are temperature, global radiation, wind, cloud etc. The load consumption increases due to high

        temperature in summer or may increase due to more heater consumption during the winters

        Rain

        Winter

        Summer

        Rain

        Winter

        Summer

        200

        180

        160

        140

        120

        100

        80

        60

        40

        20

        0

        200

        180

        160

        140

        120

        100

        80

        60

        40

        20

        0

        1

        2

        3

        4

        5

        6

        7

        8 9

        Month

        1

        2

        3

        4

        5

        6

        7

        8 9

        Month

        Figure 2-Variation of Weather Dependent Load

      3. Stochastic Load

        These types of loads are the ones that couldnt be accounted for e.g. a sudden storm has increased the load for a certain period of time. Now it would be necessary to understand that whether to take the load into consideration.

        A hurricane might be a one of a phenomena in some place whereas it might be a regular phenomenon in some other place. As such a decision is necessary to be taken whether or not to account for these factors

        Fig 3: Variation of stochastic load

  2. DATA USED

    The data is fed into the machine learning model and was trained to identify the pattern so that the model is able to predict the usage amount for new databy date. The target variable is USAGE and the predictors areDate, Time,

    Global_active_power,Global_reactive_power, Voltage and Global_intensity.

    If this energy consumption is analyzed over the days of the week, it can be seen that there is a difference in the pattern

    of energy consumption on a weekday vs a weekend/holidays.

    An additional column called IS_HOLIDAY is introduced to understand if the date is a holiday or not.

    Now the usage values aggregated over one month, two months and so on till five months are introduced in the dataset

    The consumption of energy over time is analyzed as follows

    Fig 4: Consumption of energy over time

  3. RANDOM FORESTSMETHODOLOGY

    A random forest is an ensemble of decision trees. The final value of random forest is obtained by taking the average of each of the values of the decision tree.

    The Random Forest algorithm adds extra randomness when growing trees. Instead of searching for the very best feature when splitting a node it searches for the best feature among

    a random subset of features. As a resultit creates a greater tree diversity, which introduces higher bias and a lower variance, generally yielding an overall better model.

    The features derived as explained above are used for making the predictions using the random forest algorithm.

    With Random Forest Regressor, the following actual against predicted result is obtained

    Fig 5: Result from Random Forest Prediction

    It can be seen that the model predicted the values accurately to a certain extent. The grey line is the prediction value on new data. The validation score on the validation data is

    RMSE= 0.18412616700088405

  4. SOLVING WITH NEURAL NETWORK

APPROACH

Neural networks is another approach and has been widely used for time series forecasting. These are feed-forward

networks which employ a sliding window over the input sequence. Common examples of this approach are stock market predictions and predicting telecommunication load [1, 2]. The neural network based prediction can be considered as a model in which function f is assumed to be a non-linear combination of a fixed number of previously input values [3].

The neural network is constructed as a three layer architecture as depicted in the following diagram

Fig 6: Neural Network Model

Loss function: Mean Squared Error (MSE) Activation function: ReLU for hidden layers and linear for the output layer Number of epochs=1000

Batch size (for batch gradient descent) =250 Optimizer=adam

On training the network on the train data, the following validation error is obtained

Fig 7: Variation of train data

It isseen that the training loss decreased over time

The predicted data

The below graph shows the result on how the model predicted the train data and the grey line represents the prediction on new unseen data

The accuracy of the model is RMSE= 0.02003

Figure 8-Result from Neural Network

Artificial Neural Networks: LSTM

Ho and Xie performed a comparative study between ARIMA and RNN showing that RNN has performed better than ARIMA[4] in modelling time series prediction. Connor and Martin also discussed the effectiveness of Neural Networks in time series forecasting [6]. The Long-Short-Term-Memory (LSTM) cell proposed in 1997 by Sepp Hochreiter and Jürgen Schmidhuber [5] proved to be more effective than traditional recurrent neural networks in time series predictions. LSTM cell can be considered as a black box. It can be used very much like a basic cell, except it will perform much better; training will converge faster and it will detect long-term dependencies in the data. LSTM is a kind of Recurrent Neural Networks which is depicted by the following architecture:

Figure 9-LSTM Architecture

In a Recurrent Neural Network, the output of the previous layer is fed into itself and also to the next layer. This type of architecture is very effective in time-series forecasting. The equations for a RNN architecture is as follows:

  • Y (t)is anm×nneuronsmatrix containing thelayers outputs at time step t for each instance in the mini-batch (m is the number of instances in the mini-batch and nneurons is the number of neurons).

  • X (t)is anm×ninputsmatrix containing theinputs for all instances (ninputs is the number of input features).

  • Wxis aninputs×nneuronsmatrix containing theconnection weights for the inputs of the current time step.

  • Wyis anneurons×nneuronsmatrix containingthe connection weights for the outputs of the previous time step.

  • bis a vector of sizenneuronscontaining eachneurons bias term.

  • The weight matices Wx and Wy are often concatenated vertically into a single weight matrixW of shape (ninputs + nneurons)

    × nneurons

  • The notation [X(t)Y(t1)] represents the horizontal concatenation of the matrices X(t) and Y(t1)

    The basic LSTM architecture is depicted as follows:

    Figure 10-LSTM Gates

    The LSTM computations are as follows:

  • Wxi,Wxf,Wxo,Wxgare the weightmatrices of each of the four layers for their connection to the input vector x(t).

  • Whi,Whf, Who, andWhgare the weightmatrices of each of the four layers for their connection to the previous short-term state h (t1).

  • bi, bf, bo,andbgare the bias terms for eachof the four layers.

The training and validation losses using LSTM came down to as follows:

Figure 11-Train and Test Loss

The performance of the model is shown as below. The grey line is an approximation of how the model predicted the value in the training data against the actual value in the green line.

MSE = 0.1586783446921463

CONCLUSION

Figure 2-Result from LSTM

It can be concluded that the Artificial Neural Networks did a better job in terms of predicting the actual values than the random forest. If the emphasis is on predicting accurate value, the NN models to be used. However, if the data volume is huge and there is a constraint on how many servers can be used and how quickly the predictions can be made,a simpler machine learning algorithm such as lasso regression or Random Forest can be used.

REFERENCES

      1. Bengio, S., Fessant, F., and Collobert, D.: A connectionist system for medium-term horizon time series prediction, in: Proc. of Internat. Workshop Application Neural Networks to Telecoms, 1995, pp. 308315

      2. Edwards, T., Tansley, D. S. W., Davey, N., and Frank, R. J.: Traffic trends analysis using neural networks, in: Proc. of the Internat. Workshop on Applications of Neural Networks to Telecommunications, Vol. 3, 1997, pp. 157164

      3. Dorffner, G.: Neural networks for time series processing, Neural Network World 4/96 (1996), pp. 447468

      4. Ho, Xie, Goh, April 11, Singapore, A comparative study of neural network and Box-Jenkins ARIMA modeling in time series prediction, V42, pp. 371-375

      5. SeppHochreiter and Jürgen chmidhuber,Nov, 1997, MIT, Neural Computation V9, pp. 1735-1780

      6. Connor, Martin, Atlas, Mar 94, NJ, Recurrent neural networks and robust time Seriesprediction,pp.240-254

Leave a Reply