Professional Documents
Culture Documents
Project Report
On
Bachelor of Technology
In
1
CANDIDATE’S DECLARATION
I hereby certify that the work which is being presented in this Project entitled “Share
Market Prediction using Machine Learning” in partial fulfillment of requirement for the
award of degree of B. Tech., Computer Science and Engineering submitted in Department of
Computer Science & Engineering at Guru Nanak Institute of Technology, Mullana, affiliated
to Kurukshetra University , Kurukshetra is an authentic record of my work carried out under
the supervision of Mr. Tejbir Rana, Assistent Proffessor of Department of CSE ,GNIT,
Mullana, Ambala.
The matter presented here has not been submitted by me in any other University /
Institute for the award of any other degree.
Mukul Gupta
University Roll No. - 6319018
This is to certify that the above statement made by the candidate is correct to the best of my
knowledge.
2
ACKNOWLEDGEMENT
I wish to express my sincere regards and gratitude to Mr. Tejbir Rana,( Assistant Professor)
in Department - Computer Science and engineering for his guidance, moral boosting,
continuous encouragement and appreciation, which are the vital factors in successful
completion of my minor project work.
My sincere thanks to all the faculty members and technical staff of Computer Science &
Engineering Department for providing the pleasant working conditions in the complete
duration of the minor project
Mukul Gupta
6319018
………….. …………..
Internal’s Signature External’s signature
3
LIST OF FIGURES
2.1 (a)
Financial facts associated 17
with the system (Tanglible
Costs)
2.1 (b)
Financial facts associated 17
with the system (Intangible
Costs)
4.1 (a)
System Design 28
4
4.1 (b)
System Design Use case 29
Index
5 (a)
Final Result Diagram 35
CONTENTS
Candidate Declaration 2
Acknoledgement 3
Certificate 4
List of figures 5
1.1 Overview 8
1.2 IDEA 8
2.1 Feasibility 10
5
2.2 Costs and Benefits Analysis 16
PHASE 18-24
3.2 Objective 19
4.2.5 Prophet 34
5.1 Result 36
5.2 Discussion 36
6.1 Conclusions 36
6.2 Scope For Future Work 37
6
REFERENCES 29
ANNEXURE 38-40
1. Chapter 1 – INTRODUCTION
Overview:
Predicting how the share market will perform is one of the most difficult things to
do. There are so many factors involved in the prediction – physical factors vs.
physhologocal, rational and irrational behavior, etc. All these aspects combine to
make share prices volatile and very difficult to predict with a high degree of
accuracy.
We will use machine learning. Using features like the latest announcements about
an organization, their quarterly revenue results, etc., machine learning techniques
have the potential to unearth patterns and insights we didn’t see before, and these
can be used to make unerringly accurate predictions. we will work with historical
data about the stock prices of a publicly listed company. We will implement a mix
7
of machine learning algorithms to predict the future stock price of this company,
starting with simple algorithms like averaging and linear regression, and then
move on to advanced techniques like Auto ARIMA and LSTM.
IDEA:
First it’s important to establish what we’re aiming to solve. Broadly, stock market
analysis is divided into two parts – Fundamental Analysis and Technical Analysis.
Our focus will be on the technical analysis part. We will use a company dataset that
describes the last history in stock market of that company. The financial data: Open,
High, Low and Close prices of stock are used for creating new variables which are
used as inputs to the model. The models are evaluated using standard strategic
indicators. The low values of these two indicators show that the models are efficient in
predicting stock closing price.
8
analysis models are based on machine learning. The SVM is designed to solve
regression problems in non-linear classification and time series analysis. The
generalization error is minimized using an approximate function, which is based on
risk diminishing principle. Thus, the ICA technique extracts various important
features from the dataset. The time series prediction is based on Linear regression.
The most basic machine learning algorithm that can be implemented on this data is
linear regression. The linear regression model returns an equation that determines the
relationship between the independent variables and the dependent variable. Different
machine learning models and risk strategies have been applied to stock market
prediction task trying to predict mainly the direction of the price for different time
frames and using different features that would affect market prices. Support Vector
Machines (SVM) and Artificial Neural Networks (ANN) are widely used for
prediction of stock prices and its movements. Every algorithm has its way of learning
patterns and then predicting. Stock market prediction is the act of trying to determine
the future value of a company stock or other financial instrument traded on an
exchange. The successful prediction of a stock's future price could yield significant
profit. The most basic machine learning algorithm that can be implemented on this
data is linear regression. The linear regression model returns an equation that
determines the relationship between the independent variables and the dependent
variable. Stock market prediction aims to determine the future movement of the stock
value of a financial exchange. The accurate prediction of share price movement will
lead to more profit investors can make.
FEASIBILITY:
Stock market cannot be accurately predicted. The future, like any complex problem,
has far too many variables to be predicted. The stock market is a place where buyers
and sellers converge. When there are more buyers than sellers, the price increases.
When there are more sellers than buyers, the price decreases. So, there is a factor
which causes people to buy and sell. It has more to do with emotion than logic.
9
Because emotion is unpredictable, stock market movements will be unpredictable. It’s
futile to try to predict where markets are going. They are designed to be
unpredictable. The proposed system will not always produce accurate results since it
does not account for the human behaviors. Factors like change in company’s
leadership, internal matters, strikes, protests, natural disasters, and change in the
authority cannot be taken into account for relating it to the change in Stock market by
the machine. The objective of the system is to give a approximate idea of where the
stock market might be headed. It does not give a long term forecasting of a stock
value. There are way too many reasons to acknowledge for the long term output of a
current stock. Many things and parameters may affect it on the way due to which long
term forecasting is just not feasible. Feasibility studies undergo four major analyses to
predict the system to be success and they are as follows:
Support Vector Machines (SVM) and Artificial Neural Networks (ANN) are widely
used for prediction of stock prices and its movements. Every algorithm has its way of
learning patterns and then predicting. The prediction model, which is based on SVM
and independent analysis, combined called SVM-ICA, is proposed for stock market
prediction. Various time series analysis models are based on machine learning. The
SVM is designed to solve regression problems in non-linear classification and time
series analysis. on. The prediction model, which is based on SVM and independent
analysis, combined called SVM-ICA, is proposed for stock market prediction. Various
time series analysis models are based on machine learning. The SVM is designed to
solve regression problems in non-linear classification and time series analysis. The
generalization error is minimized using an approximate function, which is based on
risk diminishing principle. Thus, the ICA technique extracts various important
features from the dataset. The time series prediction is based on SVM. The result of
10
the SVM model was compared with the results of the ICA technique without using a
preprocessing step. On the other hand, we have used linear regression. The most basic
machine learning algorithm that can be implemented on this data is linear regression.
The linear regression model returns an equation that determines the relationship
between the independent variables and the dependent variable.
For our problem statement, we do not have a set of independent variables. We have
only the dates instead. Let us use the date column to extract features like – day,
month, year, mon/fri etc. and then fit a linear regression model.. We will first sort the
dataset in ascending order and then create a separate dataset so that any new feature
created does not affect the original data. Another interesting ML algorithm that one
can use here is kNN (k nearest neighbours). Based on the independent variables, kNN
finds the similarity between new data points and old data points.
Efficient Market Hypothesis states that stock prices are a reflection of all the
information present in the world and generating excess returns is not possible by
merely analysing trade data which is already available to all public. Yet to further the
research rejecting this idea, a rigorous literature review was conducted and a set of
five technical indicators and 23 fundamental indicators was identified to establish the
possibility of generating excess returns on the stock market. Leveraging these data
points and various classification machine learning models, trading data of the 505
equities on the US S&P500 over the past 20 years was analysed to develop a classifier
effective for our cause. From any given day, we were able to predict the direction of
11
change in price by 1% up to 10 days in the future. The predictions had an overall
accuracy of 83.62% with a precision of 85% for buy signals and a recall of 100% for
sell signals. Moreover, we grouped equities by their sector and repeated the
experiment to see if grouping similar assets together positively effected the results but
concluded that it showed no significant improvements in the performance—rejecting
the idea of sector-based analysis. Also, using feature ranking we could identify an
even smaller set of 6 indicators while maintaining similar accuracies as that from the
original 28 features and also uncovered the importance of buy, hold and sell analyst
ratings as they came out to be the top contributors in the model. Finally, to evaluate
the effectiveness of the classifier in real-life situations, it was backtested on FAANG
(Facebook, Amazon, Apple, Netflix & Google) equities using a modest trading
strategy where it generated high returns of above 60% over the term of the testing
12
of the PIECES framework. The PIECES framework can help in identifying
operational problems to be solved, and their urgency:
1. Performance:
2. . Information: Does current mode provide end users and managers with
timely, pertinent, accurate and usefully formatted information? System
provides end users with timely, pertinent, accurate and usefully formatted
information. Since all the stock related information is being pulled from
Yahoo Finance against a unique NSE Stock Symbol, it will provide for
meaningful and accurate data to the investor. The investing decisions are made
by the traditional investors manually. This results in loss of validity of data
due to human error. The information handling and the investing decision in the
proposed system will be driven by computerized and automatically updated
prediction and validation of stock data. The human errors will be minimal. The
data will be automatically updated from time to time and will be validated
before the data is processed into the system.
3. Economy: Does current mode of operation provide cost-effective
information services to the business? Could there be a reduction in costs
and/or an increase in benefits? Page 13 of 76 Determines whether the system
offers adequate service level and capacity to reduce the cost of the business or
increase the profit of the business. The deployment of the proposed system,
manual work will be reduced and will be replaced by an IT savvy approach.
Moreover, it has also been shown in the economic feasibility report that the
recommended solution is definitely going to benefit economically in the long
run. The system is built on Excel, R and JavaScript. Excel and Javascript do
13
not need any additional installation; they are in-built in every system. R needs
installation but it is free software. So, overall the application is very
economically feasible.\
4. Control: Does current mode of operation offer effective controls to protect
against fraud and to guarantee accuracy and security of data and information?
As all the data is pulled from Yahoo Finance, which is a public stock data
provider, it does not contain any confidential information which can be
misused, so on that contrast there should be no use of any security corner for
this system.
14
1.1.4 Economical Feasibility:
The concerned business must be able to see the value of the investment it is pondering
before committing to an entire system study. If short-term costs are not overshadowed
by long-term gains or produce no immediate reduction in operating costs, then the
system is not economically feasible, and the project should not proceed any further. If
the expected benefits equal or exceed costs, the system can be judged to be
economically feasible. Economic analysis is used for evaluating the effectiveness of
the Proposed System. The economical feasibility will review the expected costs to see
if they are in-line with the projected budget or if the project has an acceptable return
on investment. At this point, the projected costs will only be a rough estimate. The
exact costs are not required to determine economic feasibility. It is only required to
15
determine if it is feasible that the project costs will fall within the target budget or
return on investment. A rough estimate of the project schedule is required to
determine if it would be feasible to complete the systems project within a required
timeframe. The required timeframe would need to be set by the organization.
Following is the figure showing the approx. amount of cost and benefit to the
system:
16
Intangible cost:
Problem Formulation:
The vast majority of the stockbrokers while making the prediction utilized the
specialized, fundamental or the time series analysis. Overall, these techniques couldn't
be trusted completely, so there emerged the need to give a strong strategy to financial
exchange prediction. To find the best accurate result, the methodology chose to be
implemented as machine learning and AI along with supervised classifier. Results
were tried on the binary classification utilizing SVM classifier with an alternate set of
17
a feature list. The greater part of the Machine Learning approach for taking care of
business issues had their benefit over factual techniques that did exclude AI, despite
the fact that there was an ideal procedure for specific issues. Swarm Intelligence
optimization method named Cuckoo search was most easy to accommodate the
parameters of SVM. The proposed hybrid CS-SVM strategy exhibited the
performance to mcreate increasingly exact outcomes in contrast with ANN. Likewise,
the CS-SVM display performed better in the forecasting of the stock value prediction.
Prediction stock cost utilized parse records to compute the predicted, send it to the
user, and autonomously perform tasks like buying and selling shares utilizing
automation concept.
18
Objective:
19
Min and Lee were doing prediction of bankruptcy using machine
learning. They evaluated methods based on Support Vector
Machine, multiple discriminant analysis, logistic regression
analysis, and three-layer fully connected back-propagation neural
networks. Their results indicated that support vector machines
outperformed other approaches.
Tsai and Wang did a research where they tried to predict stock
prices by using ensemble learning, composed of decision trees and
artificial neural networks. They created dataset from Taiwanese
stock market data, taking into account fundamental indexes,
technical indexes, and macroeconomic indexes. The performance
of Decision Tree + Artificial Neural Network trained on Taiwan
20
stock exchange data showed Fscore performance of 77%. Single
algorithms showed F-score performance up to 67%.
Analytics:
21
It is a quantitative modeling tool used for financial time series
forecasting. The system is adaptive in its core as it learns the
patterns and geometrical relationships defined by historical time
series data points, which are unique for each individual stock,
index, or another financial instrument.
Markettrak:
Its stock market forecast system consists of two major parts: an
extensive database and a forecast model. The forecast model reads
the database and then makes a prediction of where the market is
headed. From this prediction, it determines a trading position for
the Dow Diamonds or the SP500 Spiders. The database and
forecast are updated daily at the close of trading.
Stock-Forecasting.com:
There are three conventional approaches for stock price prediction: technical
analysis, traditional time series forecasting, and machine learning method.
Earlier classical regression methods such as linear regression, polynomial
regression, etc. were used to predict stock trends. Also, traditional statistical
22
models which include exponential smoothing, moving average, and ARIMA
makes their prediction linearly. Nowadays, Support Vector Machines (Cortes
& Vapnik, 1995) (SVM) and Artificial Neural Networks (ANN) are widely
used for the prediction of stock price movements. Every algorithm has its way
of learning patterns and then predicting. Artificial Neural Network (ANN) is a
popular and more recent method which also incorporate technical analysis for
making predictions in financial markets. ANN includes a set of threshold
functions. These functions trained on historical data after connecting each
other with adaptive weights and they are used to make future predictions.
(Trippi & Turban, 1992; Walczak, 2001; Shadbolt & Taylor, 2002) (Kuan &
Liu, 1995) investigated the out-of-sample forecasting ability of recurrent and
feedforward neural networks based on empirical foreign exchange rate data
(Kuan & Liu, 1995). In 2017, Mehdi Khashei and Zahra Haji Rahimi
evaluated the performance of series and parallel strategies to determine a more
accurate one using ARIMA and MLP (Multilayer Perceptron) (Mehdi &
Zahra, 2017).
Artificial neural networks have been used widely to solve many problems due
to its versatile nature. (Samek & Varachha, 2013) (Yodele et al., 2012),
presented a hybridized approach, i.e., a combination of the variables of
fundamental and technical analysis of stock market indicators to predict future
stock prices to improve the existing methods, (Yodele et al., 2012) (Y Kara &
A Boyacioglu, 2011) discussed stock price index movement using two models
based on Artificial Neural Network (ANN) and Support Vector Machine
(SVM). They compared the performances of both the models and concluded
that the average performance of the ANN model was significantly better than
the SVM model. (Y Kara & A Boyacioglu, 2011) (Qi & Zhang, 2008)
investigated the best modeling of trend time series using Neural Network.
They used four different approaches, i.e., raw data, raw data with a time index,
de-trending and differencing for modeling various trend patterns and
concluded Neural Network gives better results (Qi & Zhang, 2008). H.K.
Cigizoglu, (2003) discussed the application of ANN forecasting, estimation
23
and extrapolation of the daily flow data belonging to the rivers in the East
Mediterranean region of Turkey. In their study, they found that ANN provides
a better fit to the data than conventional methods (Cigizoglu, 2003). ANN can
consider as a computation or a mathematical model which is inspired by the
functional or structural characteristics of biological neural networks. These
neural networks are developed in such a way that it can extract patterns from
noisy data. ANN first train a system using a large sample of data known as
training phase then it introduces the network to the data which was not
included in the training phase, this phase known as validation or prediction
phase. The sole motive of this procedure is to predict new outcomes. (Bishop,
1995) This idea of learning from training and then predicting outcomes in
ANN comes from the human brain which can learn and respond. Thus ANN
has been used in many applications and is proven successful in executing
complex functions in a variety of fields (Fausett, 1994).
The data used in this case study is tick data of Reliance Private Limited from
period 30 NOV 2017 to 11 JAN 2018 (excluding holidays). There are roughly
15,000 data points per day. The dataset used contains approximately 430,000
data points. The data obtained from Thomson Reuter Eikon databaseFootnote1
(This database is a paid product of Thomson Reuter). Each tick refers to the
change in the price of the stock from trade to trade. The stock price at the start
of every 15 min extracted from the tick data. This represents the secondary
dataset on which same algorithms have run. In this study, we have made
predictions on Tick Data, and 15-min Data using the same neural networks
and their results are compared.
24
Functional Requirement:
Functional requirement are the functions or features that must be included in any
system to satisfy the business needs and be acceptable to the users. Based on this, the
functional requirements that the system must require are as follows:
2. The system should collect accurate data from the stock market website in
consistent manner.
6. The user can look previous data Information which was collected.
7. The user can also be recommended on the basis of the trending stocks which
would require the data regarding the stocks.
• Modules:
25
▪ Matplotlib: It consists of several plots like the Line Plot, Bar Plot,
Scatter Plot, Histogram etc. through which we can visualise various types
of data.
Non-Functional Requirement:
Non-functional requirement is a description of features, characteristics and attribute of
the system as well as any constraints that may limit the boundaries of the proposed
system. The non- functional requirements are essentially based on the performance,
information, economy, control and security efficiency and services. Based on these
the non-functional requirements are as follows:
o Hardware
26
System type: 64-bit Operating System o Software
o Security: The user will only be able to access the website using his login
details and will not be able to access the computations happening at the back
end.
System Design:
27
Figure 4.1 (a)
Use case Index:
28
Description: With the change of market and technology regular update of system is
required. The predicted result of stock exchange and their actual price will be
autoupdated by the Automated User Interface Application Backend on regular basis.
System Implementation: we will work with historical data about the stock
prices of a publicly listed company. We will implement a mix of machine learning
algorithm to predict the future stock price of this company, starting with simple
algorithms like averaging and linear regression, and then move on to advanced
techniques like Auto ARIMA and LSTM.
We will takes the whole content in 7 parts:
29
We’ll dive into the implementation part of this article soon, but first it’s important to
establish what we’re aiming to solve. Broadly, stock market analysis is divided into
two parts – Fundamental Analysis and Technical Analysis.
Our focus will be on the technical analysis part. We’ll be using a dataset and for
this particular project, We have used the data for ‘Tata Global Beverages’.
We will first load the dataset and define the target variable for the problem:
There are multiple variables in the dataset – date, open, high, low, last, close,
total_trade_quantity, and turnover.
• The columns Open and Close represent the starting and final price at which
the stock is traded on a particular day.
• High, Low and Last represent the maximum, minimum, and last price of the
share for the day.
• Total Trade Quantity is the number of shares bought or sold in the day and
Turnover (Lacs) is the turnover of the particular company on a given date.
Another important thing to note is that the market is closed on weekends and public
holidays.Notice the above table again, some date values are missing – 2/10/2018,
6/10/2018, 7/10/2018. Of these dates, 2nd is a national holiday while 6th and 7th fall
on a weekend.
The profit or loss calculation is usually determined by the closing price of a stock for
the day, hence we will consider the closing price as the target variable. Now we will
plot the target variable to understand how it’s shaping up in our data:
30
3.1.1 Moving Average:
‘Average’ is easily one of the most common things we use in our day-to-day lives. For
instance, calculating the average marks to determine overall performance, or finding
the average temperature of the past few days to get an idea about today’s temperature
– these all are routine tasks we do on a regular basis. So this is a good starting point to
use on our dataset for making predictions.
The predicted closing price for each day will be the average of a set of previously
observed values. Instead of using the simple average, we will be using the moving
average technique which uses the latest set of values for each prediction. In other
words, for each subsequent step, the predicted values are taken into consideration
while removing the oldest observed value from the set.
The linear regression model returns an equation that determines the relationship
between the independent variables and the dependent variable.
Here, x1, x2,….xn represent the independent variables while the coefficients θ 1,
θ2, …. θn represent the weights.
We will first sort the dataset in ascending order and then create a separate
dataset so that any new feature created does not affect the original data.
Apart from this, we can add our own set of features that we believe would be relevant
for the predictions. For instance, my hypothesis is that the first and last days of the
week could potentially affect the closing price of the stock far more than the other
31
days. So I have created a feature that identifies whether a given day is Monday/Friday
or Tuesday/Wednesday/Thursday.
We will now split the data into train and validation sets to check the performance of
the model.
Interference in Linear Regression: Linear regression is a simple technique and
quite easy to interpret, but there are a few obvious disadvantages. One problem in
using regression algorithms is that the model overfits to the date and month column.
Instead of taking into account the previous values from the point of prediction, the
model will consider the value from the same date a month ago, or the same
date/month a year ago. As seen from the plot above, for January 2016 and January
2017, there was a drop in the stock price. The model has predicted the same for
January 2018. A linear regression technique can perform well for problems such as
Big Mart sales where the independent features are useful for determining the target
value.
The RMSE value is almost similar to the linear regression model and
the plot shows the same pattern. Like linear regression, kNN also
identified a drop in January 2018 since that has been the pattern for
the past years. We can safely say that regression algorithms have not
performed well on this dataset.
32
ARIMA is a very popular statistical method for time series forecasting. ARIMA
models take into account the past values to predict the future values. There are three
important parameters in ARIMA:
Parameter tuning for ARIMA consumes a lot of time. So we will use auto ARIMA
which automatically selects the best combination of (p,q,d) that provides the least
error.
3.1.5 Prophet:
There are a number of time series techniques that can be implemented on the stock
prediction dataset, but most of these techniques require a lot of data preprocessing
before fitting the model. Prophet, designed and pioneered by Facebook, is a time
series forecasting library that requires no data preprocessing and is extremely simple
to implement. The input for Prophet is a dataframe with two columns: date and target
(ds and y).
Prophet tries to capture the seasonality in the past data and works well when the
dataset is large.
• Interferance in Prophet:
33
Prophet (like most time series forecasting techniques) tries to capture the trend
and seasonality from past data. This model usually performs well on time
series datasets, but fails to live up to it’s reputation in this case.
As it turns out, stock prices do not have a particular trend or seasonality. It highly
depends on what is currently going on in the market and thus the prices rise and fall.
Hence forecasting techniques like ARIMA, SARIMA and Prophet would not show
good results for this particular problem.
• The input gate: The input gate adds information to the cell state
• The forget gate: It removes the information that is no longer required by
the model
• The output gate: Output Gate at LSTM selects the information to be
shown as output
Let us implement LSTM as a black box and check it’s performance on our
particular data.
• Interferance in LSTM:
The LSTM model can be tuned for various parameters such as changing the
number of LSTM layers, adding dropout value or increasing the number of
epochs. But are the predictions from LSTM enough to identify whether the
stock price will increase or decrease? Time series forecasting is a very
intriguing field to work with, as I have realized during my time writing these
articles. There is a perception in the community that it’s a complex field, and
while there is a grain of truth in there, it’s not so difficult once you get the
hang of the basic techniques.
34
Result:
Figure 5 (a)
Discussion
Our proposed solution is a unique customization as compared to the previous works
because rather than just proposing yet another state-of-the-art LSTM model, we
proposed a fine-tuned and customized deep learning prediction system along with
utilization of comprehensive feature engineering and combined it with LSTM to
perform prediction. By researching into the observations from previous works, we fill
in the gaps between investors and researchers by proposing a feature extension
algorithm before recursive feature elimination and get a noticeable improvement in
the model performance.
35
Conclusions:
Stock market prediction is a very important aspect in the financial market. It is
important to predict the stock market successfully in order to achieve maximum
profit. This paper will focus on applying machine learning algorithms like Random
Forest, Support Vector Machine, KNN and Logistic Regression on datasets. We
evaluate the algorithms by finding performance metrics like accuracy, recall,
precision and f- score. Our objective is to identify the best possible algorithm for
predicting future stock market performances. The successful prediction of the stock
market will have a very positive impact on the stock market institutions and the
investors also.
Machine learning algorithms can process social media content such as tweets, posts,
and comments of people who generally have stakes in the stock market. This data is
then used to train an AI model so that it can forecast the stock prices in different
scenarios
When it comes to using machine learning in the stock market, there are multiple
approaches a trader can do to utilize ML models. From determining future risk
to predicting stock prices, machine learning can be used for virtually any kind of
financial modeling.
36
6 References:
Book Name: Machine Learning using Python (by Manaranjan Pradhan and U Dinesh
Kumar)
Websites:
By edureka! - https://www.youtube.com/watch?v=lncoLfue_Y4
By Simplilearn - https://www.youtube.com/watch?v=OXwZtlcTiuk
7 Annexure:
key=""
df = pdr.get_data_tiingo('AAPL', api_key='4207fee411005b9e5f163144e0df39ae4126029a')
df.to_csv('AAPL.csv')
import pandas as pd
37
df=pd.read_csv('AAPL.csv')
Above is the depiction of the dataset values before prediction. It shows the plotting of the all values
present in the dataset.
time_step = 100
# Here above, we will take the last 100 values from the shares to train our model.
X_train, y_train = create_dataset(train_data, time_step)
X_test, ytest = create_dataset(test_data, time_step)
print(X_train.shape), print(y_train.shape)
# following are the significant modules and libraries for prediction
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import LSTM
38
Above picture shows 100 bathces that are used to train the data model. The basis of these
entities, out trained model will predict the future values of the dataset.
In the above graph, our model has predicted the next values with its algothm and in below
picture, the precidted line is embedded to the actual graph.
39
40