Demonstration 1 of 1
Chunk-level and recording-level cross-validation against new recordings
How far does chunk-level cross-validation overstate accuracy on new recordings, and does it distort the comparison between models?
Every chunk of a recording carries the same background. A flexible model can learn that background as a fingerprint of the species, and a chunk-level split puts siblings of every held-out chunk in training, so the fingerprint scores well. A recording-level split removes the siblings, so the model is judged on the call itself. More chunks per recording gives the fingerprint more to memorize and the optimism grows.
Scroll sideways for the whole equation
AUC is the area under the ROC curve for the species label, pooled over all held-out chunks. Optimism is a cross-validation AUC minus the AUC on new recordings.
Predict first. With 8 chunks per recording, how does the flexible model's chunk-level cross-validation AUC compare with its AUC on recordings it never saw?
Choose an example
Scroll sideways for the whole figure
Constructed example: seeded synthetic audio, FFT features and two classifiers, measured by the chapter activity.
Calculated values
- Flexible, chunk-level CV
- 0.895
- Flexible, recording-level CV
- 0.628
- Flexible, new recordings
- 0.684
- Simple, new recordings
- 0.675
- Chunk-level optimism (flexible)
- +0.211
With 8 chunks per recording, the flexible model scores AUC 0.684 on new recordings. Chunk-level cross-validation reports 0.895, an optimism of 0.895 - 0.684 = 0.211; recording-level cross-validation reports 0.628. The flexible model's AUC minus the simple model's is +0.154 under chunk-level validation, -0.011 under recording-level validation and +0.009 on new recordings.
Worked steps
- Chunk-level optimism, flexible model: 0.895 - 0.684 = 0.211.
- Recording-level error, flexible model: 0.628 - 0.684 = -0.056.
- Chunk-level lead of the flexible model: 0.895 - 0.741 = 0.154.
- Lead on new recordings: 0.684 - 0.675 = 0.009.
Use the idea
Group chunks by recording (or site, or subject) in every split, choose models on the grouped score, and check the support in each fold when classes are rare.
Where the conclusion applies
Constructed audio with a recording-level label, a single kind of background shift and tree and logistic models in place of the chapter's CNN on mel spectrograms. Only 60 recordings, so the recording-level estimate itself varies by a few hundredths between replicates, and the flexible-versus-simple gap on new recordings is small here (under 0.06 across the seeds tried).
Check your understanding: At 8 chunks per recording, chunk-level validation says the flexible model beats the simple one by 0.154. What do the other two scores say?
Chapter 64 source: section "Record-Level Cross-Validation Is Not Optional".