Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)

IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

Crude Oil Price Prediction Using Deep Learning


Y. Jeevan Nagendra Kumar1 Partapu Preetham2, P. Kiran Varma3,
P. Rohith4, P. Dilip Kumar5
1Professor and Dean, Department of Information Technology,
Gokaraju Rangaraju Institute of Engineering and Technology, JNTUH, 2 3 4 5Department of Information Technology,
Hyderabad, India
Gokaraju Rangaraju Institute of Engineering and Technology,
jeevannagendra@griet.ac.in , 9010180199
Hyderabad, India.

Factors affecting Crude oil price:


Abstract:
Crude oil price keeps on changing due to the changes in
The crude oil price has a huge impact on the world's economy.
policies, news, demand, and fluctuations in the world
From the past few years, crude oil price fluctuates more than any market. Here are the top 3 factors affecting crude oil
other commodities prices. As the crude oil price depends on prices.
several external factors and there is high volatility predicting 1) Supply:
crude oil prices is very challenging. Long Short-Term Memory
(LSTM) based on a recurrent neural network has shown better
The Organization of the Petroleum Exporting Countries
results in predicting prices that have high volatility. By utilizing
(OPEC) can have a significant influence on oil prices. It is
this model, the significant crude oil price is evaluated and a group of 14 world major crude oil-exporting nations. It
modelled. The exhibition of the proposed model is assessed by regulates the price and petroleum policies among these 14
utilizing the valuable information in the WTI unrefined nations to maintain a healthy and fair relation among these
petroleum markets. The exploratory results show that the nations.
proposed model achieves increments in the expected precision of 2) Demand:
results. The data required is collected from the official website of
FEDERAL-RESERVE -BANK -OF -ST. LOUIS Demand for crude oil is affected based on several reasons
such as transportation, population growth, and seasons.
Keywords: Long Short-Term Memory, Crude Oil Price For example, COVID-19 has affected the travel and
Prediction, Recurrent Neural Networks, Vanilla LSTM,
transport industries worldwide. Thus, resulting decline in
demand for crude oil.
Sequential LSTM, Epochs, Step size.
3) Shale oil:
The US Government started producing shale oil using the
I. INTRODUCTION latest oil extraction technologies. Shale oil extraction cost
is low compared to crude oil extraction costs. Increase in
Nowadays, Long Short Term Memory (LSTM) and shale oil extraction results in decreasing crude oil demand.
Recurrent Neural Networks (RNN) are using for sequence-
based problems such as Question-answering, Speech
recognition, Text classification, Rhythm learning,
II. LITERATURE SURVEY
Grammar learning, Handwriting recognition, Human action
recognition, Behavior recognition of robots, Predicting Data collected from the official website of FEDERAL-
subcellular localization of proteins, Time series anomaly RESERVE-BANK-OF-ST. LOUIS. It has Data of Crude
detection, several prediction tasks in the area of business oil price from 2015. The price of crude oil is in Dollars. By
process management, Power demand forecasting, Semantic collecting data from FEDERAL-RESERVE-BANK-OF-
parsing, Object Co-segmentation, Airport passenger ST. LOUIS. There is no need to perform a lot of Data Pre-
management, and Short-term traffic forecast. Here LSTM processing [1].
is used for forecasting the price of Crude oil.
Predicting Stock Prices using LSTM is the reference about
predicting the stock price. The key points that are observed
Impact of crude oil price on the world's economy:
here are, how the Pre-processing has done and which
normalization technique they have used to transfer the data
There is almost 6000+ by products extracted from crude [2]. The key points observed here are the Methodology
oil. Once the crude oil price increases, it shows a rise in the they used, how they got the results using it, and what is the
price of diesel fuels, gasoline, and kerosene. It impacts epochs and timestamps they used [3].
industries such as the automobile industry, textile industry,
logistics, travel, and tourism. It shows the spike in Also, observed the layers in LSTM that they have used,
electricity charges due to the increase in crude oil prices. which activation function is used and what is the loss
Sudden falls and a rise in crude oil prices can send the function that they used [4]. It has been observed that they
global market into a complex situation. have modified the neural network in such a way that what
are all the changes they have done and how they have

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 118

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)
IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

made changes and how can make changes in our neural sigmoid yield will choose which data is essential to
network [5]. And also observed that, how they have remain from the tanh yield.
projected the results and what visualization graphs they
have used to project the results [6]. Output gate:

III. METHODOLOGY Last entryway is the yield door. The yield entryway
chooses what resulting shrouded state ought to be. The
LSTM is the most widely used type of RNN. LSTM is concealed state is likewise utilized for forecasts. In the first
mainly used for the sequence prediction problem. RNN has place, pass the past concealed state and in this manner the
encountered two significant problems, i.e., vanishing current contribution to a sigmoid capacity. At that point
gradients and exploding gradients. These two major pass the recently altered cell state to the tanh work.
problems are solved using LSTM. The main reason is the Duplicate the tanh yield with the sigmoid yield to settle on
structure of LSTM, which helps to overcome these a choice that, what data the shrouded state should convey.
problems. The yield is the shrouded state. The new cell state and the
new shrouded state is then continued to the ensuing time
step.
It is one of the most straightforward architectures of
LSTM, known as Vanilla LSTM. It gives more significant
results for all sequential related prediction problems shown
in Figure 2.

Fig 2: Closer view of LSTM architecture


Fig 1: LSTM architecture
Dropout Layer Explanation:
LSTM has mainly three layers. One is the input layer, the
It is a Methodology which helps a model to stay away
two are output layer, and hidden layer is shown in the
from overfitting. Overfitting alludes to a model in which
Figure 1of LSTM architecture.
it models the Training data excessively well. It happens
when a model learns the nuances and disturbance in the
The layers of LSTM architecture
Planning data to the degree that it alternately impacts the
display of the model on new information. [8].
Forget gate:

The Overlook entryway chooses what information ought IV. PROPOSED ARCHITECTURE
to be discarded or kept. Data from the past concealed
state and information from the current info is gifted the Since the price of crude oil not only depends on the Supply
sigmoid capacity. Qualities come out somewhere in the and Demand but it also depends on some External factors
range of 0 and 1. The more like 0 intends to overlook, and like politics. These factors cannot be considered as a
in this manner the more like 1 intends to remain. [7]. feature to predict the price, so this model might not work
well in this kind of situation. It works only when the Data
Input gate: contains the Price of the crude oil.

To refresh the cell state, input door is required. Initially, Sequential LSTM type of model has been used to predict
pass the past concealed state and current information into the price of crude oil. The proposed model consists of 4
a sigmoid capacity. That chooses which esteems will be LSTM layers with each layer having 50 neurons, and
refreshed by changing the qualities to be somewhere in another 4 are dropout layers and remaining are, one is a
the range of 0 and 1. 0 methods not significant, and 1 dense layer with one neuron, and the other is the output
methods significant. Pass the shrouded state and current layer. Each LSTM layer has followed by one dropout layer.
information into the tanh capacity to get esteems between The proposed model layers are shown in the Figure 3
- 1 and 1 to assist with controlling the system. At that Proposed model. All the inputs of the proposed model are
point duplicate the tanh yield with the sigmoid yield. The normalized for better results [9].

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 119

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)
IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

a. Input gate:

𝑖𝑡 = 𝜎 (𝑤𝑖 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑖 (5)

The above formula is the condition for the Input Gate


which mentions to us what new data is going to store in
the cell state [10].

b. Forgot gate

𝑓𝑡 = 𝜎 ( 𝑤𝑓 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑓 ) (6)

The above formula is the condition for the overlook


Entryway which encourages the information to dispose of
from the cell state.

c. Output gate

𝑜𝑡 = 𝜎 ( 𝑤𝑜 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑜 ) (7)

The above formula is the condition for the Yield entryway


which is used to give the activation to the last yield of the
LSTM block at timestamp 't' [11].

𝑖𝑡 → represents input gate


𝑓𝑡 → represents forget gate
𝑜𝑡 → represents output gate
𝜎 → represents sigmoid function
𝑤𝑥 → weight for the respective gate(x) neurons
ℎ𝑡−1 → output of the previous LSTM block (at
Fig 3: LSTM Proposed model timestamp t-1)
𝑥𝑡 → input at current timestamp
A.DATA PRE-PROCESSING 𝑏𝑥 → biases for the respective gates(x)
The data has been collected from the official website of The Underneath characterized conditions are condition
FEDERAL-RESERVE-BANK-OF-ST. LOUIS. Therefore, for the for the cell state, condition for the applicant cell
there is no need to process the data for missing values. state, and the condition for the last yield:
Make the model to be more specific and there is no need to 𝑐𝑡 → cell state (memory) at timestamp(t)
check for the outliers. 𝑐̅𝑡 → represents candidate for cell state at timestamp(t)
𝑐̅𝑡 = tanh(𝑤𝑐 [h𝑡−1, 𝑥𝑡 ] + 𝑏𝑐 ) (1)
So as to discover the memory vector for the current
timestamp (c_{t}), the inclination is resolved. Directly,
𝑐𝑡 = 𝑓𝑡 ∗ 𝑐𝑡−1 + 𝑖𝑡 ∗ 𝑐̅𝑡 (2)
from the above condition that can see at any given
timestamp, our cell state understands that what it needs to
ℎ𝑡 = 𝑜𝑡 ∗ tanh(𝑐 𝑡 ) (3)
ignore from the past state (i.e., f_{t} * c_{t-1}) and what it
needs to consider from the current timestamp (i.e., i_{t} *
c\'_{t}). All in all, channel the cell state and a while later it
B. Min max Scalar Method:
is experienced the order work which predicts what bit
should appear as the yield of the current LSTM unit at
All the inputs of the proposed model are normalized in the
timestamp t. Pass this h_{t}, the yield from the current
range of 0 to 1 for better results. This method uses linearly
LSTM impede through the SoftMax layer to get the
transformation technique such as
foreseen output(y_{t}) from the current square [12].
(𝑥−𝑚)
x to y=(𝑀−𝑚) (4) D. LOSS FUNCTION:

Where, m=min, M=max Mean_Squared_Error loss function is used here. The loss
function is used to measure mathematically, how wrong
C. Algorithm: our predictions are.

LSTM: ∑𝑁
𝑖−1(𝑃𝑟𝑒𝑑𝑖𝑐𝑡𝑒𝑑𝑖−𝐴𝑐𝑡𝑢𝑎𝑙𝑖 )²
RMSE = √ 𝑁
(8)
The Input gate equations in LSTM are written below:

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 120

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)
IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

V. RESULTS
 Step Size:

Take a step size or time steps of 3 (in a one-to-many


network), then it is ending up with input/output samples
([x0,x1,x2],x3),([x1,x2,x3],x4),...,([xT−3,xT−2,xT−1],xT)
(Using Rolling-windows), or
([x0,x1,x2],x3),([x3,x4,x5],x6),...,([xT−3,xT−2,xT−1],xT)
(Not using Rolling-windows). Using a batch size of 1, the
network input is (1, 3, n_features), where n_features is the
dimension of Xi (1 for a univariate time series, >1 for Fig 5: 30 looks back 120 epochs
multivariate time series).
2. 30 Timestamps and 120 epochs: From the Figure 5
 Epochs:
above, can see the Graph between real and predicted
When the entire Data set is passed once to the neural Crude oil price, when it takes 30 Timestamps and 150
network forward and backward through then it is epochs.
considered as one Epoch. It cannot handle the entire epoch The Test Data Root Mean Square Error is:1.658818723
once, so isolate it into few small batches. The Train Data Root Mean Square Error is: 1.504204886
The Difference between RMSE of Test Data and Train
Passing Data set once to a neural network makes the Data is
prototype suffer from updating the weights with a single RMSE Test Data ~ RMSE Train Data: 0.154613873
pass or one epoch is not enough.

As the quantity of ages builds, more occasions the loads


are changed in the neural system and the Model goes from
underfitting to ideal to overfitting bend.

 Choosing the right number of Epoch

The appropriate response is distinctive for various datasets


yet it says that the number of epochs is identified with how
diverse our data set is.

After trying various combinations of Step size and epochs,


finally can found the following combinations which give
results more accurately. Fig 6: 60 looks back 120 epochs

3. 60 Timestamps and 120 epochs: From the Figure 6


above, can see the Graph between real and predicted
Crude oil price, when it takes 30 Timestamps and 150
epochs.
The Test Data Root Mean Square Error is: 1.408214372
The Train Data Root Mean Square Error is: 1.407885705
The Difference between RMSE of Test Data and Train
Data is
RMSE Test Data ~ RMSE Train Data: 0.000328667

Fig 4: 30 looks back 150 epochs

1. 30 Timestamps and 150 epochs: From the Figure 4


can see the Graph between Real and predicted Crude oil
price when it takes 30 Timestamps and 150 epochs.
The Test Data Root Mean Square Error is: 1.15285714
The Train Data Root Mean Square Error is: 1.811941252
The Difference between RMSE of Test Data and Train
Data is
RMSE Test Data ~ RMSE Train Data: 0.659084112

Fig 7: 60 looks back 150 epochs

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 121

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)
IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

4. 60 Timestamps and 150 epochs: From the Figure 7 The proposed model consists of four LSTM layers with
above, can see the Graph between Real and predicted each layer having 50 neurons, 4 dropout layers and
Crude oil price when it takes 30 Timestamps and 150 remaining are, one is a dense layer with one neuron, and
epochs. the other is the output layer. Each LSTM layer has
The Test Data Root Mean Square Error is: 1.193295116 followed by one dropout layer. 60 step size and 120
The Train Data Root Mean Square Error is: 1.307318471 epochs give accurate Results. All the inputs of the
The Difference between RMSE of Test Data and Train proposed model are normalized for better results.
Data is
RMSE Test Data ~ RMSE Train Data: 0.114023356 It deals with different step sizes and epochs and finally
When the step size is 60, then it is getting better results found the correct numbers to get the better accuracy.
because in the span of 60 days, the oil price going
drastically high and falls low, so this change is considered REFERENCES
as one pattern. When the step size is 30, then the results are
not good as compared to the step size 60. [1] The input Data is collected from
https://fred.stlouisfed.org/series/DCOILBRENTEU.
After trying various combinations of look backs and [2] Predicting Stock Prices Using LSTM Murtaza
epochs, finally it has been found the following Roondiwalal Harshal Patel2, Shraddha Varma3
combinations which are shown in Table 1. These Undergraduate Engineering Students, Department of
combinations gave better results compared to others. Information Technology, Mumbai University
https://pdfs.semanticscholar.org/3f5a/cb5ce4ad79f08
S.No Look Epochs Test Train Difference 024979149767da6d35992ba.pdf
back RMSE RMSE of RMSE [3] Long Short-Term Model for Brent Oil Price
Forecasting Harsh Salvi1, Avdhi Shah2, Manthan
Mehta3, Prof. Stevina Correia4 1, 2, 3, 4Student,
1 30 120 1.658818 1.504204 0.154613 4Faculty, Department of Information Technology,
Dwarkadas J. Sanghvi College of Engineering,
Mumbai, India
2 30 150 1.152857 1.811941 0.659084
http://ijraset.com/fileserve.php?FID=25667
[4] Crude Oil Prediction Using LSTM Nidhi Moitra,
3 60 120 1.408021 1.407885 0.000328 Priya Raj, Sanidhya Saxena, Rohit Kumar
Department of Information Science and Engineering
Dayanand Sagar Academy of Technology and
4 60 150 1.193295 1.307318 0.114023 Management Bengaluru, India
https://www.ijisrt.com/assets/upload/files/IJISRT20F
EB503_(1).pdf
[5] Crude Oil Price Prediction Using LSTM Networks
Table 1: Combinations of Step size and Epochs Varun Gupta, Ankit Pandey
https://publications.waset.org/10008992/crude-oil-
Impact of epochs on results:
price-prediction-using-lstm-networks
The quantity of ages is identified with the quantity of [6] A modified neural network model for predicting the
rounds of improvement that are applied during preparing. crude oil price Author links open overlay panel
With more adjusts of improvement, the blunder on Mohammad RezaMahdianiEhsan
preparing information will lessen further and further; https://www.sciencedirect.com/science/article/pii/S1
notwithstanding, there may come a point where the system 822801116300121
becomes over-fit to the preparation information and will [7] Y. Jeevan Nagendra Kumar, Dr. T. V. Rajini
begin to lose execution regarding speculation to non- Kanth, “GIS-MAP Based Spatial Analysis of
preparing (inconspicuous) information. To dissect this, can Rainfall Data of Andhra Pradesh and Telangana
screen the mistake execution on isolated testing States Using R”, International Journal of Electrical
information, as the quantity of ages increments. and Computer Engineering (IJECE), Vol 7, No 1,
February 2017, Scopus Indexed Journal, ISSN:
2088-8708
VI. CONCLUSION [8] B Sankara Babu, A Suneetha, G Charles Babu, Y.
Jeevan Nagendra Kumar, G Karuna, “Medical
From the Above RMSE Errors, the difference of Test Disease Prediction using Grey Wolf optimization
RMSE and Train RMSE of combination 60 look back and Auto Encoder based Recurrent Neural Network”,
with 120 epochs gives us a result of 0.000328667 which Periodicals of Engineering and Natural Sciences,
is better when compared to other combinations. Hence June 2018 ISSN 2303-4521 Vol.6, No.1, pp.
this combination gives us more accurate results. Hence, 229~240
built a sequential LSTM type of model that has been used [9] Dr. Y. Jeevan Nagendra Kumar, Guntreddi Sai
for crude oil price prediction. Kiran, Partapu Preetham, Chila Lohith, Guntha Sai

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 122

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Inventive Research in Computing Applications (ICIRCA-2020)
IEEE Xplore Part Number: CFP20N67-ART; ISBN: 978-1-7281-5374-2

Roshik, G. Vijendar Reddy, "A Data Science View from Acharya Nagarjuna University, Guntur and
on Effects of Agriculture & Industry Sector on the M.Tech in Computer Science Technology from Andhra
GDP of India" International Journal of Recent University, Visakhapatnam. Having over 18+ years of
Technology and Engineering, Volume-8, Issue-1, academic and research experience.
May 2019, ISSN: 2277-3878.
[10] Ledalla, S. & Mahalakshmi, T.S.. (2019). He is having Life Membership in Indian Society for
Sentiment analysis using legion kernel convolutional
Technical Education (LM ISTE) and International
neural network with LSTM. International Journal of
Innovative Technology and Exploring Engineering. Association of Engineers (IAENG).
8. 226-229.
[11] Vijayakumar, T. (2019). COMPARATIVE He is received appreciation Letters for NAAC, NBA, x-
STUDY OF CAPSULE NEURAL NETWORK IN Kernel, Robotic Club, J-Lab J-Hub JNTUH Coordinator.
VARIOUSAPPLICATIONS. Journal of Artificial
Intelligence, 1(01), 19-27. He is published around 18 research papers in various
[12] Ledalla, Sukanya & Mahalakshmi, Tummala Scopus Indexed Journals and organized 15+ FDPs,
(2018). Multilingual Sentiment Analysis of Hinglish Workshops in the Organization.
Tweets. Indian Journal of Public Health Research &
Development. 9. 1627. 10.5958/0976-
He is a National Advisory Board member and
5506.2018.02092.2.
Technical Program Committee member for NGCT,
AUTHOR PROFILE ICSET, IJAC, WCAET Conferences and Journals.

Dr. Yalla Jeevan Nagendra Kumar, He is acted as Strategic Planning Committee member,
Professor of IT and Dean Technology BoS Member, Project review committee member, Jury
and Innovation Cell - GRIET, completed member for NIFT- Hyderabad and Vice-President,
Ph.D in Computer Science Engineering Convener for MHRD – IIC GRIET Chapter.

978-1-7281-5374-2/20/$31.00 ©2020 IEEE 123

Authorized licensed use limited to: University of Brighton. Downloaded on September 27,2020 at 22:15:27 UTC from IEEE Xplore. Restrictions apply.

You might also like