0
$\begingroup$

I am halfway through "Advances in Financial Machine Learning" by Marcos Lopez de Prado. I understand that a time series like stock prices can be transformed to make it sufficiently stationary. Pretend a stock series has 100 data points for T=1 to T=100 (one data point per time). I also understand (hopefully) that you can label this data by the three barrier method every so often in the time series. For example, label a training point every 2 units of time where the vertical barrier is 10 units of time out from the start point. So you would have labeled training examples for T=1, 3, 5, ... I understand that there is overlap in the training data and it is not IID and thus, you must use a method such as average uniqueness to counteract this act.

Okay. Given that, I still have no idea how this labeled training data can be used as input features in a machine learning model.

Like, each data point is just a number. I get that there's some concept of this number holding some concept of "memory" since the series isn't completely differentiated, but how is this even treated in the model?

For example, let's pretend I'm gonna train a random forest to predict a stock's performance in the future. I collected training data as described above (so I want to know the stock's performance up to 10 time units in the future). Now I come up with features for my model like let's say the temperature outside, yesterday's NASDAQ price, etc. Those are nice easy features. Now I have this huge time series that I want to use as a feature (or multiple features). There are so many complications. Firstly, it's ordered, if there's any alpha to be collected the order definitely is the thing that will lead you to the alpha. Secondly, there's no one-to-one correspondence between a new testing example's price and a price in the training data. For example, if I wanted to use the NASDAQ price feature on a new testing example I would simply look at yesterday's NASDAQ price (there's a one-to-one correspondence). If I wanted to use yesterday's stock price to predict today's I wouldn't know which "yesterday" to use because any of the data point in the time series could he considered "yesterday".

What am I missing here?

$\endgroup$
0
$\begingroup$

With ML, you're looking to identify patterns in your inputs that result in your output(s). Thus you collect all the outputs you are hoping to be able to identify later, and the inputs which correspond to those outputs (i.e just before the output was generated), collect as many as possible of these relationships, stick them into a ML model and hope you've found an edge.

If you want to predict tomorrows stock price using inputs from today, you'd better hope you've collected enough examples of inputs which look like todays in your dataset to to help the ML predict tomorrow.

$\endgroup$
  • $\begingroup$ So is every single historic stock price collected just an example of one input feature where order doesn't matter? For example, if the stock time series (in stationary terms) was [12, 10, 9, 14, 13] for T=1,...,5 and the labels for this = [1, 1, 0, 0, 1] and let's say we have one more feature the NASDAQ price which is 1000 at T=1,...,3 and 900 at T=4,5. Would the X we use for this just be [[12, 1000], [10, 1000], [9, 1000], [14, 900], [13, 900]] for labels [1, 1, 0, 0, 1]? That's it? So the time of the training example doesn't matter after you make the series stationary? $\endgroup$ – Aloysius Jun 11 at 18:43
  • $\begingroup$ @Aloysius That's it. You're giving the ML three examples of output label 1, and two examples of output label 0 in terms of the inputs. It will then try and find a pattern connecting the inputs to the outputs in the examples you've given it. If you want to incorporate ordering into the model, you'd introduce lags of the input features as features themselves. $\endgroup$ – wildbunny Jun 11 at 20:35
  • $\begingroup$ Great thanks! I think I've mostly got you except for the last sentence you wrote. By "lags of the input features", I assume you mean adding a new "one unit of time ago" feature which represents the stock price one unit of time ago. So X might be [[12, 10, 1000], [10, 9, 1000], [9, 14, 900], [14, 13, 900]] or something instead. I can get that, but what I'm confused about is that the formula for fractionally differentiating a time series is already a function of decayingly-weighted lags of the time series. $\endgroup$ – Aloysius Jun 11 at 20:53
  • $\begingroup$ Like this formula includes many backspace operations: en.wikipedia.org/wiki/… . $\endgroup$ – Aloysius Jun 11 at 20:54
  • $\begingroup$ I understand compressing a bunch of past values into a single number can remove memory, but why are we doing 2 things that are a function of lagged input features (the two things being adding them as features and using them to differentiate the series)? $\endgroup$ – Aloysius Jun 11 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.