Stock Trend and Price Prediction using Deep Learning Model (Using a sequence Model "LSTM: Long Short Term Memory Network")
The dataset We are directly fetching from the yfinance API. We can fetch any stocks data using their specific STOCK TICKER NAME (eg Apple:AAPL', Netflix: NFLX)
This data set from the yfinance consists of the following columns.
Date:Open:High:Low:Close:Adj Close:Volume:
Target variable:
Our target is to predict the Closing Price of the stock and also to predict the trend of the stock.
-
Data Ingestion :
- In Data Ingestion phase the data is first fetch from
yfinanceand coverted into thepandas dataframe - Plotted Some basic
plotlyandmatplotlibcharts for theclosing price vs datealong with some different moving averages100 ma&200 ma - Then the
closing pricedata issplitinto training and testing andby following the time series principles.
- In Data Ingestion phase the data is first fetch from
-
Data Transformation :
- In this phase a the data is transformed using
MinMaxScaler.
- In this phase a the data is transformed using
-
Model Training :
LSTMS (A Sequential Model)is defined usingkerassequential model for training.- For the regularization
Dropoutis defined - After finishing the training, trained model is saved in
keras.h5format
-
Prediction of the Time series :
- Now model is utilized to predict the time series (sequential closing price of the stock)
-
Flask App creation :
- Streamlit app is created with User Interface to predict stock trend and closing price inside a Web Application.
Link : Model Training LSTM Notebook
Streamlit link : [https://stockpredlstm.streamlit.app/]
Feeding the Stock Ticker Name and choosing the Time Frame:
Chart:
Evaluation Metric R2_Score:



