[New Book] Click to get The Beginner's Guide to Data Science!
Use the offer code 20offearlybird to get 20% off. Hurry, sale ends soon!

Standard Machine Learning Datasets for Imbalanced Classification

An imbalanced classification problem is a problem that involves predicting a class label where the distribution of class labels in the training dataset is skewed.

Many real-world classification problems have an imbalanced class distribution, therefore it is important for machine learning practitioners to get familiar with working with these types of problems.

In this tutorial, you will discover a suite of standard machine learning datasets for imbalanced classification.

After completing this tutorial, you will know:

  • Standard machine learning datasets with an imbalance of two classes.
  • Standard datasets for multiclass classification with a skewed class distribution.
  • Popular imbalanced classification datasets used for machine learning competitions.

Kick-start your project with my new book Imbalanced Classification with Python, including step-by-step tutorials and the Python source code files for all examples.

Let’s get started.

  • Updated Jan/2021: Updated links for API documentation.
Standard Machine Learning Datasets for Imbalanced Classification

Standard Machine Learning Datasets for Imbalanced Classification
Photo by Graeme Churchard, some rights reserved.

Tutorial Overview

This tutorial is divided into three parts; they are:

  1. Binary Classification Datasets
  2. Multiclass Classification Datasets
  3. Competition and Other Datasets

Binary Classification Datasets

Binary classification predictive modeling problems are those with two classes.

Typically, imbalanced binary classification problems describe a normal state (class 0) and an abnormal state (class 1), such as fraud, a diagnosis, or a fault.

In this section, we will take a closer look at three standard binary classification machine learning datasets with a class imbalance. These are datasets that are small enough to fit in memory and have been well studied, providing the basis of investigation in many research papers.

The names of these datasets are as follows:

  • Pima Indians Diabetes (Pima)
  • Haberman Breast Cancer (Haberman)
  • German Credit (German)

Each dataset will be loaded and the nature of the class imbalance will be summarized.

Pima Indians Diabetes (Pima)

Each record describes the medical details of a female, and the prediction is the onset of diabetes within the next five years.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Want to Get Started With Imbalance Classification?

Take my free 7-day email crash course now (with sample code).

Click to sign-up and also get a free PDF Ebook version of the course.

Haberman Breast Cancer (Haberman)

Each record describes the medical details of a patient and the prediction is whether the patient survived after five years or not.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

German Credit (German)

Each record describes the financial details of a person and the prediction is whether the person is a good credit risk.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Multiclass Classification Datasets

Multiclass classification predictive modeling problems are those with more than two classes.

Typically, imbalanced multiclass classification problems describe multiple different events, some significantly more common than others.

In this section, we will take a closer look at three standard multiclass classification machine learning datasets with a class imbalance. These are datasets that are small enough to fit in memory and have been well studied, providing the basis of investigation in many research papers.

The names of these datasets are as follows:

  • Glass Identification (Glass)
  • E-coli (Ecoli)
  • Thyroid Gland (Thyroid)

Note: it is common in research papers to transform imbalanced multiclass classification problems into imbalanced binary classification problems by grouping all of the majority classes into one class and leaving the smallest minority class.

Each dataset will be loaded and the nature of the class imbalance will be summarized.

Glass Identification (Glass)

Each record describes the chemical content of glass and prediction involves the type of glass.

Below provides a sample of the first five rows of the dataset.

The first column represents a row identifier and can be removed.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

E-coli (Ecoli)

Each record describes the result of different tests and prediction involves the protein localization site name.

Below provides a sample of the first five rows of the dataset.

The first column represents a row identifier or name and can be removed.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Thyroid Gland (Thyroid)

Each record describes the result of different tests on a thyroid and prediction involves the medical diagnosis of the thyroid.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Competition and Other Datasets

This section lists additional datasets used in research papers that are less used, larger, or datasets used as the basis of machine learning competitions.

The names of these datasets are as follows:

  • Credit Card Fraud (Credit)
  • Porto Seguro Auto Insurance Claim (Porto Seguro)

Each dataset will be loaded and the nature of the class imbalance will be summarized.

Credit Card Fraud (Credit)

Each record describes a credit card translation and it is classified as fraud.

This data is about 144 megabytes uncompressed or 66 megabytes compressed.

Download the dataset and unzip it into your current working directory.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Porto Seguro Auto Insurance Claim (Porto Seguro)

Each record describes people’s car insurance details and prediction involves whether or not the person will make an insurance claim.

This data is about 42 megabytes compressed.

Download the dataset and unzip it into your current working directory.

Below provides a sample of the first five rows of the dataset.

The example below loads and summarizes the class breakdown of the dataset.

Running the example provides the following output.

Further Reading

This section provides more resources on the topic if you are looking to go deeper.

Papers

Articles

Summary

In this tutorial, you discovered a suite of standard machine learning datasets for imbalanced classification.

Specifically, you learned:

  • Standard machine learning datasets with an imbalance of two classes.
  • Standard datasets for multiclass classification with a skewed class distribution.
  • Popular imbalanced classification datasets used for machine learning competitions.

Do you have any questions?
Ask your questions in the comments below and I will do my best to answer.

Get a Handle on Imbalanced Classification!

Imbalanced Classification with Python

Develop Imbalanced Learning Models in Minutes

...with just a few lines of python code

Discover how in my new Ebook:
Imbalanced Classification with Python

It provides self-study tutorials and end-to-end projects on:
Performance Metrics, Undersampling Methods, SMOTE, Threshold Moving, Probability Calibration, Cost-Sensitive Algorithms
and much more...

Bring Imbalanced Classification Methods to Your Machine Learning Projects

See What's Inside

14 Responses to Standard Machine Learning Datasets for Imbalanced Classification

  1. Avatar
    Ram pavan December 30, 2019 at 10:23 am #

    Very useful information sir I am a researcher and my area is colon cancer detection I require the colon cancer data set sir

  2. Avatar
    Pekos January 2, 2020 at 4:28 pm #

    Should we always resampling the imbalanced class?

    • Avatar
      Jason Brownlee January 3, 2020 at 7:15 am #

      No, try a suite of methods and use the the method/s that meet the goals of the project and give the best results.

  3. Avatar
    anup kumar January 2, 2020 at 6:49 pm #

    great post jason. i love your blog keep posting like this

  4. Avatar
    Anthony January 3, 2020 at 6:07 pm #

    Where do you teach how to deal with imbalanced data sets(for example the technique – SMOTE)

    • Avatar
      Jason Brownlee January 4, 2020 at 8:27 am #

      I will be sharing tutorials on this topic in the coming weeks.

  5. Avatar
    fawaz January 3, 2020 at 9:36 pm #

    Very beneficial post.
    thanks

    • Avatar
      Jason Brownlee January 4, 2020 at 8:31 am #

      You’re welcome.

      • Avatar
        Meghana January 5, 2020 at 5:56 am #

        Hello Mr. Jason, your post was so informative and helpful. Thank you for posting it. I am having a dataset of money laundering. I have to build a classification model. Since I am a student and new to machine learning, it’s not getting done. Anything that could guide me ?

  6. Avatar
    Anthony The Koala January 13, 2020 at 8:55 am #

    Dear Dr Jason,
    In relation to the zip file “creditcardfraud.zip” located https://raw.githubusercontent.com/jbrownlee/Datasets/master/creditcardfraud.zip , it does not exist.

    Can you suggest any other place to download it please.

    Thank you
    Anthony of Sydney

Leave a Reply