I keep going back to Jason Brownlee’s book (ebook) Deep Learning Time Series Forecasting that I mentioned finding in my collection some time back. He covers pretty much the same content as the Deep Learning for Time Series Cookbook, but I just prefer his style. He does use Tensorflow instead of Pytorch, but I’ve decided to handle that by simply trying to write his code using Pytorch. I don’t think the conversion should be too difficult. I’m just going to confuse myself (and my computer) if I try to use two ML frameworks. I’ve already run into problems with TF after installing the GPU version of PyTorch, something about something can’t be registered because something else already is.
Anyway, Jason has an eight step process before starting any ML project, so I’ll have a go at that here.
- Inputs vs Outputs
- Endogenous vs Exogenous
- Regression vs Classification
- Structured vs Unstructured
- Univariate vs Multivariate
- Single-step vs Multi-step
- Static vs Dynamic
- Contiguous vs Discontiguous
1. Inputs vs. Outputs
Output is some measure of price change for the following day, either price or something related to it such as return or log return or some other derivative of price, or rather, price change from the ‘current’ day. The inputs here will be some number of previous prices/returns/log returns from historical data. Some testing will probably be required to find an appropriate number of previous values.
2. Endogenous vs. Exogenous
Previous days prices are endogenous. An exogenous input could be something like the Fear and Greed Index, which is not directly related to BTC price data. At the outset I don”t intend to use exogenous data, although I may include that after preliminary investigations.
3. Regression vs. Classification
I’ve thought about making this a classification problem, such as whether the outcome is ‘good’ or ‘bad’ by some criterion, such as achieving a return of at least 2% over the next five days, but for starters I’ll just stick to a regression problem as it’s a bit less complicated and this is a learning exercise. Keep it Simple, Stupid (aka the KISS principle).
4. Unstructured vs. Structured
This refers to any obvious patterns, such as seasonality. With BTC there is a four year boom and bust cycle on top of a general uptrend, but these occur over a relatively long timeframe and you don’t really see it in, say, a year’s worth of data. Besides, if I work with returns instead of raw prices there is no such trend, although there may be seasonality (generally positive returns then generally negative returns over four years).
5. Univariate vs. Multivariate
For my initial experiment I’ll be using only the daily close prices (or returns calculated from those), so univariate. Further down the track I will probably include additional input variables. I wonder if using lags of the close price is considered a multivariate input?
6. Single-step vs. Multi-step
I’ll just be looking to predict the following day’s price, so single-step. I wonder if turning this into a classification problem that uses some aggregate of multiple following days to determine the class, such as I mentioned in point 3 above, would make this a multi-step problem.
7. Static vs. Dynamic
If I was actually using a model produced in this exercise in some useful way I would anticipate updating the data and the model on a regular basis, hence a dynamic problem. While I’m exploring, however, I’ll stick with the data I have so fair comparisons can be made between various models.
8. Contiguous vs. Discontiguous
Crypto data is very contiguous. Exchanges trade 24/7. More so than equities exchanges which trade only a few hours per day, and not on weekends or public holidays. No more annualizing statistics by multiplying by square root of 252, because that’s ‘the number of trading days in a year’. Root 365.25 is the new norm.
How helpful has this exercise been? For this initial project, not very, but I’m going with all the vanilla options. It will probably be more useful when things get more complicated.
ETA: I’ve just found an article on Jason’s website about using an LSTM with PyTorch for time series prediction. Mirabile Dictu!