σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
scikit-learn skill›Module 3 · Honest evaluation›Topic 3.9·~50 minAdvanced

A search that does not fool you

Skill positionModule 3 of 4 · Topic 9 of 9
3.9 A search that does not fool you
—Lab score— / 100Total XP—Streak—
Lecture0% read

2 min read

01

The best of many is mostly luck

GridSearchCV tries every setting on a grid, scores each with cross-validation and keeps the best. For financial data the folds must walk forward: TimeSeriesSplit(5) trains on the past and validates on the block that follows, five times. The scoring can be the AUC (scoring='roc_auc'). In a pipeline, a setting is addressed by the step name, two underscores and the parameter: 'logit__C'. After the search, best_params_ holds the winner, cv_results_['mean_test_score'] the score of every grid point, and with the default refit=True the search itself predicts with the best model refitted on all the data it was given. With a handful of settings and a smooth score, the best validation score is a mild overestimate. On our 60 return columns the C grid gives AUCs of 0.512, 0.500, 0.504: tuning changes nothing, because there is nothing to find.

The danger grows with the number of candidates. Draw n models whose true skill is zero; their validation scores scatter around the mean with spread σ, and the best of them sits above the mean by about σ((1-γ)Φ⁻¹(1-1/n)+γΦ⁻¹(1-1/ne)), where γ=0.5772 is Euler's constant and Φ⁻¹ the normal quantile. Try 12 random models that each use three of the 60 columns: the best has a validation AUC of 0.523, and luck alone predicts 0.523. Refit the winner on the training rows and score it on the later 30% of days it never saw: its AUC is 0.478, below a coin. This is the winner's curse. The defences are a final holdout that no search touches, fewer candidates, and a sober look at how much of the best score the formula already explains.

  • Walk forward: use TimeSeriesSplit in the search, never shuffled folds, for time series.
  • The best of n exceeds the mean by about σ Φ⁻¹(1-1/n) even when nothing works.
  • Keep a final holdout that no search touches, and report that score, not the validation one.

Lab · what's graded

7 tasks · 100 pts
  • The pipeline5 pts
  • The grid search20 pts
  • Validation scores10 pts
  • Many small models20 pts
  • Expected best by luck10 pts
  • The winner's curse15 pts
  • The study20 pts
Explorer · lab-sl-20
▾ lab-sl-20
▾ data
…
bash · in-browser
learner@quantcraft:~/lab-sl-20$
Python not loaded yetPythonLn 1, Col 1Spaces: 4UTF-8

Reset this topic?

Everything in lab-sl-20 goes back to the starter files and the terminal is cleared. Your current solution will be lost — this can't be undone.

Will be reset
  • main.py → starter code
  • Terminal history and test output
  • Unsubmitted changes
Will be kept
  • Best lab score
  • Your XP and streak
  • Lecture progress and notes