Ensemble Machine Learning Cookbook by Dipayan Sarkar

Ensemble Machine Learning Cookbook by Dipayan Sarkar

Author:Dipayan Sarkar [Dipayan Sarkar]
Language: eng
Format: epub
Tags: COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM044000 - COMPUTERS / Neural Networks, COM042000 - COMPUTERS / Natural Language Processing
Publisher: Packt
Published: 2019-01-31T06:39:03+00:00


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 os

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

%matplotlib inline

import seaborn as sns

We set our working folder as follows:

# Set your working directory according to your requirement

os.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 understand it easily:

df_creditcarddata = pd.read_csv("UCI_Credit_Card.csv")

We check the shape of the dataset:

df_creditcarddata.shape

We check the datatypes:

df_creditcarddata.dtypes

We drop the ID column, as this is not required:

df_creditcarddata = df_creditcarddata.drop("ID", axis= 1)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.