File Exchange

image thumbnail

Distribution-balanced stratified cross-validation

version 1.1.0 (1.9 KB) by Jan Motl
An improvement to stratified cross-validation for small imbalanced data sets.


Updated 12 Oct 2019

View License

Distribution optimally balanced stratified cross-validation (DOB-SCV) partitions a data set into n folds in such a way that a balanced distribution in feature space is maintained for each class, in addition to stratification based on the label.

The real-world effect of using DOB-SCV, instead of stratified cross-validation, is slightly higher testing accuracy. The biggest improvements can be expected on small, class imbalanced data sets.

The implementation can be used as a drop-in replacement for CVPARTITION.

Reference: Study on the Impact of Partition-Induced Dataset Shift on k-Fold Cross-Validation available from

Cite As

Jan Motl (2020). Distribution-balanced stratified cross-validation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)


Hello, where can i get the mod1 Function?



Speed up

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux