Time series are a special type of data arrangement which show the evolution of certain phenomenon over the time; therefore, they are considered one-dimensional signals. Time series are commonly used to predict the value of a given stock in the market. An example of a time series showing the evolution of the stock price for apple can be seen in the figure below
Department of Electrical and Computer Engineering
University of Delaware
FSAN/ELEG815 Analytics I: Statistical Learning
Midterm #2, Spring 2023
Name:
1. Time series are a special type of data arrangement which show the evolution of certain phenomenon over the time; therefore, they are considered
one-dimensional signals. Time series are commonly used to predict the
value of a given stock in the market. An example of a time series showing
the evolution of the stock price for apple can be seen in the figure below:
One powerful method that can be implemented for prediction is using
one-dimensional convolutional Neural networks (CNN). A one-dimensional
CNN works the same as a two-dimensional CNN, only that here the filters
are vectors instead of matrices, while the pooling operator is also defined
for vectors.
Here you will have to design and implement your own 1D-CNN in order to
predict the value of the stock price for two different companies: GameStop
(Ticker: GME) and Last Vegas Sands (Ticker: LVS).
In this project, you are going to access the data using yfinance, which
offers a threaded and Pythonic way to download market data from YahooFinance. For that, do the following:
Install yfinance: pip install yfinance
Import yfinance: import yfinance as yf
Download historical data from the company:
variable = yf.Ticker(ticker).history(start=start data, end=end data,
interval=time,actions=False)
variable 2=list(variable[‘Open’])
For example, to download the daily data from Las Vegas Sands from
January first 2001 to December 31 2002:
1
– LVS = yf.Ticker(“LVS”).history(start=“2001-01-01”, end=“200212-31”, interval=‘1d’,actions=False)
For GameStop, you will analyze daily data from first of January 2011
to 31st of December 2021.
For the case of Las Vegas Sands, you will analyze the daily data from
first of January 2005 to 31st of December 2015.
The downloaded data from yfinance is a single vector. Given that your
intention is to use this data to predict the value of the stock in the market,
you have to assemble your dataset as seen in the figure. The length of xk
might vary, and yk is taken as the value right after xk ends. Notice that
yk is the oracle function.
Once you generate the data, you have to train a 1D-CNN for the stock
market prediction. For that, you have to:
Divide the data in training (70%) and testing (30%).
Introduce a first 1D-CNN, with number of filters, kernel size, and
activation function estimated by you.
Introduce a 1D Pool operator with pool size estimated by you.
Flatten your data after the pool operation.
Introduce a Dense layer with number of neurons and activation function estimated by you.
Introduce a Dense layer with a unique neuron (given that you have
to estimate a single value).
If needed, add other layers.
Evaluation
Download data correctly 20%
Create dataset correctly 20%
Figure of training data error 20%
Figure of testing data error 20%
Evaluation and discussion of the model over the testing data 20%
2