HW9 2.2 Missing Values

For question 2.2, are we supposed to create a matrix where each row represents a day and for each column we have a vector of length ~2525. However, not every stock have full 5 years’ history so we cannot get a vector of length 2525 for each day. Then, how do we deal with this part of missing values? Thanks!

You can fill with any number as your model work. For example, filling with the same value as the open price at the very first day.

To clarify, we should have an array of vectors with each vector corresponding to a specific date. Each vector is made up of the S&P 500 security prices for that day?

You are correct!
Think of these pricing vectors at each time step as the word vectors you trained in the last homework. Frameworks are similar!

1 Like

Thanks for your clarification! I guess my question was if we concatenate the prices of all stocks for each date, the lengths of such vectors would not be consistent. For example, for earlier dates, we only have ~470 records but for more recent dates we have records for all 505 stocks. For the stocks that don’t have the data in earlier days, we may have to “guess” their prices for two years. Even though this guarantee the dimensionality consistency, would it introduce more uncertainty to the model? Thank you.

Great question! Think of how do we update the weights at each time step? The model may learn to predict constant at the start (with fake value), while as long there are difference later in the real price, the model can adjust with RNN neurons.

1 Like