Skip to content

The following repository contains Google Stock Price Prediction using Keras LSTM Model. The closing stock prices have been predicted based on the previous 5 years' data extracted from https://api.tiingo.com/.

Notifications You must be signed in to change notification settings

kshitij-raj/Stock-Price-Prediction-LSTM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Stock Prices Prediction using Keras LSTM Model

In this project, I extracted the Google stock prices data from https://api.tiingo.com/ for the time period of 5 years (October 2016 - October 2021). The main objective for the project is to predict the prices of Google stock 30 days in the future based off of the current Close price. I used Long Short-Term Memory (LSTM). LSTMs are widely used for sequence prediction problems and have proven to be extremely effective. The reason they work so well is that LSTM can store past important information and forget the information that is not.

Data Preparation

I created a new data frame containing only the target variable - Closing stock price and converted it into an array to train the model. For this project, traning dataset had 70% of values. With time series data, the sequence of values is important. The LSTM network expects the input data to be provided in 3D array structure: [samples, time steps, features]. Currently, the data is in the form: [samples, features] I transformed the train and test input data into the expected structure using numpy.reshape().

Model Building

A Long Short-Term Model was built using Keras which had 50 units, 3 hidden layers and a dense layer (output) to predict the normalized closing stock price.

Model Summary

The model was compile using the mean squared error as loss function and to reduce the loss or to optimize the algorithm, I used the Adam optimizer.

Model Loss Score

The model was fit and passed to the training features and a test data set was created to get predictions.

Model Prediction

Lastly forecast the stock price of the 30 days.

Model Forecast

About

The following repository contains Google Stock Price Prediction using Keras LSTM Model. The closing stock prices have been predicted based on the previous 5 years' data extracted from https://api.tiingo.com/.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published