top of page

Predict The Stock Prices of IBM by Using A Multi-Layer RNN/GRU/LSTM model | Sequence Learning



Problem Statement

A recurrent neural network deals with sequence problems because their connections form a directed cycle. RNN is widely used for time series forecasting because of these characteristics. Many state of the art results have been achieved using RNN/GRU/LSTM. In this problem, we will try to predict the stock prices of IBM by using a multi-layer RNN/GRU model.


Dataset Description Dataset:

IBM_2006-01-01_to_2018-01-01.csv


The folder IBM_2006-01-01_to_2018-01-01.csv contains files of IBM stocks, labeled by their stock ticker name. Files have the following columns: Date - in format: yy-mm-dd Open - price of the stock at market open (this is NYSE data so all in USD) High - Highest price reached in the day Low Close - Lowest price reached in the day Volume - Number of shares traded Name - the stock's ticker name


Use this command to download the data:

!wget --header="Host: storage.googleapis.com" --header="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 ,application/signed-exchange;v=b3;q=0.9" --header="Accept-Language: en-US,en;q=0.9" - -header="Referer: https://www.kaggle.com/" "https://storage.googleapis.com/kaggledata-sets/8388/11883/bundle/archive.zip?GoogleAccessId=web-data@kaggle161607.iam.gserviceaccount.com&Expires=1589784136&Signature=ao036VxlRjD0oPUHkKBoK45QU YbisD%2BzFi7NgxtqJYxV8AZhgN2nXoUH7D%2FHMmQgs4MqKrTaMZBVNHgSWrpH76EHG12Cz%2F6CYGgAt%2F szp9Yu2NCSpGskC6S1hiI1uzS2kXpTy6Srzyq1%2F3%2FuHhoCPTSX3q5gT8FVGc63o1KNy5AFBY7o%2Fk8CK WH5tnPtBGzjCkeHJnLZisoS7T5anwsoG7o8s1q8OIhGxUD5DyVVejUaSpNho9jf7y2SeLGUc577Oh5JLDT%2F msWK0ZkNnohlPPuA%2BmQIs0UPtGd3NXB1j0ukbfychgxalF1H4EB0qm0Fi2RreVGWrpH%2Fu4W52ct3aA%3D %3D&response-content-disposition=attachment%3B+filename%3Dstock-time-series-20050101- to-20171231.zip" -c -O 'stock-time-series-20050101-to-20171231.zip'


Tasks to be performed:

.ipynb file 1


Question 1.1:

Build a four-layer model using RNN & GRU with the following architecture:

RNN - Units: 50 , activation = ‘tanh’

GRU - Units 50 , activation = ‘tanh’

Dropout after every layer of 0.2

Model’s Summary is given below:


Model: "sequential_5" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= simple_rnn_1 (SimpleRNN) (None, 60, 50) 2600 _________________________________________________________________ dropout_1 (Dropout) (None, 60, 50) 0 _________________________________________________________________ simple_rnn_2 (SimpleRNN) (None, 60, 50) 5050 _________________________________________________________________ dropout_2 (Dropout) (None, 60, 50) 0 _________________________________________________________________ gru_1 (GRU) (None, 60, 50) 15150 _________________________________________________________________ dropout_3 (Dropout) (None, 60, 50) 0 _________________________________________________________________ gru_2 (GRU) (None, 50) 15150 _________________________________________________________________ dropout_4 (Dropout) (None, 50) 0 _________________________________________________________________ dense_1 (Dense) (None, 1) 51 =================================================================

Total params: 38,001

Trainable params: 38,001

Non-trainable params: 0


Hint:


add(SimpleRNN(50, return_sequences=True, input_shape=(X_train.shape[1],1),  activation='tanh')) 

add(GRU(units=50, return_sequences=True, input_shape=(X_train.shape[1],1),  activation='tanh'))


If you need any programming assignment help in Machine Learning programming, Machine Learning project or Machine Learning homework or need solution of above problem then we are ready to help you.


Send your request at realcode4you@gmail.com and get instant help with an affordable price.

We are always focus to delivered unique or without plagiarism code which is written by our highly educated professional which provide well structured code within your given time frame.


If you are looking other programming language help like C, C++, Java, Python, PHP, Asp.Net, NodeJs, ReactJs, etc. with the different types of databases like MySQL, MongoDB, SQL Server, Oracle, etc. then also contact us.

bottom of page