Getting ready

In this example, we use a dataset from the UCI ML repository on credit card defaults. This dataset contains the following information:

  • Default payments
  • Demographic factors
  • Credit data
  • History of payments
  • Bill statements of credit card clients

The data and the data descriptions are provided in the GitHub folder:

We will start by loading the required libraries and reading our dataset:

import osimport numpy as npimport pandas as pdimport matplotlib.pyplot as plt%matplotlib inlineimport seaborn as sns

We set our working folder as follows:

# Set your working directory according to your requirementos.chdir(".../Chapter 6/Random Forest")os.getcwd()

Let's now read our data. We will prefix the DataFrame name with df_ so that we can ...

Get Ensemble Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.