"If it walks like a duck and it quacks like a duckthen it's probably a duck." ,
![]() |
Image: http://bit.ly/2qJJ0mA |
a) Default - includes the names and attributes of people who we already know have defaulted on their credit card
b)
We then use
Here's how it works:
![]() |
Image: KDNuggets |
What data are we going to use?
The Default of Credit Card Clients data set comes from the UCI Machine Learning Repository. Here's the descriptionThe case of customers' default payments in Taiwan in 2016. It has 30,000 rows and 24 columns. The variables are as follows:
X1: Amount of the given credit (NT dollar): it includes both the individual consumer credit and his/her family (supplementary) credit.
X2: Gender (1 = male; 2 = female).
X3: Education (1 = graduate school; 2 = university; 3 = high school; 4 = others).
X4: Marital status (1 = married; 2 = single; 3 = others).
X5: Age (year).
X6 - X11: History of past payment. We tracked the past monthly payment records (from April to September, 2005) as follows:
X6 = the repayment status in September, 2005;
X7 = the repayment status in August, 2005;
X11 = the repayment status in April, 2005. The measurement scale for the repayment status is: -1 = pay
X12-X17: Amount of bill statement (NT dollar). X12 = amount of bill statement in September, 2005; X13 = amount of bill statement in August, 2005;
X17 = amount of bill statement in April, 2005.
X18-X23: Amount of previous payment (NT dollar).
X18 = amount paid in September, 2005;
X19 = amount paid in August, 2005;
X23 = amount paid in April, 2005.
Goal:
We wish to find out whether new cases will default or not on their credit card accounts. We use the historical data that contain the attributes of people who defaulted and did not default and classify the new data points based on their "similarities" with the old ones.R Code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> library(pacman) | |
> pacman::p_load("class") | |
> df <- read.csv(file.choose()) | |
> colnames(df) | |
[1] "ID" "LIMIT_BAL" "SEX" "EDUCATION" "MARRIAGE" "AGE" "PAY_0" "PAY_2" "PAY_3" "PAY_4" | |
[11] "PAY_5" "PAY_6" "BILL_AMT1" "BILL_AMT2" "BILL_AMT3" "BILL_AMT4" "BILL_AMT5" "BILL_AMT6" "PAY_AMT1" "PAY_AMT2" | |
[21] "PAY_AMT3" "PAY_AMT4" "PAY_AMT5" "PAY_AMT6" "DEFAULT" | |
> head(df) | |
ID LIMIT_BAL SEX EDUCATION MARRIAGE AGE PAY_0 PAY_2 PAY_3 PAY_4 PAY_5 PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4 BILL_AMT5 | |
1 1 20000 2 2 1 24 2 2 -1 -1 -2 -2 3913 3102 689 0 0 | |
2 2 120000 2 2 2 26 -1 2 0 0 0 2 2682 1725 2682 3272 3455 | |
3 3 90000 2 2 2 34 0 0 0 0 0 0 29239 14027 13559 14331 14948 | |
4 4 50000 2 2 1 37 0 0 0 0 0 0 46990 48233 49291 28314 28959 | |
5 5 50000 1 2 1 57 -1 0 -1 0 0 0 8617 5670 35835 20940 19146 | |
6 6 50000 1 1 2 37 0 0 0 0 0 0 64400 57069 57608 19394 19619 | |
BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3 PAY_AMT4 PAY_AMT5 PAY_AMT6 DEFAULT | |
1 0 0 689 0 0 0 0 1 | |
2 3261 0 1000 1000 1000 0 2000 1 | |
3 15549 1518 1500 1000 1000 1000 5000 0 | |
4 29547 2000 2019 1200 1100 1069 1000 0 | |
5 19131 2000 36681 10000 9000 689 679 0 | |
6 20024 2500 1815 657 1000 1000 800 0 | |
> #Normalize data using the range (Min-Max) by first creating a function | |
> normalize <- function(x) { | |
+ norm <- ((x - min(x))/(max(x) - min(x))) | |
+ return (norm) | |
+ } | |
> #apply function to all features except the first and last columns (ID and Default score columns) | |
> dfn <- as.data.frame(lapply(df[, 2:24], normalize)) | |
> head(dfn) | |
LIMIT_BAL SEX EDUCATION MARRIAGE AGE PAY_0 PAY_2 PAY_3 PAY_4 PAY_5 PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4 | |
1 0.01010101 1 0.3333333 0.3333333 0.05172414 0.4 0.4 0.1 0.1 0.0 0.0 0.1499817 0.06916432 0.08672289 0.1601378 | |
2 0.11111111 1 0.3333333 0.6666667 0.08620690 0.1 0.4 0.2 0.2 0.2 0.4 0.1488924 0.06785751 0.08781713 0.1632199 | |
3 0.08080808 1 0.3333333 0.6666667 0.22413793 0.2 0.2 0.2 0.2 0.2 0.2 0.1723923 0.07953247 0.09378907 0.1736374 | |
4 0.04040404 1 0.3333333 0.3333333 0.27586207 0.2 0.2 0.2 0.2 0.2 0.2 0.1880999 0.11199497 0.11340745 0.1868092 | |
5 0.04040404 0 0.3333333 0.3333333 0.62068966 0.1 0.2 0.1 0.2 0.2 0.2 0.1541442 0.07160143 0.10601954 0.1798630 | |
6 0.04040404 0 0.1666667 0.6666667 0.27586207 0.2 0.2 0.2 0.2 0.2 0.2 0.2035057 0.12038060 0.11797384 0.1784066 | |
BILL_AMT5 BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3 PAY_AMT4 PAY_AMT5 PAY_AMT6 | |
1 0.08064809 0.2609787 0.000000000 0.0004090820 0.0000000000 0.000000000 0.000000000 0.000000000 | |
2 0.08407395 0.2634847 0.000000000 0.0005937329 0.0011160216 0.001610306 0.000000000 0.003783107 | |
3 0.09547003 0.2729278 0.001737733 0.0008905994 0.0011160216 0.001610306 0.002344506 0.009457767 | |
4 0.10936287 0.2836851 0.002289503 0.0011987467 0.0013392259 0.001771337 0.002506277 0.001891553 | |
5 0.09963262 0.2756805 0.002289503 0.0217787169 0.0111602161 0.014492754 0.001615365 0.001284365 | |
6 0.10010164 0.2763668 0.002861879 0.0010776252 0.0007332262 0.001610306 0.002344506 0.001513243 | |
> #After that, put back the last column containing Default scores | |
> dfn <- cbind(dfn, df[,25]) | |
> head(dfn) | |
LIMIT_BAL SEX EDUCATION MARRIAGE AGE PAY_0 PAY_2 PAY_3 PAY_4 PAY_5 PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4 | |
1 0.01010101 1 0.3333333 0.3333333 0.05172414 0.4 0.4 0.1 0.1 0.0 0.0 0.1499817 0.06916432 0.08672289 0.1601378 | |
2 0.11111111 1 0.3333333 0.6666667 0.08620690 0.1 0.4 0.2 0.2 0.2 0.4 0.1488924 0.06785751 0.08781713 0.1632199 | |
3 0.08080808 1 0.3333333 0.6666667 0.22413793 0.2 0.2 0.2 0.2 0.2 0.2 0.1723923 0.07953247 0.09378907 0.1736374 | |
4 0.04040404 1 0.3333333 0.3333333 0.27586207 0.2 0.2 0.2 0.2 0.2 0.2 0.1880999 0.11199497 0.11340745 0.1868092 | |
5 0.04040404 0 0.3333333 0.3333333 0.62068966 0.1 0.2 0.1 0.2 0.2 0.2 0.1541442 0.07160143 0.10601954 0.1798630 | |
6 0.04040404 0 0.1666667 0.6666667 0.27586207 0.2 0.2 0.2 0.2 0.2 0.2 0.2035057 0.12038060 0.11797384 0.1784066 | |
BILL_AMT5 BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3 PAY_AMT4 PAY_AMT5 PAY_AMT6 df[, 25] | |
1 0.08064809 0.2609787 0.000000000 0.0004090820 0.0000000000 0.000000000 0.000000000 0.000000000 1 | |
2 0.08407395 0.2634847 0.000000000 0.0005937329 0.0011160216 0.001610306 0.000000000 0.003783107 1 | |
3 0.09547003 0.2729278 0.001737733 0.0008905994 0.0011160216 0.001610306 0.002344506 0.009457767 0 | |
4 0.10936287 0.2836851 0.002289503 0.0011987467 0.0013392259 0.001771337 0.002506277 0.001891553 0 | |
5 0.09963262 0.2756805 0.002289503 0.0217787169 0.0111602161 0.014492754 0.001615365 0.001284365 0 | |
6 0.10010164 0.2763668 0.002861879 0.0010776252 0.0007332262 0.001610306 0.002344506 0.001513243 0 | |
> colnames(dfn) | |
[1] "LIMIT_BAL" "SEX" "EDUCATION" "MARRIAGE" "AGE" "PAY_0" "PAY_2" "PAY_3" "PAY_4" "PAY_5" | |
[11] "PAY_6" "BILL_AMT1" "BILL_AMT2" "BILL_AMT3" "BILL_AMT4" "BILL_AMT5" "BILL_AMT6" "PAY_AMT1" "PAY_AMT2" "PAY_AMT3" | |
[21] "PAY_AMT4" "PAY_AMT5" "PAY_AMT6" "df[, 25]" | |
> #Change back name of column 25 to Default | |
> names(dfn)[24] <- "Default" | |
> #Check data | |
> colnames(dfn) | |
[1] "LIMIT_BAL" "SEX" "EDUCATION" "MARRIAGE" "AGE" "PAY_0" "PAY_2" "PAY_3" "PAY_4" "PAY_5" | |
[11] "PAY_6" "BILL_AMT1" "BILL_AMT2" "BILL_AMT3" "BILL_AMT4" "BILL_AMT5" "BILL_AMT6" "PAY_AMT1" "PAY_AMT2" "PAY_AMT3" | |
[21] "PAY_AMT4" "PAY_AMT5" "PAY_AMT6" "Default" | |
> head(df) | |
ID LIMIT_BAL SEX EDUCATION MARRIAGE AGE PAY_0 PAY_2 PAY_3 PAY_4 PAY_5 PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4 BILL_AMT5 | |
1 1 20000 2 2 1 24 2 2 -1 -1 -2 -2 3913 3102 689 0 0 | |
2 2 120000 2 2 2 26 -1 2 0 0 0 2 2682 1725 2682 3272 3455 | |
3 3 90000 2 2 2 34 0 0 0 0 0 0 29239 14027 13559 14331 14948 | |
4 4 50000 2 2 1 37 0 0 0 0 0 0 46990 48233 49291 28314 28959 | |
5 5 50000 1 2 1 57 -1 0 -1 0 0 0 8617 5670 35835 20940 19146 | |
6 6 50000 1 1 2 37 0 0 0 0 0 0 64400 57069 57608 19394 19619 | |
BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3 PAY_AMT4 PAY_AMT5 PAY_AMT6 DEFAULT | |
1 0 0 689 0 0 0 0 1 | |
2 3261 0 1000 1000 1000 0 2000 1 | |
3 15549 1518 1500 1000 1000 1000 5000 0 | |
4 29547 2000 2019 1200 1100 1069 1000 0 | |
5 19131 2000 36681 10000 9000 689 679 0 | |
6 20024 2500 1815 657 1000 1000 800 0 | |
> #Split Data | |
> set.seed(2) | |
> dfn.split <- sample(2, nrow(dfn), replace = TRUE, prob = c(2/3, 1/3)) | |
> head(dfn.split) | |
[1] 1 2 1 1 2 2 | |
> dfn.split | |
[1] 1 2 1 1 2 2 1 2 1 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 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 2 1 1 | |
[ reached getOption("max.print") -- omitted 29000 entries ] | |
> train <- dfn[dfn.split == 1, 1:23] | |
> test <- dfn[dfn.split == 2, 1:23] | |
> head(train) | |
LIMIT_BAL SEX EDUCATION MARRIAGE AGE PAY_0 PAY_2 PAY_3 PAY_4 PAY_5 PAY_6 BILL_AMT1 BILL_AMT2 BILL_AMT3 BILL_AMT4 | |
1 0.01010101 1 0.3333333 0.3333333 0.05172414 0.4 0.4 0.1 0.1 0.0 0.0 0.1499817 0.06916432 0.08672289 0.1601378 | |
3 0.08080808 1 0.3333333 0.6666667 0.22413793 0.2 0.2 0.2 0.2 0.2 0.2 0.1723923 0.07953247 0.09378907 0.1736374 | |
4 0.04040404 1 0.3333333 0.3333333 0.27586207 0.2 0.2 0.2 0.2 0.2 0.2 0.1880999 0.11199497 0.11340745 0.1868092 | |
7 0.49494949 0 0.1666667 0.6666667 0.13793103 0.2 0.2 0.2 0.2 0.2 0.2 0.4721257 0.45724242 0.33067231 0.6713097 | |
9 0.13131313 1 0.5000000 0.3333333 0.12068966 0.2 0.2 0.4 0.2 0.2 0.2 0.1565051 0.07959795 0.09299241 0.1716404 | |
10 0.01010101 0 0.5000000 0.6666667 0.24137931 0.0 0.0 0.0 0.0 0.1 0.1 0.1465192 0.06622043 0.08634460 0.1601378 | |
BILL_AMT5 BILL_AMT6 PAY_AMT1 PAY_AMT2 PAY_AMT3 PAY_AMT4 PAY_AMT5 PAY_AMT6 | |
1 0.08064809 0.2609787 0.000000000 0.0004090820 0.0000000000 0.000000000 0.000000000 0.000000000 | |
3 0.09547003 0.2729278 0.001737733 0.0008905994 0.0011160216 0.001610306 0.002344506 0.009457767 | |
4 0.10936287 0.2836851 0.002289503 0.0011987467 0.0013392259 0.001771337 0.002506277 0.001891553 | |
7 0.55957779 0.6251961 0.062961335 0.0237493165 0.0424088210 0.032590982 0.032236964 0.026046691 | |
9 0.09234163 0.2638367 0.003810878 0.0000000000 0.0004821213 0.001610306 0.002344506 0.001891553 | |
10 0.09354540 0.2716698 0.000000000 0.0000000000 0.0000000000 0.020945250 0.002630536 0.000000000 | |
> #Subset with outcome labels | |
> trainlabel <- dfn[dfn.split == 1,24] | |
> testlabel <- dfn[dfn.split == 2, 24] | |
> #Build classifier | |
> dfn.pred <- knn(train = train, test = test, cl = trainlabel, k =9) | |
> dfn.pred | |
[1] 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 | |
[65] 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 | |
[129] 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 | |
[193] 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
[257] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 | |
[321] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 | |
[385] 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
[897] 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
[961] 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 | |
[ reached getOption("max.print") -- omitted 9018 entries ] | |
Levels: 0 1 | |
> table(dfn.pred, testlabel) | |
testlabel | |
dfn.pred 0 1 | |
0 7314 1499 | |
1 472 733 | |
> (7315+733)/(7315+1499+472+733) | |
[1] 0.803254 |
Comments
Post a Comment