Uploaded by Lazer Weird

Stock Price Prediction Model Mini Project Report

advertisement
BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY)
COLLEGE OF ENGINEERING
DEPARTMENT OF ENGINEERING & TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI,410210
Mini Project Report
On
Stock Price Prediction Model
Subject-: - Machine Learning
Presented By
Roll No.
Name
PRN
47
Bhautik Tandel
2143110182
49
Anirudh Jagtap
2143110184
37
Sohail Alekar
2143110185
56
Sakshi Yadav
2143110210
Signature of Internal Examiner
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 1
BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY)
COLLEGE OF ENGINEERING
DEPARTMENT OF ENGINEERING & TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI,410210
This is to certify that the project entitled, “Stock Price Prediction Model”, which is being
submitted here with for the award of B.Tech. Department of Computer Science & Business
Systems, is the result of the workcompleted by Bhautik Tandel under my supervision and guidance
within the four walls of the institute and the same has not been submitted elsewhere for the award
of any degree.
Guide
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
(Head of Department)
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS
KHARGHAR, NAVI MUMBAI
Principal
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 2
BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY)
COLLEGE OF ENGINEERING
DEPARTMENT OF ENGINEERING & TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI,410210
This is to certify that the project entitled, “Stock Price Prediction Model”, which is being
submitted here with for the award of B.Tech. Department of Computer Science & Business
Systems, is the result of the workcompleted by Anirudh Jagtap under my supervision and guidance
within the four walls of theinstitute and the same has not been submitted elsewhere for the award
of any degree.
Guide
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
(Head of Department)
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS
KHARGHAR, NAVI MUMBAI
Principal
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 3
BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY)
COLLEGE OF ENGINEERING
DEPARTMENT OF ENGINEERING & TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI,410210
This is to certify that the project entitled, “Stock Price Prediction Model”, which is being
submitted here with for the award of B.Tech. Department of Computer Science & Business
Systems, is the result of the workcompleted by Sohail Alekar under my supervision and guidance
within the four walls of the institute and the same has not been submitted elsewhere for the award
of any degree.
Guide
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
(Head of Department)
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS
KHARGHAR, NAVI MUMBAI
Principal
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 4
BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY)
COLLEGE OF ENGINEERING
DEPARTMENT OF ENGINEERING & TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI,410210
This is to certify that the project entitled, “Stock Price Prediction Model”, which is being
submitted here with for the award of B.Tech. Department of Computer Science & Business
Systems, is the result of the workcompleted by Sakshi Yadav under my supervision and guidance
within the four walls of theinstitute and the same has not been submitted elsewhere for the award
of any degree.
Guide
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
(Head of Department)
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS
KHARGHAR, NAVI MUMBAI
Principal
DEPARTMENT OF ENGINEERING &
TECHNOLOGY OFFCAMPUS,
KHARGHAR, NAVI MUMBAI
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 5
Abstract
In this project we will be making a model that will predict the approximate price of a certain stock in
the near future. A stock market is a public market where you can buy and sell shares for publicly listed
companies. The stocks, also known as equities, represent ownership in the company. The stock
exchange is the mediator that allows the buying and selling of shares. Stock Price Analysis is a very
nice application of Machine Learning because it involves a lot of previous data and using regression to
predict the data through processing it, we will be implementing Machine Learning Algorithms to help
the users discover the future value of the stock to gain significant profit. We will be creating a data set
for a year’s period and then train the model by applying algorithms until it generates prediction of
values that has minimal error.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 6
Index
Chapter No.
Title
Page No.
1
Introduction
8
2
Literature Survey
9
3
System Design
13
4
Implementation
16
5
Results
21
6
Conclusion
22
7
References
23
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 7
Chapter 1
Introduction
Due to the high profit of the stock market, it is one of the most popular investments. People investigated
for methods and tools that would increase their gains while minimizing the risk, as the level of trading
and investing grew. Two stock exchanges namely- the National Stock Exchange (NSE) and the
Bombay Stock Exchange (BSE), which are most of the trading in Indian Stock Market takes place.
Sensex and Nifty are the two prominent Indian Market Indexes. Since the prices in the stock market
are dynamic, the stock market prediction is complicated.
The future price of a stock is the main motivation behind the stock price prediction. In various cases
like business and industry, environmental science, finance and economics motivation can be useful.
The future value of the company’s stock can be determining. A stock market prediction is described as
an action of attempting to classify the future value of the company stock or other financial investment
traded on the stock exchange.
The forthcoming price of a stock of the successful estimation is called the Yield significant profit. This
helps you to invest wisely for making good profits. From gradually the very past years some forecasting
models are developed for this kind of purpose and they had been applied to money market prediction.
We will be making a mode using Linear Regression.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 8
Chapter 2
Literature Survey
Citation
Title
Authors
Methods
Advantages
Limitations
Results
[1]
The impact
of stock
market
performanc
e upon
economic
growth.
Forecasting
market
price of
stock using
artificial
neural
network.
Masoud
Najeb.
Convolut
ional
Neural
Network
s
Capability of
learning on
its own.
Lot of
training data
is needed for
the CNN to
be effective.
CNN can
effectually
recognize the
altering trend
in stock
market price.
Mukurte
Amod,
Tanuja
Sarode.
Deep
Neural
Network
s
More
efficient at
learning
complex
features and
performing
more
intensive
computationa
l tasks
It requires
very large
amount of
data in order
to perform
better than
other
techniques
A cross
country
empirical
analysis on
the impact
of financial
developmen
t and asset
tangibility
on
internationa
l trade.
A survey of
attack
detection
approaches
in
collaborativ
e filtering
recommend
Hur Jung,
Manoj Raj,
Yohanes E.
Riyanto.
LSTMMethod
LSTM cells
are used in
recurrent
neural
networks that
learn to
predict the
future from
sequences of
variable
lengths
It fails to
store
information
for a longer
period of
time and
takes long
time to train.
These new
features are
given to a
Stacked
LSTM
Autoencoder
for multistepahead
estimation of
the stock
concluding
value.
The method
that is applied
on
this research
to predict
Bitcoin on
the stock
market
Rezaimehr,
F., &
Dadkhah,
C.
RNN
(Recurre
nt Neural
Network
)
RNN enable
you to model
timedependent
and
sequential
data
problems,
RNN is tough
to train due to
the gradient
problem
[2]
[3]
[4]
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
RNN can
effectually
recognize the
altering trend
in stock
market price.
Page | 9
er systems.
[5]
Research on Sayavong
Stock Price Lounnapha.
Prediction
Method
Based on
Convolution
al Neural
Network
like stock
exchange
prediction.
Machine Capability of
Learning learning on
Techniqu its own as the
es and
human
through
sentiments is
social
more
media
affectively
applied.
[6]
Linear
regression
Analysis.
Hidden
Markov
Model.
[7]
Enhancing
Soheila
Profit by
Abrishami.
Predicting
Stock Prices
using Deep
Neural
Networks
Time
Series
Linear
Mode.
[8]
A Case
Study
Yahoo
Finance
Stock
Market
Ferdiansyah
.Wang, D.,
Liang, Y.,
Xu, D.,
Feng, X., &
Guan, R.
ARIMA
Model.
[9]
Technical
analysis and
the London
stock
exchange
Chong
Terence
Tai-Leung,
Wing-Kam
Ng
HoltWinters
Seber
George AF,
Lee Alan J,
John Wiley
and Sons.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Lot of
training data
is needed.
reflex
towards web
news is taken
into count to
reduce the
gap
and make the
prediction
much more
accurate
Hidden
Hidden
HMM is a
Markov
Markov
stochastic
Model gives
Model’s main model
better
problems are assumed to
optimization. Evaluation,
be a Markov
decoding and process with
learning.
hidden states
has more
accuracy
when
compared to
other models.
It makes the
Linear
Time series
estimation
Regression
regression is
procedure
Only Looks
a statistical
simple.
at the Mean
method for
of the
predicting a
Dependent
future
Variable.
response
based.
Only requires Difficult to
ARIMA
the prior data predict
models can
of a time
turning
also be used
series to
points.
to predict the
generalize the
future price
forecast.
of your
stocks based
on the past
prices.
Capability of Lot of
The method
learning on
training data that is applied
its own as the is needed.
on
human
this research
sentiments is
to predict
Page | 10
[10]
Classificatio Liaw Andy,
n and
Matthew
regression
Wiener
by Random
Forest.
[11]
Neural
networkbased
prediction
techniques
for global
modeling of
M
Oyeyemi
Elijah O.,
Lee-Anne
McKinnell,
Allon WV.
[12]
Forecasting
stock
market
movement
direction
with
support
vector
machine.
Huang Wei,
Yoshiteru
Nakamori,
Shou-Yang
Wang
[13]
Share Price
Prediction
using
Machine
Jeevan B.
more
affectively
applied.
Random The random
Forest
forest
and Deep algorithm
Neural
provides a
Network higher level
Models
of accuracy
in predicting
outcomes
over the
decision tree
algorithm.
Method - The multiple
deep
layers in deep
learning neural
networks networks
allow models
to become
more
efficient at
learning
complex
features and
performing
more
intensive
computationa
l tasks.
Linear
Linear
regressio regression
n
fits linearly
seperable
datasets
almost
perfectly and
is often used
to find the
nature of the
relationship
between
variables.
Artificial ANN learn
Neural
from events
Network and make
and
decisions
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Algorithms
are fast to
train, but
quite slow to
create
predictions
once they are
trained.
Bitcoin on
the stock
market
Prediction
speed is
significantly
faster than
training speed
because we
can save
generated
forests for
future uses.
It requires
very large
amount of
data in order
to perform
better than
other
techniques.
Deep learning
models can
achieve stateof-the-art
accuracy,
sometimes
exceeding
human-level
performance.
Data outliers
can damage
the
performance
of a machine
learning
model
drastically
and can often
lead to
models with
low
accuracy.
Algorithms
are fast to
train, but
quite slow to
While the
results
produced by
linear
regression
may seem
impressive on
linearly
seperable
datasets.
neural
networks are
able to
predict
Page | 11
Learning
Technique
Random
Forest
techniqu
es
through
commenting
on similar
events.
[14]
Stock
Market
Prediction
Using
Machine
Learning
Techniques.
Naadun
Sirimevan.
Deep
Neural
Network
s
More
efficient at
learning
complex
features and
performing
more
intensive
computationa
l tasks
[15]
Application
of neural
network to
technical
analysis of
stock
market
prediction.
Mizuno
Hirotaka,
Michitaka
Kosaka,
Hiroshi
Yajima,
Norihisa
Komoda
RNN
(Recurre
nt Neural
Network
)
RNN enable
you to model
timedependent
and
sequential
data
problems,
like stock
exchange
prediction.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
create
predictions
once they are
trained.
accurately
using the
process of
backpropagat
ion
It requires
These new
very large
features are
amount of
given to a
data in order Stacked
to perform
LSTM
better than
Autoencoder
other
for multisteptechniques
ahead
estimation of
the stock
concluding
value.
RNN is tough RNN can
to train due to effectually
the gradient
recognize the
problem.
altering trend
in stock
market price.
Page | 12
Chapter 3
System Design
Stock market prediction is necessary, and it helps investors make the right decision. If a person invested
their money in a stock whose future value was decreased, that person would face a loss on his or her
investment. Because of that, future stock market predictions are very important. Not only that, but also
the human brain cannot make an accurate prediction about the stock market, this is where the need for
a technological approach to stock market prediction arises, where a more accurate prediction of the
future stock value would result in more profit.
Linear regression denotes a linear relationship between the dependent variable and the independent
variable or variables. The dependent variable is the target variable in the model. That would be the
value that is going to be predicted. In linear regression, “simple linear regression” refers to an analysis
that uses one independent variable, whereas “multiple linear regression” refers to an analysis that uses
multiple independent variables. Basically, all machine learning algorithms work on historical data
where they train the system using those data, and finally, predict the requirements using the trained
model. This data set contains a variety of attributes about the stock market. According to the reviews
that have been done for stock market prediction using linear regression, there were some common
attributes and variables that were contained in the data set related to the stock market as follows:
Open Price - Open Price of Stock
High Price - Highest price possible at any instance of time
Low Price - Lowest Price possible at any instance of time
Close Price - Closing Price of Stock
Close Price - Closing Price of Stock
The accuracy of the result of the model mostly depends on the amount and reliability of the training
data set.
The below diagram illustrates how the linear regression algorithms are trained for the predictions of
the stock market.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 13
Fig. 1 System Architecture
This section will critically review the various methodologies that have been used in related research
for stock market prediction using linear regression.
According to the research¹ conducted by Karim R. and a few others, it ensures that the stock market
relies heavily on knowledge whereas, everyone requires a firm grasp of historical and prospective stock
market trends nowadays. This could help the investor to get an idea about the stock’s upcoming rates
and assess the risk in advance. Furthermore, the main intention of this research is to make a better
judgment by using the Linear regression algorithm and Decision tree algorithm with the use of a
statistical formula to improve the stock price prediction accuracy.
Additionally, this process is required to follow four main steps such as raw data, data cleaning and
separating train and test datasets, fitting the train data into the model and evaluating the result to acquire
the final outcome and make a decision.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 14
Technology and Language used for project: Languages:
1. Python: Version 3.10.2
2. HTML5, CSS3
Tools with their versions:
1. Operating System: Windows
2. Editors and IDE:
a. PyCharm: Version 2022.2.4
b. Visual Studio Code with Jupyter notebook: Version 1.73
3. Dataset: Users, Books and Ratings
4. Libraries and Framework:
a. NumPy: Version 1.23.1
b. Pandas: Version 1.4.3
c. Scikit learn: Version 1.1.2
d. Pickle: Version 4
e. Bootstrap: Version 5.2
f. Flask: Version 2.2.2
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 15
Chapter 4
Implementation
Data Summary
The dataset is comprised of three csv files: AAPL.csv
Stock_dataset:
1. The Required Colums are Open, Low, Close, Volume
2. Date with respect to the dataset
Now, we will visualize the Close data values.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 16
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 17
Linear Regression:
1. Create Training, Testing, Validation Data
2. Apply Linear Regression on Training Data
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 18
3. Evaluate Train Dataset and Apply Linear Regression on Test Data
4. Display Model Results
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 19
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 20
Chapter 5
Results
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 21
Chapter 6
Conclusion
From the research and analysis done so far, we found linear regression is the best approach for the stock
prediction problem. By using the past dataset, we have predicted the appropriate right values of stock
price. The model we made estimates the price with accuracy of 90% achieved in training as well as
testing phase. Libraries such as Pandas, Seaborn, SkLearn, Numpy and Matplotlib are very effective
libraries used in making this project execute successfully. The attributes such as open price, close price,
day high price, day low price, upper band price, lower band and volume are used to predict the accurate
price of the stock. Hence, this model can be used in practical life too to demonstrate the use in actual
live markets to earn profits in investment in stocks.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 22
References
[1] Masoud Najeb MH, The impact of stock market performance upon economic growth.
International Journal of Economics and Financial Issues, 3(4) (2017),pp. 788-798.
[2] Murkute Amod,Tanuja Sarode, Forecasting market price of stock using artificial neural network.
International Journal of Computer Applications,124 (12) (2015), pp. 11-15
[3] Hur Jung, Manoj Raj, Yohanes E. Riyanto Finance and trade: A cross country empirical analysis
on the impact of financial development and asset tangibility on international trade. World
Development, 34(10) (2006), pp.1728-1741
[4] Rezaimehr, F., & Dadkhah, C. (2021). A survey of attack detection approaches in collaborative
filtering recommender systems. Artificial Intelligence Review, 54(3), 2011-2066.
[5] Research on Stock Price Prediction Method Based on Convolutional Neural Network, IEEE
2019- Sayavong Lounnapha.
[6] Seber George AF, Lee Alan J. Linear regression Analysis., John Wiley and Sons (2012), p,329
[7] Enhancing Profit by Predicting Stock Prices using Deep Neural Networks, IEEE 2019-Soheila
Abrishami.
[8] An LSTM-Method for Bit-coin Price Prediction: A Case Study Yahoo Finance Stock Market,
IEEE 2019- Ferdiansyah.Wang, D., Liang, Y., Xu, D., Feng, X., & Guan, R. (2018). A contentbased recommender system for computer science publications. Knowledge-Based Systems, 157,
1-9.
[9] Chong Terence Tai-Leung, Wing-Kam Ng Technical analysis and the London stock exchange:
testing the MACD and RSI rules using the FT30. Applied Economics Letters, 15 (14) (2008), pp.
1111-1114.
[10] Liaw Andy, Matthew Wiener Classification and regression by Random Forest. R news, 2 (3)
(2002), pp. 18-22.
[11] Oyeyemi Elijah O., Lee-Anne McKinnell, Allon WV. Poole Neural network-based prediction
techniques for global modeling of M (3000) F2 ionospheric parameter. Advances in Space
Research, 39 (5) (2007), pp. 643-650.
[12] Huang Wei, Yoshiteru Nakamori, Shou-Yang Wang Forecasting stock market movement
direction with support vector machine. Computers & Operations Research, 32 (10) (2005), pp.
2513-2522.
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 23
[13] Share Price Prediction using Machine Learning Technique, IEEE 2019-Jeevan B.
[14] Stock Market Prediction Using Machine Learning Techniques, IEEE 2020- Naadun Sirimevan.
[15] Mizuno Hirotaka, Michitaka Kosaka, Hiroshi Yajima, Norihisa Komoda Application of neural
network to technical analysis of stock market prediction. Studies in Informatic and control, 7 (3)
(1998), pp. 111-120
BVDU-DET-NM/CSBS/2022-23/ML-miniproject
Page | 24
Download