MathFin
Map / Statistics / MathFin.Choice.Performance.PurgedCV

Purged train/test interval disjointness

MathFin.Choice.Performance.PurgedCVMSC 60J65MSC 62M10JEL C58 source

López de Prado (Advances in Financial Machine Learning, ch. 7) purges a training interval [t0 i, t1 i] from a cross-validation fold whenever it overlaps a test interval [t0' j, t1' j]: it starts inside the test interval, ends inside it, or envelops it. This file states that three-way overlap predicate literally as given (for times in any linear order) and proves the combinatorial payoff: any training interval surviving purging against every test interval is genuinely disjoint from each of them, and in fact ends strictly before it starts or starts strictly after it ends.

Why purging works. When each label is a measurable function of the increments of a pre-Brownian motion over its own nonempty span (IsSpanLabel), a surviving training label and any test label sit on separated spans, so the weak Markov property of Brownian motion (IsPreBrownianReal.indepFun_shift: the increments after a time are independent of the path before it) makes them independent (indepFun_of_purged): no single test label carries information about a surviving training label. The statement is pairwise; joint independence of the whole test fold from the whole surviving training set is not proved. On the sample-weight side, a surviving label's uniqueness (Choice/Performance/LabelUniqueness.lean) is the same whether computed on the training sample alone or on the pooled sample (uniqueness_pooled_eq_of_purged).

Main definitions

  • overlapsTest: the purge trigger, training interval i starts inside, ends inside, or envelops test interval j.
  • IsSpanLabel: a label determined by the increments of X over a span [a, b].

Main results

  • overlapsTest_of_mem_of_mem: if some point lies in both a training and a test interval, the overlap predicate holds between them (the interval-arithmetic heart of the result).
  • purged_disjoint: a training interval i purging leaves untouched (no test interval triggers the overlap predicate against it) is disjoint from every test interval.
  • lt_or_lt_of_not_overlapsTest: for nonempty spans, surviving purging means the two spans are strictly separated.
  • IsSpanLabel.indepFun_of_le, indepFun_of_purged: labels determined by the increments of a pre-Brownian motion over separated spans are independent; after purging, every test label is independent of every surviving training label.
  • uniqueness_pooled_eq_of_purged: purging keeps test labels out of a surviving training label's uniqueness.

References

Tags

purged cross-validation, overlapping labels, information leakage, weak Markov property, López de Prado, time series validation, MSC 60J65, MSC 62M10, JEL C58

Import neighbourhood

Above: what it imports. Below: what imports it.

Corpus entries

mf-purged-cv-no-leakage-brownian · portfolio_and_performance.json · full statement
Purged Cross-Validation: Surviving Training Labels Are Independent of Test Labels

Let every label be a measurable function of the increments of a pre-Brownian motion over its own nonempty span [lo, hi] ⊆ [0, ∞). If a training label survives purging (its span neither starts inside, ends inside nor envelops any test span), then it is independent of every test label. Pairwise only: joint independence of the whole test fold from the whole surviving training set, embargoing, and labels with random spans are not covered.

Declarations 8

defMathFin.overlapsTestsource
{ι : Type u_1} → {κ : Type u_2} → {T : Type u_3} → [LinearOrder T] → (ι → T) → (ι → T) → (κ → T) → (κ → T) → ι → κ → Prop

The purge-trigger predicate: training interval i starts inside, ends inside, or envelops test interval j.

theoremMathFin.overlapsTest_of_mem_of_memsource
∀ {ι : Type u_1} {κ : Type u_2} {T : Type u_3} [LinearOrder T] (lo hi : ι → T) (lo' hi' : κ → T) {i : ι} {j : κ} {t : T}, t ∈ Set.Icc (lo i) (hi i) → t ∈ Set.Icc (lo' j) (hi' j) → overlapsTest lo hi lo' hi' i j

If a point lies in both intervals, the overlap predicate holds between them: comparing lo' j with lo i, and then hi i with hi' j, picks which of the three overlap cases applies.

theoremMathFin.purged_disjointsource
∀ {ι : Type u_1} {κ : Type u_2} {T : Type u_3} [LinearOrder T] (lo hi : ι → T) (lo' hi' : κ → T) {i : ι}, (∀ (j : κ), ¬overlapsTest lo hi lo' hi' i j) → ∀ (j : κ), Disjoint (Set.Icc (lo i) (hi i)) (Set.Icc (lo' j) (hi' j))

The disjointness invariant: a training interval i that no test interval j triggers the purge predicate on is disjoint from every test interval.

theoremMathFin.lt_or_lt_of_not_overlapsTestsource
∀ {ι : Type u_1} {κ : Type u_2} {T : Type u_3} [LinearOrder T] {lo hi : ι → T} {lo' hi' : κ → T} {i : ι} {j : κ}, lo i ≤ hi i → lo' j ≤ hi' j → ¬overlapsTest lo hi lo' hi' i j → hi i < lo' j ∨ hi' j < lo i

Surviving purging separates the spans strictly: if training span [lo i, hi i] and test span [lo' j, hi' j] are nonempty and do not trigger the overlap predicate, one ends strictly before the other starts. (Otherwise max (lo i) (lo' j) lies in both.)

theoremMathFin.uniqueness_pooled_eq_of_purgedsource
∀ {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (lo hi : ι → ℝ) (lo' hi' : κ → ℝ) {i : ι}, (∀ (j : κ), ¬overlapsTest lo hi lo' hi' i j) → ∀ {t : ℝ}, t ∈ Set.Icc (lo i) (hi i) → uniqueness (Sum.elim lo lo') (Sum.elim hi hi') t (Sum.inl i) = uniqueness lo hi t i

Purging keeps test labels out of a surviving training label's uniqueness. If training label i survives purging against every test label, then at every time t of its span no test label is active, so its uniqueness computed on the pooled sample (training ⊕ test) equals its uniqueness computed on the training sample alone.

defMathFin.IsSpanLabelsource
{Ω : Type u_4} → {E : Type u_5} → [MeasurableSpace E] → (NNReal → Ω → ℝ) → NNReal → NNReal → (Ω → E) → Prop

A label determined by the increments of X over its span [a, b]: a measurable function of the increment family (X u - X s)_{s, u ∈ [a, b]}. For instance, with X the log-price, López de Prado's fixed-horizon label (the sign of the return X b - X a over the span) is of this form.

theoremMathFin.IsSpanLabel.indepFun_of_lesource
∀ {Ω : Type u_4} {E : Type u_5} {E' : Type u_6} {mΩ : MeasurableSpace Ω} {P : Measure Ω} [MeasurableSpace E] [MeasurableSpace E'] {B : NNReal → Ω → ℝ}, IsPreBrownianReal B P → ∀ {a b c d : NNReal}, b ≤ c → ∀ {L : Ω → E} {L' : Ω → E'}, IsSpanLabel B a b L → IsSpanLabel B c d L' → IndepFun L L' P

Labels on ordered spans of a pre-Brownian motion are independent. If L is determined by the increments of B over [a, b], L' by those over [c, d], and b ≤ c, then L and L' are independent: L is a measurable function of the path up to time c, L' of the increments after c, and these are independent by the weak Markov property IsPreBrownianReal.indepFun_shift.

theoremMathFin.indepFun_of_purgedsource
∀ {ι : Type u_1} {κ : Type u_2} {Ω : Type u_4} {E : Type u_5} {E' : Type u_6} {mΩ : MeasurableSpace Ω} {P : Measure Ω} [MeasurableSpace E] [MeasurableSpace E'] {B : NNReal → Ω → ℝ}, IsPreBrownianReal B P → ∀ {lo hi : ι → NNReal} {lo' hi' : κ → NNReal}, (∀ (i : ι), lo i ≤ hi i) → (∀ (j : κ), lo' j ≤ hi' j) → ∀ {L : ι → Ω → E} {L' : κ → Ω → E'}, (∀ (i : ι), IsSpanLabel B (lo i) (hi i) (L i)) → (∀ (j : κ), IsSpanLabel B (lo' j) (hi' j) (L' j)) → ∀ {i : ι}, (∀ (j : κ), ¬overlapsTest lo hi lo' hi' i j) → ∀ (j : κ), IndepFun (L i) (L' j) P

After purging, test labels are independent of surviving training labels. Let every label be determined by the increments of a pre-Brownian motion B over its own nonempty span (IsSpanLabel). If training label i survives purging — no test span triggers the overlap predicate against it — then it is independent of every test label j. The spans are strictly separated (lt_or_lt_of_not_overlapsTest), and IsSpanLabel.indepFun_of_le applies in whichever order they come.