Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.


The class imbalance problem

The exception proves the rule.

This is a preview of subscription content, access via your institution

Access options

Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Fig. 1: Rebalancing methods applied to a dataset with M = 50 normal and m = 5 diseased cells (IR = 10).
Fig. 2: Benefits of rebalancing classes in the training set by undersampling with increasing imbalance ratio on the performance of a CART decision tree classifier.
Fig. 3: Training with AUROC can provide acceptable performance at IR = 10 without rebalancing.
Fig. 4: Comparison of rebalancing methods on the performance of a CART decision tree classifier.


  1. Lever, J., Krzywinski, M. & Altman, N. Nat. Methods 13, 541–542 (2016).

    CAS  Article  Google Scholar 

  2. Krzywinski, M. & Altman, N. Nat. Methods 14, 757–758 (2017).

    CAS  Article  Google Scholar 

  3. Lever, J., Krzywinski, M. & Altman, N. Nat. Methods 13, 603–604 (2016).

    CAS  Article  Google Scholar 

  4. King, G. & Zeng, L. Polit. Anal. 9, 137–163 (2001).

    Article  Google Scholar 

  5. Altman, N. & Krzywinski, M. Nat. Methods 18, 840–842 (2021).

    CAS  Article  Google Scholar 

  6. Chawla, N. V., Bowyer, K. W., Hall, L. O. & Kegelmeyer, W. P. J. Artif. Intell. Res. 16, 321–357 (2002).

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Martin Krzywinski.

Ethics declarations

Competing interests

The authors declare no competing interests.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Megahed, F.M., Chen, YJ., Megahed, A. et al. The class imbalance problem. Nat Methods 18, 1270–1272 (2021).

Download citation

  • Published:

  • Issue Date:

  • DOI:


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing