0% found this document useful (0 votes)
56 views24 pages

GPU Companies Share Price Forecasting

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views24 pages

GPU Companies Share Price Forecasting

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Share price estimation of TOP 5 GPU

Companies
Project Hand-out, Faculty Development Program

SmartInternz
www.smartinternz.com
Share price estimation of TOP 5 GPU Companies

The objective of this project is to estimate the share prices of the top 5 GPU companies in the market using
historical data and current market trends. The aim is to develop a predictive model that can forecast the future
prices of these companies based on their historical performance and other relevant factors. The model should
take into consideration various economic indicators, industry trends, company financials, and other relevant
data to make accurate predictions. The analysis should be performed using statistical and machine learning/
Deep learning techniques and the results should be presented in a clear and concise manner. The final output
of the project will be a report outlining the predicted share prices of the top 5 GPU companies in the market,
along with an analysis of the factors that have contributed to their performance.

Technical Architecture:

www.smartinternz.com Page 1 of 22
Project Flow:
● User interacts with the UI to enter the input.
● Entered input is analysed by the model which is integrated.
● Once model analyses the input the prediction is showcased on the UI

To accomplish this, we have to complete all the activities listed below,

● Define Problem / Problem Understanding


0 Specify the business problem
○ Business requirements
○ Literature Survey
○ Social or Business Impact.
● Data Collection & Preparation
○ Collect the dataset
○ Data Preparation
● Exploratory Data Analysis
0 Descriptive statistical
○ Visual Analysis
● Model Building
0 Training the model in multiple algorithms
○ Testing the model
● Performance Testing & Hyperparameter Tuning
0 Testing model with multiple evaluation metrics
○ Comparing model accuracy before & after applying hyperparameter tuning
● Model Deployment
0 Save the best model
○ Integrate with Web Framework
● Project Demonstration & Documentation
0 Record explanation Video for project end to end solution
○ Project Documentation-Step by step project development procedure

www.smartinternz.com Page 2 of 22
Prior Knowledge:
To complete this project, you must require following software’s , concepts and packages

● Anaconda navigator:
o Refer to the link below to download anaconda navigator
o Link : https://www.youtube.com/watch?v=5mDYijMfSzs
● Python packages:
o open anaconda prompt as administrator
o Type “pip install prophet” (make sure you are working on python 64 bit)
o Type “pip install flask”.
● Deep Learning Concepts
o CNN: https://towardsdatascience.com/basics-of-the-classic-cnn-a3dce1225add
o ARIMA: https://www.investopedia.com/terms/a/autoregressive-integrated-moving-
average-
arima.asp#:~:text=An%20autoregressive%20integrated%20moving%20average%2C%
20or%20ARIMA%2C%20is%20a%20statistical,values%20based%20on%20past%20v
alues.
o LSTM: https://www.analyticsvidhya.com/blog/2021/03/introduction-to-long-short-term-
memory-lstm/
o SARIMA: https://machinelearningmastery.com/sarima-for-time-series-forecasting-in-
python/
o Facebook Prophet: https://www.geeksforgeeks.org/time-series-analysis-using-
facebook-prophet/
o Flask Basics : https://www.youtube.com/watch?v=lj4I_CvBnt0

Project Objectives:

By the end of this project you will:

● know fundamental concepts and techniques of Convolutional Neural Network.


● gain a broad understanding of image data.
● Knowhow to pre-process/clean the data using different data preprocessing techniques.
● know how to build a web application using Flask framework.

Project Structure:
Create the Project folder which contains files as shown below

● We are building a flask application which needs HTML pages stored in the templates folder
and a python script app.py for scripting.
● Static folder and assets folder contain the CSS and JavaScript files along with images.
● fbprophet.pkl, lstm.h5 and sarima.pkl are our saved models.
● Further we will use these models for flask integration.

www.smartinternz.com Page 3 of 22
Milestone 1: Define Problem / Problem Understanding
Activity 1: Specify the business problem
Refer Project Description

Activity 2: Business requirements

Here are some potential business requirements for Share price predictor:
a. Accurate forecasting: The predictor must be able to accurately forecast Share prices
for a given time period in the future. The accuracy of the forecasting is crucial for
investors, stock holders, and other stakeholders to make informed decisions on the
production and marketing of rice.

b. Real-time data acquisition: The predictor must be able to acquire real-time data on
stock information and other relevant factors that affect stock price prediction. The data
acquisition must be seamless and efficient to ensure that the predictor is always up-to-
date with the latest information.

c. User-friendly interface: The predictor must have a user-friendly interface that is easy to
navigate and understand. The interface should present the results of the predictor in a
clear and concise manner to enable farmers and other stakeholders to make informed
decisions.

d. Report generation: Generate a report outlining the predicted share prices of the top 5 GPU
companies in the market, along with an analysis of the factors that have contributed to their
performance. The report should be presented in a clear and concise manner, with appropriate
visualizations and insights to help stakeholders make informed decisions.

Activity 3: Literature Survey (Student Will Write)

A literature survey would involve researching and reviewing existing studies, articles, and
other publications on the topic of project. The survey would aim to gather information on
current systems, their strengths and weaknesses, and any gaps in knowledge that the
project could address. The literature survey would also look at the methods and
techniques used in previous projects, and any relevant data or findings that could inform
the design and implementation of the current project.

Activity 4: Social or Business Impact.

The Share Price Estimation of Top 5 GPU Companies project can have both social and business impacts.

Social Impact:

The accurate prediction of share prices can help individual investors, particularly those who may not have
extensive financial knowledge, make informed investment decisions, thereby enabling them to achieve their
financial goals and potentially increase their wealth.

The project can also contribute to overall market stability by providing more accurate information to investors,
helping them make informed decisions, and reducing market volatility and uncertainty.

www.smartinternz.com Page 4 of 22
Business Impact:

The project can be particularly useful for financial institutions, such as investment banks and hedge funds,
who make investment decisions on behalf of their clients. Accurate prediction of share prices can help these
institutions improve their investment strategies and potentially increase their returns.

Accurate share price predictions can also be useful for companies operating in the GPU industry, enabling
them to anticipate changes in the market and adjust their strategies accordingly. This can help companies
remain competitive and achieve their business goals.

Overall, the project can have a positive impact on the financial industry by improving the accuracy of share
price predictions and increasing market efficiency.

Milestone 2: Data Collection & Preparation


DL depends heavily on data. It is the most crucial aspect that makes algorithm training possible. So, this
section allows you to download the required dataset.

Activity 1: Collect the dataset.


There are many popular open sources for collecting the data. Eg: kaggle.com, UCI repository,
etc.

In this project we have used .csv data. This data is downloaded from kaggle.com. Please
refer to the link given below to download the dataset.

Link: https://www.kaggle.com/datasets/kapturovalexander/nvidia-amd-intel-asus-msi-share-
prices

As the dataset is downloaded. Let us read and understand the data properly with the help
of some visualisation techniques and some analysing techniques.

Note: There are a number of techniques for understanding the data. But here we have
used some of it. In an additional way, you can use multiple techniques.

Activity 1.1: Importing the libraries


Import the necessary libraries as shown in the image.

www.smartinternz.com Page 5 of 22
Activity 1.2: Read the Dataset
Our dataset format might be in .csv, excel files, .txt, .json, etc. We can read the dataset
with the help of pandas.

In pandas we have a function called read_csv() to read the dataset. As a parameter we


have to give the directory of the csv file.

We can print the first 5 rows of the datasets using the .head() method as shown in
below screenshots.

www.smartinternz.com Page 6 of 22
Activity 2: Data Preparation
As we have understood how the data is, let's pre-process the collected data.

The download data set is not suitable for training the machine learning model as it might
have so much randomness so we need to clean the dataset properly in order to fetch good
results. This activity includes the following steps.

● Checking for missing values


● Data manipulation
● Resampling the data
● Merging and splitting data into test and train variables

Note: These are the general steps of pre-processing the data before using it for
training models. Depending on the condition of your dataset, you may or may not
have to go through all these steps.

Activity 2.1: Checking for missing values


● For checking the null values, df.isnull() function is used. To sum those null values
we use .sum() function. From the below image we found that there are no null
values present in our dataset. So we can skip handling the missing values step.

www.smartinternz.com Page 7 of 22
Activity 2.2: Data manipulation
Since we found null values in the dataset related to ASUS company we are going to drop the
null values but we can also fill those null values using mean/median/mode of the respective
volumns.

To convert the date strings to time stamps we are going to perform below steps.
First let’s check the type of data of the column “Year” using the type() function.

We will convert the data of “Year” column using the pandas “to_datetime” function. We can
change the ‘Date’ columns of all the datasets using a for loop to reduce Lines of code..

Activity 2.3: Resampling the Data


Now we are going to add new columns to all the loaded datasets so that when we merge our
data it will be easier to find which rows of data belong to which company and also so that our
model will be able to differentiate the rows of data based on the value of the new column

www.smartinternz.com Page 8 of 22
named “Company”. The new column “Company” will be a categorical value ranging from 0 to
4 where each number denotes a company as shown below. We are going to process the
datasets as mentioned above using a for loop.
We will also three new columns of data namely “Year”, “Day” and “Month” which are derived
from the “Date” column. We will use these three columns for training not the “Date” columns
but we use the “Date” column for analysis in later stages.

Activity 2.3: Merging and splitting data into test and train
variables
Now we are going to merge our datasets, simultaneously we are also going to split the data
to test and train variables using the below piece of code with a train to test ratio of 80 to 20.

First we are going to take 2 lists of train and test in which we are going to append train and
test splits of every dataset into these 2 lists. In the output each line represents the data of
companies in order as stored in the data_list in below code.

Next we are going to merge the data of each variable of train_data and test_data using the
pandas.concat() function as shown below.

Finally we are going to split the train_data and test_data variables into x_train, y_train, x_test
and y_test using the below piece of code.

www.smartinternz.com Page 9 of 22
Milestone 3: Exploratory Data Analysis

Activity 1: Descriptive statistical


Descriptive analysis is to study the basic features of data with the statistical process. Here
pandas has a worthy function called describe. With this describe function we can
understand the unique, top and frequent values of categorical features. And we can find
mean, std, min, max and percentile values of continuous features.

www.smartinternz.com Page 10 of 22
www.smartinternz.com Page 11 of 22
Activity 2: Visual analysis
Visual analysis is the process of using visual representations, such as charts, plots, and
graphs, to explore and understand data. It is a way to quickly identify patterns, trends, and
outliers in the data, which can help to gain insights and make informed decisions.

www.smartinternz.com Page 12 of 22
Activity 2.1: Univariate analysis
In simple words, univariate analysis is understanding the data with single feature. Here we
don’t have much need to perform univariate analysis to understand the data as most of the
columns provided are continuous.

www.smartinternz.com Page 13 of 22
Activity 2.2: Bivariate analysis
To find the relation between two features we use bivariate analysis.

In the line plots visualised below following observations can be observed:


● There is sudden increase in the prices of stocks of AMD in the recent years and
the price of the stock didn’t retain for a long period but it soon fell to a lower price.
● The volume of the stocks being traded have increased tremendously in the recent
years.

Similar to this, analysis on other companies can be done.

Milestone 4: Model Building


Now our data is cleaned and it’s time to build the model. We can train our data on different
algorithms. For this project we are applying seven classification algorithms. The best
model is saved based on its performance.

www.smartinternz.com Page 14 of 25
Activity 1: Linear Regression model
Activity 1.1: Train the model
First we are going to initialise the LinearRegression() model and training data is passed to the model
with.fit() function. Test data is forecasted/predicted with predict() function and saved in a new
variable. For evaluating the model, train score, test score, r2_score and MAE scores are used.

Activity 2: Decision Tree Regressor


Activity 2.1: Train the model
First we are going to initialise the DecisionTreeRegressor () model and training data is passed to the
model with.fit() function. Test data is forecasted/predicted with predict() function and saved in a new

www.smartinternz.com Page 15 of 25
variable. For evaluating the model, train score, test score, r2_score and MAE scores are used.

Activity 3: Extra Trees Regressor


Activity 3.1: Train the model
First we are going to initialise the ExtraTreeRegressor () model and training data is passed to the model
with.fit() function. Test data is forecasted/predicted with predict() function and saved in a new variable. For
evaluating the model, train score, test score, r2_score and MAE scores are used.

Activity 3: Random Forest Regressor


Activity 3.1: Train the model
First we are going to initialise the RandomForestRegressor () model and training data is passed to the
model with.fit() function. Test data is forecasted/predicted with predict() function and saved in a new

www.smartinternz.com Page 16 of 25
variable. For evaluating the model, train score, test score, r2_score and MAE scores are used.

Activity 4: Model comparison and evaluating best model


From the observed r2 scores and Mena absolute errors we can clearly see that the linear
regression model has least Mean absolute error among others. So we are going to select Linear
Regression model for final Flask application deployment.

To plot the predictions over the original values of all the companies we can use the following code.

First, we are going to store the dates, original closing prices of stocks and predicted closing prices of
stocks as shown below. We are going to access company specific rows of test_data and x_test
variables using the “Company” column.

Now using these columns we are going to plot the data as shown below.

www.smartinternz.com Page 17 of 25
As we can see the lines plotted by the predicted and original data are almost perfectly overlapping.

You can save the model as pickle files using the following piece of code.

Activity 2: Integrate with Web Framework

www.smartinternz.com Page 18 of 25
In this section, we will be building a web application that is integrated to the model we built.
An UI is provided for the uses where he has to enter the values for predictions. The enter
values are given to the saved model and prediction is showcased on the UI.

This section has the following tasks

● Building HTML Pages


● Building server-side script
● Run the web application

Activity 2.1: Building Html Pages:


For this project create two HTML files namely

• index.html
• inner-page.html
• portfolio-details.html
and save them in the templates folder.

It is not necessary to follow the exact format as above so feel free to use whatever
templates or format you like. Be creative!

Activity 2.2: Build Python code:


Import the libraries

Load the saved model. Importing the flask module in the project is mandatory. An object of
Flask class is our WSGI application. Flask constructor takes the name of the current
module (__name__) as argument.

Render HTML page:

Here we will be using a declared constructor to route to the HTML page which we have
created earlier.

In the above example, ‘/’ URL is bound with the index.html function. Hence, when the
home page of the web server is opened in the browser, the html page will be rendered.
Whenever you enter the values from the html page the values can be retrieved using
POST Method.

Retrieves the value from UI:

www.smartinternz.com Page 19 of 25
Here we are routing our app to predict() function. This function retrieves all the values from
the HTML page using Post request. That is stored in an array. This array is passed to the
model.predict() function. This function returns the prediction. And this prediction value will
be rendered to the text that we have mentioned in the submit.html page earlier.

Activity 2.3: Run the web application


● Open anaconda prompt from the start menu
● Navigate to the folder where your python script is.

● Now type “python app.py” command


● Navigate to the localhost where you can view your web page.
● Click on the predict button from the top left corner, enter the inputs, click on
the submit button, and see the result/prediction on the web.

www.smartinternz.com Page 20 of 25
Now, Go to the web browser and write the localhost URL ( http://127.0.0.1:5000 ) to get
the below result

www.smartinternz.com Page 21 of 25
Upon entering the data in input fields and clicking on submit and predict we’ll get the prediction as shown
below.

www.smartinternz.com Page 22 of 25
Milestone 7: Project Demonstration & Documentation

Below mentioned deliverables to be submitted along with other deliverables.

Activity 1: - Record explanation Video for project end to end solution.

Activity 2: - Project Documentation-Step by step project development


procedure.

Create document as per the template provided.

www.smartinternz.com Page 23 of 25

You might also like