MATLAB Answers

Create k-fold Cross Validation with Undersampling for highly imbalanced Dataset

41 ビュー (過去 30 日間)
Dario Walter
Dario Walter 2020 年 8 月 4 日
回答済み: Anshika Chaurasia 2020 年 8 月 14 日
Dear Community,
I am not sure how to implement the following requirement. When I use undersampling for my supervised Machine Learning Algorithm, how can I assure that the k-fold corresponds to the distribution of the original dataset. The performace metric (e.g. PR AUC) shall refer to the original distribution and not to the distribution of the undersampled set.
It does not make sense to solely perform k-fold cross validation on the entire undersampled dataset.
Your help is highly appreciated!

  0 件のコメント


回答 (1 件)

Anshika Chaurasia
Anshika Chaurasia 2020 年 8 月 14 日
Hi Dario,
It is my understanding that you want k-folds (cross-validation) to preserve the imbalanced distribution of original dataset. The solution is stratified k-fold cross-validation.
  • Use cvpartition function and refer to cvpartition documentation for more information.
c = cvpartition(group,'KFold',k,'Stratify',stratifyOption)
  • You can also try following file exchange documents as a drop-in replacement to cvpartition:
  1. Distribution-balanced stratified cross-validation
  2. Stratified cross-validation for multi-label datasets

  0 件のコメント





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by