Repeated CV and dependence
Quick answer
Repeated cross-validation runs a fold design with several random partitions. It reveals sensitivity to the split, but the resulting scores are dependent because training and evaluation rows are reused. Static examples tested locally with Python 3.13.5, scikit-learn 1.8.0 SciPy 1.17.0 and NumPy 2.3.5 where imported. ByteMind package execution is unverified.
Count validation appearances
from sklearn.model_selection import RepeatedKFoldcounts=[0]*6for tr,va in RepeatedKFold(n_splits=3,n_repeats=2,random_state=7).split(range(6)): for i in va: counts[i]+=1print(counts)Observed local output:
[2, 2, 2, 2, 2, 2]Every row is evaluated twice, not replaced with independent observations.
How it works
RepeatedKFold and RepeatedStratifiedKFold generate k times r splits. Each row appears in validation once per repetition; the same data supports every repetition. Report per-fold and per-repeat scores, average, spread, seeds and data unit. A standard deviation describes observed score variation; dividing it by sqrt(k*r) as if all scores were independent usually understates uncertainty. For independent groups, consider uncertainty methods that resample at group level and repeat the complete selection procedure; for temporal data use a dependence-aware method. No single interval recipe is universally valid. Use identical splits when comparing algorithms so paired differences reduce split-related noise; this does not remove dependence across folds. Repeated row CV cannot repair group leakage or temporal leakage. A final holdout is valuable only while sealed from decisions: repeated peeking converts it into another validation set. Predeclare metrics, tie rules, candidate budgets and the comparison unit. Distinguish a descriptive CV spread from a confidence interval for future deployments.
Compare matched fold scores
a=[80,60,90,70];b=[70,70,80,70]d=[x-y for x,y in zip(a,b)]print(d,sum(d)/len(d))Observed local output:
[10, -10, 10, 0] 2.5The mean paired improvement is 2.5 percentage points; the signs vary and folds are dependent.
Common mistakes
Do not count repeated validation predictions as new independent patients, report a naive independent-fold confidence interval, or select the best seed after seeing test scores. Repeated group CV needs an explicitly group-safe design, not RepeatedKFold on rows.
Practice and next steps
For 3 folds repeated 4 times, report number of fits for one candidate and how many times each row is evaluated. Explain why the 12 fold scores are not 12 independent experiments. Complete the knowledge check and staged exercise. Next: Hyperparameter optimization and model selection.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Repeated CV and dependence — knowledge check
Apply repeated cv and dependence to new scenarios.
How many splits in 5 folds repeated 3 times?
Are repeated fold scores independent?
Why compare methods on identical folds?
What does observed fold standard deviation describe?
What happens if final test is repeatedly used to tune?