Stocks Prediction using LSTM Recurrent Neural Network and Keras

Stocks Prediction is one of the important issue to be investigated. Investors in stocks look at the current price of stock and its previous history to buy it. If in the past, price of stock has decreased gradually or abruptly in a particular year, investors will not buy it. Past data analysis is also important for predicting future price of the stock. When you learn in the right direction about Share Market Analysis or equity Market Analysis, you can make huge profit from it. Before proceeding further, let us understand what is trend. It points to direction where stocks is moving. Sometimes market is bullish or bearish, trends moves accordingly. In general term, if trend stays for longer time, it is treated as more trustworthy. Stocks market is considered volatile, dynamic and tumultuous hence predicting stocks with time series data is very challenging task. Artificial Neural Network, Recurrent Neural Network, Long Short Term Memory and Deep Neural Networks can be used for predicting future stocks prices. Today, different companies are building applications on stocks prediction using above models and algorithms with Tensorflow at the backend. They are constantly trying to improve accuracy and user experience in such a way that even novice user can use them.

Shocked Girl

Insight of demo: Stocks Prediction using LSTM Recurrent Neural Network and Keras

AI Sangam has uploaded a demo of predicting the future prediction for tesla data. Here are different projects which are used implementing the same. Please watch the video Stocks Prediction using LSTM Recurrent Neural Network and Keras along with this.

Steps for implementing the demo:

Step1: First step is that you must have installed python on your system because python is used for such. If you have Jupyter notebook, it would be more better because you can run line by line there. Please install both python and jupyter notebook. Please follow these instruction to install python on your system.

If the system is having ubuntu operating system, please follow the below instruction

             1.) Open the terminal  and run the command sudo add-apt-repository ppa:jonathonf/python3.6

             2.) sudo apt-get update

             3.) sudo apt-get install python 3.6

Installing Python for Windows

            1.) Please go to this link https://www.python.org/downloads/ and install .exe file

Now we are done with installing python and now it is the time to run the code. Packages which will be required to run the code can be installed using pip. When you install python it comes with python  and it is a installer program. In windows, if you go to the C directory and look for Python folder and you go inside it and look for folder  Scripts, you will find pip. You may install other packages using pip command (C:\Python 3.5\Scripts) like jupyter notebook can be installed using pip install jupyter.

Step2: Please download the tesla.csv file from the link

Step 3: Apply some preprocessing which is required such as normalization or  removing any redundant data using coding skills.

Step4: Now it is time to split the data into training and testing phase. You may use the required libraries to perform the task like you may use  modules from sklearn to perform such task.

Step 5: Now it is the time to define the LSTM Model where dropout, activation, optimizer and loss is added. This is important step and one must learn about these layer for better understanding.  You may use sequential model or anything else as per your choice. One must understand that selecting parameters and models is very important because learning with previous data or data provided occurs here so must have some good knowledge about this step.

Step 6: When the models is trained, it is the time for some real time prediction. Please check the model with test data which we have created during test and train split step or referring to step 4. You may watch the video on stocks prediction for such.

Step 7: Pleas look at the graph because it is important to know how much close the  predicted values are close to the original values.

Hope you have understand the steps in better way. You may also visit the main website www.aisangam.com for more details and services we offers. Also you may visit the AI Sangam you tube channel for all types of video.

2 thoughts on “Stocks Prediction using LSTM Recurrent Neural Network and Keras”

  1. Anonymous says:

    where is the code????????????????

    1. AISangam says:

      Please visit out github repository link to see the code with proper documented Readme file
      https://github.com/AISangam/Predicting-stock-prices-with-LSTM-Keras

Leave a Reply

Your email address will not be published.