A model forecasts the three-day return of an equity index from daily data, and the question is how accurate its forecasts would have been in the past. A random split of the rows into training and validation sets is quick, but a training row dated before a forecast can carry a return that finishes after it, and neighboring three-day returns share two of their three daily returns. This lesson states exactly which rows a historical forecast could have trained on, which rows share outcomes with the validation rows and must be purged, what an embargo adds, and how nested validation keeps the choice of tuning parameters apart from the score that judges it.
Key terms
Chronological split
Definition Time is counted in integer observation intervals, and increment is the change observed at time , for example the log return from time to time . A label with horizon that starts at time is a function of the increments in its information interval
for example the -period log return , and the features of the row use only information available at time . The label is complete at time . Take the convention that a decision at time is made after increment has been observed. A chronological split at decision time trains only on rows whose labels are complete at and evaluates only forecasts made at or later,
Starts with belong to neither set at that decision, because their features are known but their labels are not. If the decision is made before increment is observed, the training condition becomes . A random split assigns rows to training and validation without regard to these times, so in general it trains on outcomes that were not known when the validation forecasts were made.
In plain words The date of a row is when its forecast would have been made, not when its outcome became known. A row can train a model at a decision only if its whole outcome had already arrived.
Example Take and a decision at . The starts to have labels complete by time , since , so they are the training rows. Start is dated before the decision, but its label uses increments , and , and the last two have not happened at time . For a one-period label, , at the same decision the training starts are to , so changing the horizon changes the training sample.
Walk-forward validation
Definition Walk-forward validation repeats the chronological split at increasing decision times . At decision the model, together with every preprocessing step that learns from data, is fitted on rows with , either all of them (an expanding window) or only the latest of them (a rolling window). The fitted predictor then forecasts the starts of the block , where marks the end of the sample, and each forecast is scored with a loss once its label is complete. With forecasts in all, the walk-forward score is
Every forecast uses only information available when it is made, because its training labels end by and its features are known at . The score is therefore the historical loss of the procedure run the way it would have been run. It estimates future loss only under further assumptions on the stability and dependence of the losses, which the chronological order does not supply.
In plain words Stand at each historical decision date in turn, fit with what was known then, forecast the next block, and move forward. A row trains a forecast only if its outcome was already known when that forecast was made.
Example In a constructed timeline with and validation starts , and , refitting at every start gives the training starts to at decision , to at decision and to at decision . A single fit at decision , used for all three forecasts, trains on the starts to only. No start after the validation block ever trains one of these forecasts, however far its label lies from the validation labels.
Overlapping labels
Definition Two labels overlap when their information intervals share an increment, . For two labels with the same horizon this happens exactly when , and they then share increments. Suppose in addition that each label is the sum of its increments and that the increments are uncorrelated with a common variance . Then
so the correlation of the two labels is . For the mean of the consecutive labels starting at ,
and tends to as grows, because the weights over the lags add up to . The formula for independent observations therefore understates this variance by a factor that approaches .
In plain words Neighboring three-day returns are built mostly from the same days. Putting one of them in training and its neighbor in validation does not give two separate pieces of evidence, and treating overlapping rows as independent observations overstates how much the data say.
Example With , the labels starting at and use the increments , , and , , , so they share and , and with uncorrelated increments of equal variance their correlation is . The labels starting at and share no increment. For consecutive three-period labels with , the exact variance of the mean is , about times the value that the independence formula gives.
Purging
Definition Let be the set of validation starts and
the union of their information intervals. Purging removes from the training candidates every start whose interval meets , so that every retained training label satisfies . For a contiguous validation block and a common horizon , the union is , and a start outside the block is retained exactly when or . This removes the starts before the block and the starts after it, whenever they exist. In continuous event time the same test compares intervals such as , and the endpoint convention must be stated, since an observation exactly on a boundary may or may not be shared. Purging removes only the specified overlap of label intervals. It does not make the retained rows independent of the validation rows, which can still depend on them through persistent volatility, slowly moving features or a common market regime.
In plain words Shade every increment that some validation label uses, then drop every training label that touches a shaded increment. The test is a set intersection, not a rule of thumb about how many rows to skip.
Example In a constructed timeline with candidate starts to , horizon and validation starts , and , the validation intervals , and give , each increment counted once. Start uses , , and meets at , and start meets it at and . Start uses , , and start uses , , . Purging removes , , and , and the label-disjoint training starts are to and to . Label-disjoint is not the same as available. The starts to pass the overlap test, yet none of their labels is complete at time . With the decision at the first validation start, , the walk-forward condition is exactly the left half of the purging rule.
Embargo
Definition An embargo is an additional exclusion of training starts in a stated window after a validation block, applied on top of purging. Its width follows from the design, for example from the feature windows, and no single width removes all dependence. Suppose the features of start use the most recent increments . Among the starts after the block that survive purging, those with , the feature window meets exactly when . Excluding them removes the starts , whose inputs were built partly from the validation outcomes. An embargo matters only in blocked designs that train on rows after the validation block. Walk-forward validation never does.
In plain words Purging handles shared outcomes. An embargo handles a second channel, later rows whose inputs were computed from the validation period. It is a rule you choose and justify from your own windows, not a fixed number of days.
Example Continue the constructed timeline with features built from the three most recent increments, . Start uses , , , start uses , , and start uses , , , so all three meet , while start uses , , . The embargo removes , and , and the blocked design keeps the starts , , , , and . That set belongs to this blocked design with this embargo. It still contains the starts and , which cannot train a forecast made at time .
Nested validation
Definition Nested chronological validation uses two layers of splits. Outer fold has an outer training window , whose labels are complete at the outer decision , and a later outer block . Each candidate tuning parameter , for example a ridge penalty, is scored by chronological, purged inner splits that use only rows of , and the inner winner is
The procedure is refitted on with and scored once on , and the outer estimate is
Every step that learns from data, including imputation, normalization, feature selection and probability calibration, is fitted inside the same windows. The outer estimate scores the whole procedure, tuning included, rather than one fixed model. The minimized inner score is not an assessment of the selected model, because it took part in the choice. Equal fold weights and weights proportional to the number of predictions in each block give different averages when the blocks differ in size, so a report states which expected loss it estimates. If several procedures are then compared by their outer scores and the best is kept, those scores have become selection information as well, and assessing the kept procedure takes a later block that played no part in any choice.
In plain words Use the past to choose and the future to judge. A score that helped make a choice can no longer judge that choice, whatever the dataset holding it is called.
Example Take constructed monthly labels with . Outer fold has equal to the starts to , complete at , and equal to the starts to . Inside , each penalty is fitted on the starts to and scored on to , then fitted on to and scored on to . The penalty with the lower average inner score is refitted on to and scored once on to . Outer fold repeats this with equal to to and equal to to . The months to never influence the choice that fold makes.
Check yourself
- Labels have horizon , the candidate starts are to and the validation starts are , and . Find the validation union , the purged starts and the label-disjoint training starts.
Show the answer
The validation intervals are , and , so . A start outside the block is label-disjoint exactly when or , that is, or . The purged starts are , , and , , , three on each side since . For instance, start uses to and meets at , and , while start uses to and misses it. The label-disjoint training starts are to and to .
- In the setting of the first question, the first validation forecast is made at time . A colleague trains it on all label-disjoint starts. Which starts are admissible, and how does the answer change if the forecast must be issued before increment is observed, or if the horizon is instead?
Show the answer
Under the convention that the decision at time follows increment , a training label must satisfy , so the admissible starts are to . The starts to are label-disjoint but their labels end at times to , long after the forecast, so the colleague’s sample uses outcomes that did not exist yet. If the forecast is issued before increment is observed, the condition becomes and only the starts to remain. With and the original convention, the condition admits the starts to .
- Three outer blocks of a nested walk-forward design hold , and predictions with average squared losses , and , in constructed units. Compute the equal-fold average and the prediction-weighted average. The analyst then tries ten penalty grids, keeps the grid with the best outer score and reports that score as its expected loss. What is wrong with the report?
Show the answer
The equal-fold average is
The prediction-weighted average divides the total loss by the predictions, which gives . The two differ because the third block is larger and has higher losses. The first weights each fold equally, the second each prediction, and the report should say which one it estimates. Once ten grids are compared by their outer scores and the best is kept, the outer blocks have taken part in a selection, so the winning score is no longer an untouched assessment and tends to be optimistic. An honest assessment of the kept grid needs a later block that informed no choice. A standard error for either average also needs a model of the dependence between losses, since adjacent forecasts with overlapping labels are not independent.