Deep Learning and Stock Time Series Data
<p>Time series data is extremely prevalent in modern data science practice. One of the most visible examples of this is stock data, a time series that drives a great deal of modern economic life. In this post, we’re going to attempt to train a univariate deep learning model on time series and see if it's possible to predict daily closing prices over five-day windows.</p>
<p>First, let's break this problem into parts:</p>
<ol>
<li>Extract and transform our dataset. We will use the Yahoo finance API to pull get our raw data. From there we’ll need to reshape our data into a NumPy array with shape [(len(data) / timestep, timestep, #features](we’ll see why this is necessary when we start building our models).</li>
<li>We’ll need to turn our time-series problem into a supervised learning problem. In order to do this we’ll create a NumPy array of training features and training labels. However, since our data is just raw closing prices, the training features will be prices at time i, and the training labels will be prices at time i+1.</li>
<li>We’ll create functions to make predictions.</li>
<li>Next, we will create evaluation metrics. For this problem, I prefer to use Mean Absolute Percent Error (MAPE) to evaluate our predictions.</li>
<li>We’ll create a function to visualize our results. For this, we’ll simply plot our base truth (actual closing prices) vs. our predictions.</li>
<li>And finally, we’ll build, compile, and evaluate several model architectures to determine which is best.</li>
</ol>
<p>Now that we have a roadmap, let’s get building!</p>
<p><a href="https://medium.com/@mskmay66/deep-learning-and-stock-time-series-data-ff6a75cfddd9">Website</a></p>