Nested CV: V-in-V evaluation without reopening the test set
UnifiedValidationCalibrator is the production class from the AFML MetaTrader 5 blueprint (Part 16): three temporal zones, nested walk-forward/CPCV loops, Masters’ 1-SE hyperparameter rule, out-of-fold isotonic calibration, and a final test gate that raises if you open it twice. Python selects and calibrates; MQL5 consumes the artifacts.
What the article ships
AFML Part 16Attached code in afml.zip: nested_cv.py (DataPartition, partition_data, inner_cv_search, UnifiedValidationCalibrator), plus dependencies cross_validation.py and combinatorial.py.
from afml.cross_validation.nested_cv import UnifiedValidationCalibrator
Nested CV vs oos-lab vs DSR
choose-
Use Nested CV (
UnifiedValidationCalibrator) You are fitting a classifier, searching aparam_grid, and learning a probability calibrator under temporal labels (t1, embargo). You need an estimate that is not contaminated by HP selection or in-sample calibration — then open the final ~20% once. - Use oos-lab You already have return series (or a matrix of variants) and need PSR / Deflated Sharpe / PBO–CSCV / WalkForward or CombinatorialPurgedKFold index splits / Harvey–Liu haircuts in Python — not model selection + calibration orchestration.
- Use the Deflated Sharpe calculator Quick browser check from an annualized Sharpe, observation count, and trial count. No install. Complements nested CV after you have a committed OOS return path — it does not replace nested CV.