0
$\begingroup$

Q1. How to create an 'overlap' when we predict a stock price tomorrow based on information today?

  • According to the book 'Advances in Financial Machine Learning' written by Marcos Lopez de Prado, the concept 'purging' is introduced to reduce the information leakage from the training dataset to train dataset.

One way to reduce leakage is to purge from the training set all observations whose labels overlapped in time with those labels included in the testing set. I call this process “purging.”

  • If my trading model is predicting stock price tomorrow using any information today, how can I perform "purging"?

  • To be more precise, I will give you an example. Let's say I use 3 companies' daily returns, GOOG, AAPL and MSFT to predict NASDAQ's daily return tomorrow. The input for my model is daily returns of 3 stocks, and the output is 1 daily return of NASDAQ tomorrow.

  • How can I create an 'overlap' between today and tomorrow?

Q2. Can 'train dataset' appear after the 'test dataset'?

  • In the figure 7.2 presented below, a train dataset is from the time period after the test dataset.

  • It seems bizarre to me because usually in finance, we predict future based on past information. We don't predict or forecast the past based on the future data.

  • As such, it is against my intuition to have a train dataset after the test dataset in terms of time period.

enter image description here

$\endgroup$
1
$\begingroup$

I have a video that goes into detail on this.

Q1: Lets say your label is sign(5-day future return). If you look at 2 back-to-back days in a historical sample, the first day's label (t -> t+4) will contain 4 future days' returns (t+1 -> t+4) that are also included in the next days label (t+1 -> t+5). You want to eliminate this overlap when creating the training and testing sets to avoid inflated results during that period from serial correlation in the features when predicting a similar label.

Q2: Combinatorial purged cross-validation (CPCV) is used to generate more historical performance simulations than traditionally available from walk-forward evaluation. The purpose of purging and embargoing is to reduce the impact/leakage from having training periods after testing periods.

$\endgroup$
5
  • $\begingroup$ Can you clarify your terms, please? 1) "Label" means output in ML community. (Source: stackoverflow.com/questions/40898019/…). What does the sentence mean, "Let's say your label is sign (5-day future retern)"? Does it mean the sign of the price difference between today and the 5 days from now? So lets say I trade Bitcoin and today is Monday. The BTC price today: 100, Tuesday: 110, Wednesday: 150, Thursday: 80, Friday: 120, Saturday: 110. 5 days from Monday is Saturday. So your 5 day future return for Monday is (110-100)/100 = +0.1 $\endgroup$ – Eiffelbear Feb 11 at 10:08
  • $\begingroup$ So it is +10%. So is your example saying that we use this "plus sign" for the outcome (label) and for any input from Monday? $\endgroup$ – Eiffelbear Feb 11 at 10:10
  • $\begingroup$ 2) As said in the comment above, label means an "output", while the Marcos' book concerns mostly about the serially correlates input. I am curious to know why you are focusing on the output ("label") rather than the input $\endgroup$ – Eiffelbear Feb 11 at 10:16
  • $\begingroup$ 3) The figure is from the chapter 7.4 "A solution: Purged K-fold CV", which focuses on hyperparameter tuning. This part does not discuss anything about backtesting and does not generate simulations at all. CPCV is introduced later in the book, in the chapter 12. Does it still hold a point to say that "purged K-fold CV" is also used to generate historical performance simulation? $\endgroup$ – Eiffelbear Feb 11 at 10:23
  • $\begingroup$ I already like your answer, but I would appreciate it more if the answer comes with examples to show your points. Lastly, it is my honor to have your answer, Quantoisseur. I have enjoyed your video on youtube and your clear explanation. $\endgroup$ – Eiffelbear Feb 11 at 10:24

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.