Long Short-Term Memory (LSTM) : 1. Problem Statement
Long Short-Term Memory (LSTM) : 1. Problem Statement
Prediction of upward and downward movements of stock market prices carries obvious
financial, political and economic benefits. This task is solved by analyzing the given
company’s historical prices. The report will also study undergoing active research in creating
stock market prediction models using machine learning (ML). This project will follow the
latter approach, where a machine learning algorithm is presented with historical stock data.
An LSTM algorithm is given historical information to train a model to infer future prices
given recent stock market price. In this report we use long short-term memory (LSTM)
model, a recurrent neural network (RNN) based mode, to make upward or downward
movement predication, of the DJI, S&P 500 stock prices over the course of a year.
Artificial Intelligence (AI) is impacting every aspect of our lives. Machine Learning
algorithms can accomplish tasks that until now only humans could perform. With AI
improving, this is an exciting time to adopt it technology and use it to transform how
companies make investment decisions. Machine Learning (ML) is a subset and an application
of Artificial Intelligence (AI), which is a field within computer science. Using Machine
learning algorithms and models we explain the returns and company stock characteristics,
i.e., stock market prices of companies’ accounting and financial instruments, these
characteristics can then be used to make predict expected stock price returns
This report evaluates stock market price prediction , using Long Short-Term Memory
(LSTM) & Amplifier Model ; Gated recurrent units (GRUs) models along with the Adam
optimizer, the price of a stock at the next day's market close based on the stock market data
collected from the past year period. The performance, evaluation and comparison of , the
one-step predictions for the stock prices and returns were compared with multi-step
predictions for the same stock prices .
1. PROBLEM STATEMENT
This report investigates a Long Short-Term Memory (LSTM) model, an artificial neural
network (ANN) model. As the articles proposing these models often compare with outdated
models, the goal of this study is to compare recent ones by answering the following question:
How does the recent hybrid ANN models; pre-processed evolutionary Levenberg-Marquardt
ANN, Bayesian regularized ANN and technical and fractal analysis ANN; perform in
accuracy on one-day stock price prediction on the same input data and which of these gives
the most promising results?
2. SCOPE OF STUDY
The LSTM models studied in this project is tested and analysed on DJI, S&P 500 stock
market prices over the course of one year. The stock prices prediction will be one day in the
future, called one-day prediction throughout this project. This study has no guidelines on how
well these studied models can be used in earning money when used on actual stock market
prices.
Using an LSTM model to make a one-day stock price prediction and movements. Long
Short-Term Memory (LSTM) is a powerful tool in sequence prediction tasks, LSTMs are
able to store previous and past and information. Past stock market price are important in
stock price predication. At the moment it is nearly not possible to make the exact stock price
prediction, but it is possible to capture the upward movement and downward movement
trends of prices using LSTMs
Project Requirements
Anaconda
Jupyter notebook
Python 3.8
TensorFlow
Keras
Numpy
Pandas
Matplotlib
Sklearn
ReadMe File
# Stock-Price-Prediction-via- Recurrent neural network RNN
-The goal of this project is to predict stock market prices , using Long Short-Term Memory
(LSTM) & Amplifier Model ; Gated recurrent units (GRUs) models along with the Adam
optimizer, the price of a stock at the next day's market close based on the stock market data
collected from the past year period. Thereafter, the one-step predictions for the stock prices
and returns were compared with multi-step predictions for the same.
Data Approach
The quality of data used in this project is of good standard. The Yahoo Finance and Google
Finance is our source for the stock market prices that we investigated and analysed in this
assignment. Our programming of choice is Python, Jupyter Notebook and Anaconda. We will
use Dow Jones Industrial Average (DJI) and S & P 500 (GSPC) data we got from Yahoo
Finance and Google Finance.
Each artificial neuron in the network is represented by some directed edges (connections
between neurons in different layers), a node and a mathematical function. The inputs (like
synapses) to a node are multiplied by adaptive weights (like the strength of the respective
signals) and activates the neuron if the sum of the inputs satisfy a mathematical
function[ CITATION Car03 \l 1033 ]. Different mathematical functions are used to indicate
whether a neuron is activated. Some of these functions include the threshold, piecewise linear
and, most frequently used, the sigmoid function [18]:
1
Sigmoid function ϕ(t) = −t (1)
(1+e )
The ability to learn for an ANN is by updating the network architecture and connection
weights. The network must learn and adjust the weights iteratively from available training
techniques, which improves the performance. The ANN learns a rule, like an input-output
relationship, from example data[ CITATION AKJ96 \l 1033 ].
The nodes with their respective function process the information received by the input nodes.
The applied weights to each connection represent the significance in terms of impact on
output nodes the information stored in the node has. These nodes are then trained to
determine significant nodes. The most popular training technique is Backpropagation (BP).
The BP process works as follows: the output values are compared with the actual values to
compute the value of some predefined error-function. This error function is typically the
MSE
By various techniques, Levenberg-Maurquardt[ CITATION PAW97 \l 1033 ] being the one
used by most ANNs in this study, the error is fed back through the network. The Levenberg-
Marquardt (LM) (LM and Levenberg-Marquardt Backpropagation (LMBP) will be
interchangeably used in this study) algorithm is a hybrid optimization technique which
combine the positive attributes of Gauss-Newton algorithm and gradient descent algorithms.
Using the error information, the algorithm adjusts the weights of each connection in order to
reduce the value of the error function by some small amount. After repeating this process for
a sufficiently large number of training cycles (epochs), the network will usually converge to
some state where the error of the calculations is small.
For an ANN to learn, it is presented with an amount of data called the training data. The
training data is used to adjust the weights on the neural network. On each epoch, the ANN
has some amount of validation data on which it predicts and calculates an accuracy measure
to assess the performance on data which it has not trained on. This is done to avoid
overfitting (avoid that an increase in accuracy over training data gives a decrease in
accuracy over validation data). The testing set is where the ANN will predict in order to
confirm the actual predictive performance of the ANN model.
The popularity of MLP can be explained by the network’s ability to learn complex
relationships between input and output patterns, which could be difficult to model with
conventional algorithmic methods[ CITATION AKJ96 \l 1033 ].
Design Methodology
This study will explore the background of stock market Prediction using ANNs and hybrid
models. To fulfil the aims of our study, the following factors will be used to choose the
model, the models are all hybrids with ANN, that they were proposed at earliest three years
ago, they have performed better than those models which they were compared with. Three
different models will be taken into consideration when choosing the type of hybrid models;
the Fractal analysis and Technical analysis ANN (FTANN) and when making changes to the
traditional technical indicators, the Pre-processed Evolutionary Levenberg-Marquardt ANN
(PELMNN) using extensive pre-processing and BRANN will be deviating from the popular
Levenberg-Marquardt Backpropagation algorithm in the training stage and also using
technical indicators. We shall implement the models in MATLAB and Python using Artificial
Neuron Networks Toolbox and Global Optimization Toolbox. The steps to be carried out in
MATLAB are network initializing, pre-processing data input, network training, network
prediction and calculating performance measures.
Gant chart
1. Problem statement
2. Data processing
3. Model building
4. Model compiling
5. Model fitting
6. Model prediction
7. Result visualization