Blocked Cross-Validation for Dependent Data
Blocked cross-validation estimates the prediction error of a model fitted to time-ordered data without the leakage that shuffled folds cause. The rows are split into K contiguous blocks in time; each block serves once as the test set, and the model is trained on the other rows, optionally leaving out h rows on each side of the test block (hv-block) so that neighbouring observations cannot pass information across the boundary.
블록 교차검증은 시간 순서가 있는 자료에 적합한 모형의 예측오차를, 무작위로 섞은 접기에서 생기는 정보 누출 없이 추정합니다. 행을 시간상 연속된 K 개 블록으로 나누고 블록마다 한 번씩 시험 자료로 쓰며, 나머지 행으로 모형을 학습합니다. 필요하면 시험 블록 양옆의 h 개 행을 학습에서 빼서(hv 블록) 이웃 관측치가 경계를 넘어 정보를 전하지 못하게 합니다.
How well does my regression or autoregression predict new periods when observations close in time are correlated?
시간상 가까운 관측치끼리 상관이 있을 때 회귀모형이나 자기회귀모형이 새 기간을 얼마나 잘 예측합니까?
The method returns the cross-validated mean squared error, its square root and mean absolute error, the error in each time block, the shuffled K-fold error for comparison and the in-sample error.
When to use Blocked Cross-Validation for Dependent Data
- Rows are ordered in time and nearby rows are correlated.
- You compare linear models with features and lags of the outcome.
- Shuffled cross-validation looks suspiciously optimistic.
When to use something else
- You must respect the forecast direction (train only on the past): use Rolling Origin Forecast Evaluation
- The rows are independent: use Split-Sample (Hold-Out) Validation
Assumptions and requirements
- Stationary relation between outcome and predictors
- Dependence shorter than the gap when a gap is used
What the analysis reports
- CV MSE, RMSE and MAE
- Per-block errors
- Shuffled K-fold MSE and ratio
How to report it
Blocked 5-fold cross-validation with a gap of [value] gave RMSE = [value]; shuffled folds gave [value].
Related methods
- Rolling Origin Forecast Evaluation
- Split-Sample (Hold-Out) Validation
- Bootstrap Optimism-Corrected Model Validation
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with scikit-learn at a stated tolerance of 1e-8.
독립 계산. scikit-learn 대조 참조 시험 1건 통과(허용오차 1e-8).
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Blocked Cross-Validation for Dependent Data on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable and a time variable
- Price
- 400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.