Log inStart free
LESSON 4.47 · 5 STAGES · 2 CONTROLS · 2 CHECKSPRO · PREVIEW

Time-series splits and temporal leakage

Watch a random split let a model read the future, then fix it.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.47 · SPLIT BAY36 DAYS · 44.7 TO 85.0 UNITS
01
Stage 1 of 5 · The series
Each dot is the sales of one day, days 1 to 36. Sales rise about 1.2 units a day.
Explain it simply

Each dot shows how much a shop sold on one day. Day 1 is on the left and day 36 is on the right. Sales climb about 1.2 units a day, with a small weekly wave. Each day follows the days before it, so the order of the days matters.

A line of 36 teal dots rises from 44.7 units on day 1 to 85.0 units on day 36.

sales per daysplit cutpredictionerror, read ahead
15101520253035day50607080unitsdaily salesy₁ = 44.7 … y₃₆ = 85.0 units15101520253035day50607080unitsdaily salesy₁ = 44.7 … y₃₆ = 85.0 units
Toy: 36 days of sales · 2-nearest-day model · seeded
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
yt=40+1.2 t+2.5sin⁡(2πt/7)+εt\sy{y}{data}{y_t} = 40 + 1.2\,t + 2.5\sin(2\pi t / 7) + \varepsilon_t
y1=44.7,  y36=85.0y_{1} = 44.7,\; y_{36} = 85.0

Each day's sales are a trend, a weekly wave and noise.

Common mix-ups

MYTHA random split tests a time series fairly.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01If 3 days sit between the training days and the test days, does the MAE go up or down?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.