You are on page 1of 19

STOCK MARKET

PREDICTION
USING DEEP LEARNING TECHNIQUES

PRESENTED BY:
VASUNDHRA PANDITA-28
HIMADRI PANDYA-29
RAKSHA NAYAK--1513029
INTRODUCTION

• A stock market, equity market or share market is the aggregation of buyers and sellers


(a loose network of economic transactions, not a physical facility or discrete entity)
of stocks (also called shares).
• Represent ownership claims on businesses; these may include securities listed on a
public stock exchange, as well as stock that is only traded privately.
• Examples of the latter include shares of private companies which are sold to investors
through equity crowdfunding platforms.
• Stock exchanges list shares of common equity as well as other security types, e.g.
corporate bonds and convertible bonds.
TERMS

• Dividend: A portion of a company’s earnings that is paid to shareholders, or people that own that
company’s stock, on a quarterly or annual basis. Not all companies pay dividends. For instance, if
you trade penny stocks, you’re likely not after dividends.
• Close: The Price at which the market closes on the day.
• Moving Average: A stock’s average price-per-share during a specific period of time is called its
moving average. Some common time frames to study in terms of a stock’s moving average include
50- and 200-day moving averages.
• Open: The price at which the market opens on the day.
• Stop loss: The ultimate low value of the share.
CALCULATION

• Weighted average: It is a method of finding the average value of a group of numbers, which takes into
account how many times each number occurs, or its importance. A common real-world example is the
calculation of a grade-point average in schools.
• When it comes to buying stock, a weighted average price can be used when shares of the same stock are
acquired in multiple transactions over time. This is necessary if the transactions were for different
numbers of shares, since the larger purchases contribute more to the average. For example, the
mathematical average of $100 and $200 is $150, but if you bought 10 shares of stock at $100 and only
one share at $200, the lower-priced shares carry more weight when calculating the average price you
paid.
Formula:
Weighted average price= (first price*shares)+(second price*shares)+…. / total number of shares
METHODOLOGY

The main algorithms used are:


1. Perceptron Learning Algorithm
• The Perceptron is inspired by the information processing of a single neural cell called a neuron. A
neuron accepts input signals via its dendrites, which pass the electrical signal down to the cell
body. In a similar way, the Perceptron receives input signals from examples of training data that
we weight and combined in a linear equation called the activation.
activation = sum(weight_i * x_i) + bias
• The activation is then transformed into an output value or prediction using a transfer function,
such as the step transfer function.
prediction = 1.0 if activation >= 0.0 else 0.0
• For the Perceptron algorithm, each iteration the weights (w) are updated using the equation:

w = w + learning_rate * (expected - predicted) * x


Where w is weight being optimized, learning_rate is a learning rate that you must configure (e.g.
0.01), (expected – predicted) is the prediction error for the model on the training data attributed to
the weight and x is the input value
MODULES USED IN PYTHON

1.Numpy

-NumPy is not another programming language but a Python extension


module.
-It provides fast and efficient operations on arrays of homogeneous data.
-NumPy extends python into a high-level language for manipulating
numerical data, similiar to MATLAB.
2.PANDAS

-Pandas stands for “Python Data Analysis Library”.

-Pandas is quite a game changer when it comes to analyzing data with Python


- It is one of the most preferred and widely used tools in data munging/wrangling if
not THE most used one.
• Matplotlib

-Matplotlib is a python library used to create 2D graphs and plots by using python
scripts.
-It has a module named pyplot which makes things easy for plotting by providing
feature to control line styles, font properties, formatting axes etc.
- It supports a very wide variety of graphs and plots namely - histogram, bar charts,
power spectra, error charts etc.
- -It is used along with NumPy to provide an environment that is an effective open
source alternative for MatLab.
- It can also be used with graphics toolkits like PyQt and wxPython.
• Keras

-Keras is an Open Source Neural Network library written in Python that runs on top
of Theano or Tensorflow.
- It is designed to be modular, fast and easy to use.
- Keras doesn't handle Low-Level API such as making the computational graph,
making tensors or other variables because it has been handled by the "backend"
engine.
2. Delta Learning Algorithm

• Also called as the Least Mean Squared rule, is similar to the Perceptron but assumes only
continuous valued output variable and linear or sigmoid transfer functions.
• It minimizes the mean square error between the computed and the target output variables.
• For use with single layer neural networks.
ALGORITHM OF DELTA LEARNING RULE
3. Error Back Propagation Algorithm

• As the algorithm’s name implies, the errors(and hence the learning) propagate backwards from the
output nodes to the input nodes.
• Used to calculate the gradient of the error of the network with respect to the networks modifiable
weights.
• This gradient is then used to find weights that minimize the error.
• It usually allows quick convergence on satisfactory local minima for error in the kind of networks
to which it is suited.
FLOW CHART OF ERROR BACK
PROPAGATION ALGORITHM :
ERROR BACK PROPAGATION ALGORITHM

Initialize network weights (often small random values)


 do
     forEach training example named ex     
    prediction = neural-net-output(network, ex)  // forward pass  
       actual = teacher-output(ex)        
compute error (prediction - actual) at the output units     
    compute {\displaystyle \Delta w_{h}} for all weights from hidden layer to output layer  //
backward pass  
       compute {\displaystyle \Delta w_{i}} for all weights from input layer to hidden layer   //
backward pass continued
  update network weights // input layer not modified by error estimate
 until all examples classified correctly or another stopping criterion satisfied
 return the network
PLATFORM USED

•Python
1.Numpy
2.Matplotlib.pyplib
3.Pandas
4.Keras
• Reason

1. Extensive Support Libraries


2. Presence of Third Party Modules (PyPI)
3. User-friendly Data Structures
4. Faster Productivity and Speed
5. Can run on all modern operating systems through same byte code.
OUTPUT
 

REFERENCES

•medium.com/@mindfiresolutions.usa
•www.edureka.co
•www.pythonforbeginners.com
•towddatascience.com
•Machinelearn
•https://www.datacamp.com/community/tutorials/lstm-python-stock-market
•https://blog.usejournal.com/stock-market-prediction-by-recurrent-neural-network-on-lstm-model-56de700bff68
•https://www.kdnuggets.com/2018/11/keras-long-short-term-memory-lstm-model-predict-stock-prices.html   

• ngmastery.com
• www.icommercecentral.com

You might also like