The C5.0 Decision Tree using the Statlog (German Credit Data) Data Set
In this example, we will be using the C5.0 algorithm to determine the creditworthiness of a loan applicant. The data set used in the example is from UCI Machine Learning Repository. Let’s Load and Inspect the Data
credit.df = read.csv('data/german_credit_data.csv')
credit.df$default = factor(credit.df$default, levels = c(1, 2), labels = c('Yes', 'No'))
str(credit.df)## 'data.frame': 1000 obs. of 21 variables:
## $ checking_balance : chr "< 0 DM" "1 - 200 DM" "unknown" "< 0 DM" ...
## $ months_loan_duration: int 6 48 12 42 24 36 24 36 12 30 ...
## $ credit_history : chr "critical" "repaid" "critical" "repaid" ...
## $ purpose : chr "radio/tv" "radio/tv" "education" "furniture" ...
## $ amount : int 1169 5951 2096 7882 4870 9055 2835 6948 3059 5234 ...
## $ savings_balance : chr "unknown" "< 100 DM" "< 100 DM" "< 100 DM" ...
## $ employment_length : chr "> 7 yrs" "1 - 4 yrs" "4 - 7 yrs" "4 - 7 yrs" ...
## $ installment_rate : int 4 2 2 2 3 2 3 2 2 4 ...
## $ personal_status : chr "single male" "female" "single male" "single male" ...
## $ other_debtors : chr "none" "none" "none" "guarantor" ...
## $ residence_history : int 4 2 3 4 4 4 4 2 4 2 ...
## $ property : chr "real estate" "real estate" "real estate" "building society savings" ...
## $ age : int 67 22 49 45 53 35 53 35 61 28 ...
## $ installment_plan : chr "none" "none" "none" "none" ...
## $ housing : chr "own" "own" "own" "for free" ...
## $ existing_credits : int 2 1 1 1 2 1 1 1 1 2 ...
## $ default : Factor w/ 2 levels "Yes","No": 1 2 1 1 2 1 1 1 1 2 ...
## $ dependents : int 1 1 2 2 2 2 1 1 1 1 ...
## $ telephone : chr "yes" "none" "none" "none" ...
## $ foreign_worker : chr "yes" "yes" "yes" "yes" ...
## $ job : chr "skilled employee" "skilled employee" "unskilled resident" "skilled employee" ...
Summary statistics
summary(credit.df)## checking_balance months_loan_duration credit_history purpose
## Length:1000 Min. : 4.0 Length:1000 Length:1000
## Class :character 1st Qu.:12.0 Class :character Class :character
## Mode :character Median :18.0 Mode :character Mode :character
## Mean :20.9
## 3rd Qu.:24.0
## Max. :72.0
## amount savings_balance employment_length installment_rate
## Min. : 250 Length:1000 Length:1000 Min. :1.000
## 1st Qu.: 1366 Class :character Class :character 1st Qu.:2.000
## Median : 2320 Mode :character Mode :character Median :3.000
## Mean : 3271 Mean :2.973
## 3rd Qu.: 3972 3rd Qu.:4.000
## Max. :18424 Max. :4.000
## personal_status other_debtors residence_history property
## Length:1000 Length:1000 Min. :1.000 Length:1000
## Class :character Class :character 1st Qu.:2.000 Class :character
## Mode :character Mode :character Median :3.000 Mode :character
## Mean :2.845
## 3rd Qu.:4.000
## Max. :4.000
## age installment_plan housing existing_credits
## Min. :19.00 Length:1000 Length:1000 Min. :1.000
## 1st Qu.:27.00 Class :character Class :character 1st Qu.:1.000
## Median :33.00 Mode :character Mode :character Median :1.000
## Mean :35.55 Mean :1.407
## 3rd Qu.:42.00 3rd Qu.:2.000
## Max. :75.00 Max. :4.000
## default dependents telephone foreign_worker
## Yes:700 Min. :1.000 Length:1000 Length:1000
## No :300 1st Qu.:1.000 Class :character Class :character
## Median :1.000 Mode :character Mode :character
## Mean :1.155
## 3rd Qu.:1.000
## Max. :2.000
## job
## Length:1000
## Class :character
## Mode :character
##
##
##
Sneak-peek at the Data
kable(head(credit.df, n=15), format="html") | checking_balance | months_loan_duration | credit_history | purpose | amount | savings_balance | employment_length | installment_rate | personal_status | other_debtors | residence_history | property | age | installment_plan | housing | existing_credits | default | dependents | telephone | foreign_worker | job |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| < 0 DM | 6 | critical | radio/tv | 1169 | unknown | > 7 yrs | 4 | single male | none | 4 | real estate | 67 | none | own | 2 | Yes | 1 | yes | yes | skilled employee |
| 1 - 200 DM | 48 | repaid | radio/tv | 5951 | < 100 DM | 1 - 4 yrs | 2 | female | none | 2 | real estate | 22 | none | own | 1 | No | 1 | none | yes | skilled employee |
| unknown | 12 | critical | education | 2096 | < 100 DM | 4 - 7 yrs | 2 | single male | none | 3 | real estate | 49 | none | own | 1 | Yes | 2 | none | yes | unskilled resident |
| < 0 DM | 42 | repaid | furniture | 7882 | < 100 DM | 4 - 7 yrs | 2 | single male | guarantor | 4 | building society savings | 45 | none | for free | 1 | Yes | 2 | none | yes | skilled employee |
| < 0 DM | 24 | delayed | car (new) | 4870 | < 100 DM | 1 - 4 yrs | 3 | single male | none | 4 | unknown/none | 53 | none | for free | 2 | No | 2 | none | yes | skilled employee |
| unknown | 36 | repaid | education | 9055 | unknown | 1 - 4 yrs | 2 | single male | none | 4 | unknown/none | 35 | none | for free | 1 | Yes | 2 | yes | yes | unskilled resident |
| unknown | 24 | repaid | furniture | 2835 | 501 - 1000 DM | > 7 yrs | 3 | single male | none | 4 | building society savings | 53 | none | own | 1 | Yes | 1 | none | yes | skilled employee |
| 1 - 200 DM | 36 | repaid | car (used) | 6948 | < 100 DM | 1 - 4 yrs | 2 | single male | none | 2 | other | 35 | none | rent | 1 | Yes | 1 | yes | yes | mangement self-employed |
| unknown | 12 | repaid | radio/tv | 3059 | > 1000 DM | 4 - 7 yrs | 2 | divorced male | none | 4 | real estate | 61 | none | own | 1 | Yes | 1 | none | yes | unskilled resident |
| 1 - 200 DM | 30 | critical | car (new) | 5234 | < 100 DM | unemployed | 4 | married male | none | 2 | other | 28 | none | own | 2 | No | 1 | none | yes | mangement self-employed |
| 1 - 200 DM | 12 | repaid | car (new) | 1295 | < 100 DM | 0 - 1 yrs | 3 | female | none | 1 | other | 25 | none | rent | 1 | No | 1 | none | yes | skilled employee |
| < 0 DM | 48 | repaid | business | 4308 | < 100 DM | 0 - 1 yrs | 3 | female | none | 4 | building society savings | 24 | none | rent | 1 | No | 1 | none | yes | skilled employee |
| 1 - 200 DM | 12 | repaid | radio/tv | 1567 | < 100 DM | 1 - 4 yrs | 1 | female | none | 1 | other | 22 | none | own | 1 | Yes | 1 | yes | yes | skilled employee |
| < 0 DM | 24 | critical | car (new) | 1199 | < 100 DM | > 7 yrs | 4 | single male | none | 4 | other | 60 | none | own | 2 | No | 1 | none | yes | unskilled resident |
| < 0 DM | 15 | repaid | car (new) | 1403 | < 100 DM | 1 - 4 yrs | 2 | female | none | 4 | other | 28 | none | rent | 1 | Yes | 1 | none | yes | skilled employee |
Randomly Splitting the Data into Training, Validation and Test Sets
set.seed(2020)
trainInd = sample(nrow(credit.df), 0.8*nrow(credit.df))
credit.train = credit.df[trainInd,]
testvalCredit = credit.df[-trainInd,]
set.seed(2020)
valInd = sample(nrow(testvalCredit), 0.5*nrow(testvalCredit))
credit.val = testvalCredit[valInd,]
credit.test= testvalCredit[-valInd,]Check the quality of the split
prop.table(table(credit.train$default))##
## Yes No
## 0.6975 0.3025
prop.table(table(credit.val$default))##
## Yes No
## 0.75 0.25
prop.table(table(credit.test$default))##
## Yes No
## 0.67 0.33
Modeling our Decision Tree
library(C50)
credit.fit = C5.0(credit.train[-17], credit.train$default)
credit.fit##
## Call:
## C5.0.default(x = credit.train[-17], y = credit.train$default)
##
## Classification Tree
## Number of samples: 800
## Number of predictors: 20
##
## Tree size: 58
##
## Non-standard options: attempt to group attributes
Visualize Decision Tree
credit.fit.sample = C5.0(credit.train[,c('checking_balance',
'months_loan_duration',
'amount')], credit.train$default)
plot(credit.fit.sample, type='simple')summary(credit.fit)##
## Call:
## C5.0.default(x = credit.train[-17], y = credit.train$default)
##
##
## C5.0 [Release 2.07 GPL Edition] Wed Nov 18 17:27:59 2020
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 800 cases (21 attributes) from undefined.data
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}: Yes (367/50)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...months_loan_duration <= 11:
## :...property in {other,real estate}: Yes (51/6)
## : property = building society savings:
## : :...age <= 32: No (6/2)
## : : age > 32: Yes (9)
## : property = unknown/none:
## : :...residence_history <= 3: No (3)
## : residence_history > 3:
## : :...personal_status in {married male,divorced male}: Yes (0)
## : personal_status = female: No (1)
## : personal_status = single male:
## : :...housing = own: No (1)
## : housing in {rent,for free}: Yes (3)
## months_loan_duration > 11:
## :...checking_balance = 1 - 200 DM:
## :...amount > 12204: No (10)
## : amount <= 12204:
## : :...savings_balance in {unknown,> 1000 DM}: Yes (37/5)
## : savings_balance in {< 100 DM,101 - 500 DM,501 - 1000 DM}:
## : :...months_loan_duration <= 22:
## : :...telephone = yes:
## : : :...savings_balance in {< 100 DM,
## : : : : 501 - 1000 DM}: Yes (20/1)
## : : : savings_balance = 101 - 500 DM: No (3/1)
## : : telephone = none:
## : : :...amount > 1961: Yes (11)
## : : amount <= 1961:
## : : :...other_debtors in {co-applicant,
## : : : guarantor}: Yes (7/1)
## : : other_debtors = none:
## : : :...residence_history <= 2: No (8)
## : : residence_history > 2: [S1]
## : months_loan_duration > 22:
## : :...other_debtors in {co-applicant,guarantor}: No (7)
## : other_debtors = none:
## : :...personal_status = married male: No (5/1)
## : personal_status = female:
## : :...existing_credits <= 1: No (15/4)
## : : existing_credits > 1: Yes (5/1)
## : personal_status = divorced male:
## : :...savings_balance in {< 100 DM,
## : : : 501 - 1000 DM}: No (3)
## : : savings_balance = 101 - 500 DM: Yes (1)
## : personal_status = single male:
## : :...job in {mangement self-employed,
## : : unemployed non-resident}: Yes (5)
## : job = unskilled resident: No (7/2)
## : job = skilled employee:
## : :...dependents > 1: No (2)
## : dependents <= 1:
## : :...age > 45: No (2)
## : age <= 45: [S2]
## checking_balance = < 0 DM:
## :...months_loan_duration > 45: No (14/1)
## months_loan_duration <= 45:
## :...other_debtors = guarantor:
## :...installment_plan in {none,stores}: Yes (9)
## : installment_plan = bank: No (3/1)
## other_debtors in {none,co-applicant}:
## :...job = mangement self-employed:
## :...savings_balance in {< 100 DM,101 - 500 DM,
## : : 501 - 1000 DM,
## : : > 1000 DM}: Yes (21/4)
## : savings_balance = unknown: No (4/1)
## job in {skilled employee,unskilled resident,
## : unemployed non-resident}:
## :...foreign_worker = no: Yes (4)
## foreign_worker = yes:
## :...purpose in {radio/tv,others,
## : domestic appliances}: No (30/9)
## purpose = retraining: Yes (2/1)
## purpose = car (used):
## :...amount <= 7174: Yes (5/1)
## : amount > 7174: No (2)
## purpose = business:
## :...housing in {own,for free}: Yes (6/1)
## : housing = rent: No (1)
## purpose = repairs:
## :...other_debtors = none: No (3)
## : other_debtors = co-applicant: Yes (1)
## purpose = education:
## :...savings_balance in {< 100 DM,101 - 500 DM,
## : : 501 - 1000 DM,
## : : > 1000 DM}: No (5)
## : savings_balance = unknown: Yes (2)
## purpose = car (new):
## :...savings_balance = 101 - 500 DM: Yes (1)
## : savings_balance in {unknown,501 - 1000 DM,
## : : > 1000 DM}: No (4)
## : savings_balance = < 100 DM: [S3]
## purpose = furniture:
## :...installment_plan = stores: Yes (2)
## installment_plan = bank: No (7/1)
## installment_plan = none: [S4]
##
## SubTree [S1]
##
## installment_plan in {none,stores}: Yes (8/2)
## installment_plan = bank: No (2)
##
## SubTree [S2]
##
## months_loan_duration <= 45: Yes (11)
## months_loan_duration > 45: No (3/1)
##
## SubTree [S3]
##
## personal_status in {single male,female,divorced male}: No (28/3)
## personal_status = married male: Yes (2)
##
## SubTree [S4]
##
## savings_balance in {101 - 500 DM,unknown,501 - 1000 DM}: No (4)
## savings_balance = > 1000 DM: Yes (1)
## savings_balance = < 100 DM:
## :...months_loan_duration <= 15: Yes (10/2)
## months_loan_duration > 15:
## :...residence_history <= 3: No (7/1)
## residence_history > 3:
## :...amount <= 3441: No (6/1)
## amount > 3441: Yes (3)
##
##
## Evaluation on training data (800 cases):
##
## Decision Tree
## ----------------
## Size Errors
##
## 57 104(13.0%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 529 29 (a): class Yes
## 75 167 (b): class No
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 54.13% months_loan_duration
## 33.00% other_debtors
## 32.50% savings_balance
## 23.88% job
## 23.50% amount
## 17.00% foreign_worker
## 16.50% purpose
## 11.75% personal_status
## 9.25% property
## 7.75% installment_plan
## 7.38% telephone
## 5.25% residence_history
## 3.88% age
## 2.50% existing_credits
## 2.25% dependents
## 1.38% housing
##
##
## Time: 0.0 secs
The above output is the decision tree to determine whether or not a loan applicant is worthy of receiving a loan. It also shows which features are most important in determining which factors are most important when considering loan applications.
Predict on the Training, Validation and Test Data Sets
predict.train = predict(credit.fit, newdata = credit.train, type="prob")
predict.val = predict(credit.fit, newdata = credit.val, type="prob")
predict.test = predict(credit.fit, newdata = credit.test, type="prob")Accuracy and ROC on Training Data Set
library(Metrics)
accuracy(credit.train$default, ifelse(predict.train[,1]>0.5, 'Yes', 'No'))## [1] 0.87
library(ROCR)
ROCRpred = prediction(predict.train[,1], credit.train$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)Accuracy and ROC on Validation Data Set
accuracy(credit.val$default, ifelse(predict.val[,1]>0.5, 'Yes', 'No'))## [1] 0.78
ROCRpred = prediction(predict.val[,1], credit.val$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)Accuracy and ROC on Testing Data Set
accuracy(credit.test$default, ifelse(predict.test[,1]>0.5, 'Yes', 'No'))## [1] 0.78
ROCRpred = prediction(predict.test[,1], credit.test$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)Modeling our Decision Tree with 10 trials
library(C50)
credit.fit.boost = C5.0(credit.train[-17], credit.train$default, trials=10)
credit.fit.boost##
## Call:
## C5.0.default(x = credit.train[-17], y = credit.train$default, trials = 10)
##
## Classification Tree
## Number of samples: 800
## Number of predictors: 20
##
## Number of boosting iterations: 10
## Average tree size: 45.8
##
## Non-standard options: attempt to group attributes
summary(credit.fit.boost)##
## Call:
## C5.0.default(x = credit.train[-17], y = credit.train$default, trials = 10)
##
##
## C5.0 [Release 2.07 GPL Edition] Wed Nov 18 17:28:00 2020
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 800 cases (21 attributes) from undefined.data
##
## ----- Trial 0: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}: Yes (367/50)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...months_loan_duration <= 11:
## :...property in {other,real estate}: Yes (51/6)
## : property = building society savings:
## : :...age <= 32: No (6/2)
## : : age > 32: Yes (9)
## : property = unknown/none:
## : :...residence_history <= 3: No (3)
## : residence_history > 3:
## : :...personal_status in {married male,divorced male}: Yes (0)
## : personal_status = female: No (1)
## : personal_status = single male:
## : :...housing = own: No (1)
## : housing in {rent,for free}: Yes (3)
## months_loan_duration > 11:
## :...checking_balance = 1 - 200 DM:
## :...amount > 12204: No (10)
## : amount <= 12204:
## : :...savings_balance in {unknown,> 1000 DM}: Yes (37/5)
## : savings_balance in {< 100 DM,101 - 500 DM,501 - 1000 DM}:
## : :...months_loan_duration <= 22:
## : :...telephone = yes:
## : : :...savings_balance in {< 100 DM,
## : : : : 501 - 1000 DM}: Yes (20/1)
## : : : savings_balance = 101 - 500 DM: No (3/1)
## : : telephone = none:
## : : :...amount > 1961: Yes (11)
## : : amount <= 1961:
## : : :...other_debtors in {co-applicant,
## : : : guarantor}: Yes (7/1)
## : : other_debtors = none:
## : : :...residence_history <= 2: No (8)
## : : residence_history > 2: [S1]
## : months_loan_duration > 22:
## : :...other_debtors in {co-applicant,guarantor}: No (7)
## : other_debtors = none:
## : :...personal_status = married male: No (5/1)
## : personal_status = female:
## : :...existing_credits <= 1: No (15/4)
## : : existing_credits > 1: Yes (5/1)
## : personal_status = divorced male:
## : :...savings_balance in {< 100 DM,
## : : : 501 - 1000 DM}: No (3)
## : : savings_balance = 101 - 500 DM: Yes (1)
## : personal_status = single male:
## : :...job in {mangement self-employed,
## : : unemployed non-resident}: Yes (5)
## : job = unskilled resident: No (7/2)
## : job = skilled employee:
## : :...dependents > 1: No (2)
## : dependents <= 1:
## : :...age > 45: No (2)
## : age <= 45: [S2]
## checking_balance = < 0 DM:
## :...months_loan_duration > 45: No (14/1)
## months_loan_duration <= 45:
## :...other_debtors = guarantor:
## :...installment_plan in {none,stores}: Yes (9)
## : installment_plan = bank: No (3/1)
## other_debtors in {none,co-applicant}:
## :...job = mangement self-employed:
## :...savings_balance in {< 100 DM,101 - 500 DM,
## : : 501 - 1000 DM,
## : : > 1000 DM}: Yes (21/4)
## : savings_balance = unknown: No (4/1)
## job in {skilled employee,unskilled resident,
## : unemployed non-resident}:
## :...foreign_worker = no: Yes (4)
## foreign_worker = yes:
## :...purpose in {radio/tv,others,
## : domestic appliances}: No (30/9)
## purpose = retraining: Yes (2/1)
## purpose = car (used):
## :...amount <= 7174: Yes (5/1)
## : amount > 7174: No (2)
## purpose = business:
## :...housing in {own,for free}: Yes (6/1)
## : housing = rent: No (1)
## purpose = repairs:
## :...other_debtors = none: No (3)
## : other_debtors = co-applicant: Yes (1)
## purpose = education:
## :...savings_balance in {< 100 DM,101 - 500 DM,
## : : 501 - 1000 DM,
## : : > 1000 DM}: No (5)
## : savings_balance = unknown: Yes (2)
## purpose = car (new):
## :...savings_balance = 101 - 500 DM: Yes (1)
## : savings_balance in {unknown,501 - 1000 DM,
## : : > 1000 DM}: No (4)
## : savings_balance = < 100 DM: [S3]
## purpose = furniture:
## :...installment_plan = stores: Yes (2)
## installment_plan = bank: No (7/1)
## installment_plan = none: [S4]
##
## SubTree [S1]
##
## installment_plan in {none,stores}: Yes (8/2)
## installment_plan = bank: No (2)
##
## SubTree [S2]
##
## months_loan_duration <= 45: Yes (11)
## months_loan_duration > 45: No (3/1)
##
## SubTree [S3]
##
## personal_status in {single male,female,divorced male}: No (28/3)
## personal_status = married male: Yes (2)
##
## SubTree [S4]
##
## savings_balance in {101 - 500 DM,unknown,501 - 1000 DM}: No (4)
## savings_balance = > 1000 DM: Yes (1)
## savings_balance = < 100 DM:
## :...months_loan_duration <= 15: Yes (10/2)
## months_loan_duration > 15:
## :...residence_history <= 3: No (7/1)
## residence_history > 3:
## :...amount <= 3441: No (6/1)
## amount > 3441: Yes (3)
##
## ----- Trial 1: -----
##
## Decision tree:
##
## months_loan_duration <= 7:
## :...amount <= 3380: Yes (53.7/1.6)
## : amount > 3380: No (10.4/3.9)
## months_loan_duration > 7:
## :...installment_plan in {stores,bank}:
## :...residence_history <= 1:
## : :...age <= 49: Yes (17.5/0.8)
## : : age > 49: No (3.2)
## : residence_history > 1:
## : :...residence_history <= 2: No (62.5/14.2)
## : residence_history > 2:
## : :...foreign_worker = no: Yes (3.2)
## : foreign_worker = yes:
## : :...amount <= 1113: No (15.2/0.8)
## : amount > 1113:
## : :...personal_status in {single male,married male,
## : : divorced male}: Yes (46.7/15.9)
## : personal_status = female: No (15.9/5.5)
## installment_plan = none:
## :...checking_balance = unknown:
## :...other_debtors in {co-applicant,guarantor}: No (17.6/7.9)
## : other_debtors = none:
## : :...age <= 31:
## : :...months_loan_duration <= 15: Yes (27.6/2.4)
## : : months_loan_duration > 15:
## : : :...property = building society savings: Yes (9.4)
## : : property in {other,unknown/none,real estate}:
## : : :...purpose in {car (used),radio/tv,
## : : : retraining}: Yes (16.6/2.4)
## : : purpose in {car (new),business,furniture,others,
## : : repairs,domestic appliances,
## : : education}: No (26.5/4.7)
## : age > 31:
## : :...existing_credits <= 1: Yes (57.5)
## : existing_credits > 1:
## : :...credit_history in {critical,fully repaid this bank,
## : : fully repaid}: Yes (38.6)
## : credit_history in {repaid,delayed}:
## : :...savings_balance in {< 100 DM,101 - 500 DM,
## : : 501 - 1000 DM}: Yes (8.7)
## : savings_balance in {unknown,
## : > 1000 DM}: No (11.3/1.6)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...credit_history in {fully repaid this bank,
## : fully repaid}: No (29.4/6.4)
## credit_history in {critical,repaid,delayed}:
## :...existing_credits > 1: Yes (89.7/28.6)
## existing_credits <= 1:
## :...other_debtors = guarantor: Yes (11.8/0.8)
## other_debtors in {none,co-applicant}:
## :...savings_balance in {501 - 1000 DM,
## : > 1000 DM}: Yes (16.7/3.2)
## savings_balance in {< 100 DM,101 - 500 DM,unknown}:
## :...credit_history in {critical,
## : delayed}: Yes (31/12)
## credit_history = repaid:
## :...purpose in {car (used),business,others,
## : education}: Yes (33.3/14.3)
## purpose in {car (new),repairs,
## : domestic appliances,
## : retraining}: No (50.8/15.9)
## purpose = furniture:
## :...checking_balance in {< 0 DM,
## : : 1 - 200 DM}: No (40.5/15)
## : checking_balance = > 200 DM: Yes (4.7)
## purpose = radio/tv:
## :...employment_length = > 7 yrs: Yes (9.6)
## employment_length in {4 - 7 yrs,unemployed,
## : 1 - 4 yrs,0 - 1 yrs}: [S1]
##
## SubTree [S1]
##
## savings_balance in {101 - 500 DM,unknown}: No (10.4/0.8)
## savings_balance = < 100 DM:
## :...job in {mangement self-employed,unemployed non-resident}: Yes (4.8)
## job in {skilled employee,unskilled resident}:
## :...employment_length in {4 - 7 yrs,1 - 4 yrs}: Yes (16.7/5.6)
## employment_length in {unemployed,0 - 1 yrs}: No (8.8)
##
## ----- Trial 2: -----
##
## Decision tree:
##
## months_loan_duration <= 7: Yes (58.1/8.2)
## months_loan_duration > 7:
## :...checking_balance = unknown:
## :...installment_plan = none: Yes (191.8/39.8)
## : installment_plan in {stores,bank}:
## : :...purpose in {others,repairs,domestic appliances,
## : : retraining}: No (0)
## : purpose in {car (used),radio/tv,furniture}: Yes (33.4/9.9)
## : purpose in {car (new),business,education}:
## : :...age <= 45: No (34.9/4.9)
## : age > 45: Yes (3.4)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...property = unknown/none:
## :...job in {skilled employee,unskilled resident}: No (53.2/13.1)
## : job = unemployed non-resident: Yes (6.9/2.1)
## : job = mangement self-employed:
## : :...housing in {own,rent}: No (13/2)
## : housing = for free:
## : :...amount <= 12204: Yes (18.3/4.7)
## : amount > 12204: No (4.3)
## property in {other,building society savings,real estate}:
## :...savings_balance in {unknown,> 1000 DM}: Yes (54.3/13.2)
## savings_balance = 501 - 1000 DM: No (14.1/6.5)
## savings_balance = 101 - 500 DM:
## :...housing = for free: Yes (0)
## : housing = rent: No (8.8/2.6)
## : housing = own:
## : :...age <= 24: No (3.8/0.6)
## : age > 24: Yes (20.5/1.9)
## savings_balance = < 100 DM:
## :...purpose in {car (used),repairs,retraining}: Yes (16.8/4.7)
## purpose in {others,domestic appliances,
## : education}: No (20.1/4.5)
## purpose = business:
## :...personal_status = married male: Yes (3.4)
## : personal_status in {single male,female,divorced male}:
## : :...residence_history <= 1: Yes (9.5/2)
## : residence_history > 1: No (21.1/2.6)
## purpose = radio/tv:
## :...employment_length = > 7 yrs: Yes (13.7/0.6)
## : employment_length in {4 - 7 yrs,unemployed,1 - 4 yrs,
## : : 0 - 1 yrs}:
## : :...months_loan_duration > 14: No (37.4/9.9)
## : months_loan_duration <= 14:
## : :...other_debtors in {co-applicant,
## : : guarantor}: Yes (4.5)
## : other_debtors = none:
## : :...employment_length in {4 - 7 yrs,unemployed,
## : : 1 - 4 yrs}: Yes (18.2/4.4)
## : employment_length = 0 - 1 yrs: No (6.1)
## purpose = car (new):
## :...months_loan_duration > 22: No (11.7)
## : months_loan_duration <= 22:
## : :...other_debtors = co-applicant: No (3)
## : other_debtors in {none,guarantor}:
## : :...installment_plan = stores: Yes (0)
## : installment_plan = bank: No (6.5/1.3)
## : installment_plan = none:
## : :...personal_status in {single male,married male,
## : : female}: Yes (33.7/8.6)
## : personal_status = divorced male: No (4.7/0.6)
## purpose = furniture:
## :...other_debtors in {co-applicant,guarantor}: Yes (9.2/0.6)
## other_debtors = none:
## :...housing = for free: No (0)
## housing = rent: Yes (17.4/6)
## housing = own:
## :...telephone = yes: Yes (12.4/4.9)
## telephone = none:
## :...age <= 28: Yes (15.6/4.7)
## age > 28: No (16.2/0.6)
##
## ----- Trial 3: -----
##
## Decision tree:
##
## checking_balance = < 0 DM:
## :...credit_history in {fully repaid this bank,delayed,fully repaid}:
## : :...age <= 23: Yes (5)
## : : age > 23: No (37.8/3.8)
## : credit_history in {critical,repaid}:
## : :...purpose in {car (used),business,others}: Yes (29.1/11.5)
## : purpose in {repairs,domestic appliances,education,
## : : retraining}: No (22.7/4.4)
## : purpose = radio/tv:
## : :...months_loan_duration <= 33: Yes (38.2/10.8)
## : : months_loan_duration > 33: No (4.4)
## : purpose = car (new):
## : :...dependents > 1: Yes (9.3/2)
## : : dependents <= 1:
## : : :...employment_length in {4 - 7 yrs,1 - 4 yrs,> 7 yrs,
## : : : 0 - 1 yrs}: No (43.3/11)
## : : employment_length = unemployed: Yes (3.1)
## : purpose = furniture:
## : :...personal_status = married male: Yes (1.6)
## : personal_status = divorced male: No (4.7)
## : personal_status in {single male,female}:
## : :...other_debtors in {co-applicant,guarantor}: Yes (7.7/1.4)
## : other_debtors = none:
## : :...job = mangement self-employed: Yes (7.3/2.8)
## : job in {unskilled resident,
## : : unemployed non-resident}: No (3.4/0.5)
## : job = skilled employee:
## : :...employment_length in {4 - 7 yrs,unemployed,1 - 4 yrs,
## : : > 7 yrs}: No (24.2/7.5)
## : employment_length = 0 - 1 yrs: Yes (8)
## checking_balance in {unknown,1 - 200 DM,> 200 DM}:
## :...amount > 9566:
## :...credit_history in {critical,repaid}: No (23.1/1.6)
## : credit_history in {fully repaid this bank,delayed,
## : fully repaid}: Yes (11.9/4.9)
## amount <= 9566:
## :...purpose in {car (used),others,domestic appliances,
## : retraining}: Yes (50.5/5.4)
## purpose in {radio/tv,car (new),business,furniture,repairs,education}:
## :...employment_length in {4 - 7 yrs,> 7 yrs}:
## :...dependents <= 1:
## : :...savings_balance in {unknown,501 - 1000 DM,
## : : : > 1000 DM}: Yes (50.7/5.6)
## : : savings_balance in {< 100 DM,101 - 500 DM}:
## : : :...personal_status in {single male,married male,
## : : : female}: Yes (96.6/22.5)
## : : personal_status = divorced male: No (8.4/2)
## : dependents > 1:
## : :...amount <= 1344: No (15.7/1.6)
## : amount > 1344:
## : :...credit_history in {critical,repaid}: Yes (14)
## : credit_history in {fully repaid this bank,delayed,
## : fully repaid}: No (7.9/2.1)
## employment_length in {unemployed,1 - 4 yrs,0 - 1 yrs}:
## :...other_debtors = guarantor: Yes (16.8/4.5)
## other_debtors = co-applicant: No (13.2/1.7)
## other_debtors = none:
## :...housing = for free: Yes (15.2/5.1)
## housing = rent:
## :...installment_plan in {stores,bank}: No (7.7/0.5)
## : installment_plan = none:
## : :...months_loan_duration <= 15: Yes (15.1/3.2)
## : months_loan_duration > 15: No (16.7/3.2)
## housing = own:
## :...job = mangement self-employed:
## :...installment_plan in {none,stores}: No (26.9/7)
## : installment_plan = bank: Yes (2.3)
## job in {skilled employee,unskilled resident,
## : unemployed non-resident}:
## :...employment_length = unemployed: Yes (4.4)
## employment_length in {1 - 4 yrs,0 - 1 yrs}:
## :...savings_balance = > 1000 DM: Yes (8.2)
## savings_balance in {< 100 DM,101 - 500 DM,
## : unknown,501 - 1000 DM}: [S1]
##
## SubTree [S1]
##
## personal_status = divorced male: Yes (7.8/1.6)
## personal_status = married male:
## :...telephone = yes: No (9.2/3.1)
## : telephone = none: Yes (11.8/1.7)
## personal_status = single male:
## :...savings_balance in {101 - 500 DM,unknown}: Yes (13.8/1.2)
## : savings_balance = 501 - 1000 DM: No (6.9/1.6)
## : savings_balance = < 100 DM:
## : :...purpose in {radio/tv,car (new),furniture,repairs,
## : : education}: Yes (23.2/6.5)
## : purpose = business: No (5)
## personal_status = female:
## :...property in {other,unknown/none}: Yes (25.5/7)
## property in {building society savings,real estate}:
## :...age <= 32: No (36.8/8.5)
## age > 32: Yes (4.8)
##
## ----- Trial 4: -----
##
## Decision tree:
##
## months_loan_duration <= 8:
## :...existing_credits > 1: Yes (19.4)
## : existing_credits <= 1:
## : :...amount > 4057: No (4.6)
## : amount <= 4057:
## : :...personal_status in {single male,married male}: Yes (21)
## : personal_status in {female,divorced male}:
## : :...residence_history <= 3: Yes (11.8/1.9)
## : residence_history > 3: No (7.6/1.3)
## months_loan_duration > 8:
## :...checking_balance = unknown:
## :...foreign_worker = no: Yes (6.3)
## : foreign_worker = yes:
## : :...installment_plan = bank: No (50.6/19.6)
## : installment_plan in {none,stores}:
## : :...credit_history in {critical,
## : : fully repaid this bank}: Yes (60.9/7.1)
## : credit_history in {repaid,delayed,fully repaid}:
## : :...purpose in {car (used),others,domestic appliances,
## : : retraining}: Yes (11.7)
## : purpose in {repairs,education}: No (9.3/1.4)
## : purpose = car (new):
## : :...telephone = yes: Yes (9.7)
## : : telephone = none: No (15.6/4.4)
## : purpose = business:
## : :...amount <= 8487: Yes (16.3/5.8)
## : : amount > 8487: No (3.6)
## : purpose = furniture:
## : :...residence_history <= 2: No (15.6/3)
## : : residence_history > 2: Yes (4.2)
## : purpose = radio/tv:
## : :...existing_credits > 1: No (10.4/2.1)
## : existing_credits <= 1:
## : :...employment_length in {4 - 7 yrs,1 - 4 yrs,> 7 yrs,
## : : 0 - 1 yrs}: Yes (22.5)
## : employment_length = unemployed: No (2.3)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...months_loan_duration > 42:
## :...savings_balance in {< 100 DM,101 - 500 DM,501 - 1000 DM,
## : : > 1000 DM}: No (44.4/5.3)
## : savings_balance = unknown: Yes (5.8)
## months_loan_duration <= 42:
## :...amount > 1361:
## :...savings_balance in {101 - 500 DM,501 - 1000 DM,
## : : > 1000 DM}: Yes (50.3/13.7)
## : savings_balance = unknown:
## : :...credit_history in {critical,delayed,
## : : : fully repaid}: Yes (10.8)
## : : credit_history in {repaid,fully repaid this bank}:
## : : :...months_loan_duration <= 10: Yes (3)
## : : months_loan_duration > 10: No (26.9/11)
## : savings_balance = < 100 DM:
## : :...amount > 7596: No (19.7/3.4)
## : amount <= 7596:
## : :...foreign_worker = no: Yes (5.8/0.4)
## : foreign_worker = yes:
## : :...credit_history in {fully repaid this bank,delayed}:
## : :...installment_rate <= 1: Yes (4.1)
## : : installment_rate > 1: No (26.3/3.3)
## : credit_history in {critical,repaid,fully repaid}:
## : :...purpose in {car (used),business,furniture,
## : : others,repairs,domestic appliances,
## : : retraining}: Yes (88.1/27.6)
## : purpose = education: No (8.7/2.3)
## : purpose = car (new):
## : :...installment_rate <= 2: Yes (12.3/1.3)
## : : installment_rate > 2: No (18.1/5.6)
## : purpose = radio/tv: [S1]
## amount <= 1361:
## :...amount <= 585: Yes (8.9)
## amount > 585:
## :...property in {other,unknown/none}: No (49.4/3.6)
## property in {building society savings,real estate}:
## :...telephone = yes: Yes (5.7/0.4)
## telephone = none:
## :...months_loan_duration > 18: No (7.5)
## months_loan_duration <= 18:
## :...dependents > 1: Yes (3.8)
## dependents <= 1:
## :...installment_rate <= 2: Yes (3.9/1)
## installment_rate > 2:
## :...installment_rate <= 3: No (7.6/0.8)
## installment_rate > 3: [S2]
##
## SubTree [S1]
##
## employment_length in {4 - 7 yrs,> 7 yrs}: Yes (15.6/2)
## employment_length = unemployed: No (2.4)
## employment_length in {1 - 4 yrs,0 - 1 yrs}:
## :...job = mangement self-employed: Yes (5.9)
## job in {skilled employee,unskilled resident,
## unemployed non-resident}: No (28.6/7.9)
##
## SubTree [S2]
##
## months_loan_duration > 13: Yes (3.5/1)
## months_loan_duration <= 13:
## :...other_debtors = co-applicant: No (0)
## other_debtors = guarantor: Yes (1.3)
## other_debtors = none:
## :...months_loan_duration <= 11: Yes (4.3/0.4)
## months_loan_duration > 11: No (23.9/6.7)
##
## ----- Trial 5: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...foreign_worker = no: Yes (7.1)
## : foreign_worker = yes:
## : :...employment_length in {unemployed,1 - 4 yrs,0 - 1 yrs}:
## : :...installment_plan = stores: No (14.7/4.5)
## : : installment_plan = bank:
## : : :...purpose in {car (used),car (new),business,furniture,others,
## : : : : repairs,domestic appliances,
## : : : : retraining}: No (19.5/3.9)
## : : : purpose in {radio/tv,education}: Yes (8)
## : : installment_plan = none:
## : : :...other_debtors in {co-applicant,guarantor}: No (11.9/3.6)
## : : other_debtors = none:
## : : :...dependents > 1: Yes (6.5)
## : : dependents <= 1:
## : : :...amount <= 4530: Yes (97/25)
## : : amount > 4530: No (18.5/4.2)
## : employment_length in {4 - 7 yrs,> 7 yrs}:
## : :...other_debtors in {co-applicant,guarantor}: Yes (7.5)
## : other_debtors = none:
## : :...months_loan_duration > 30: Yes (19.6)
## : months_loan_duration <= 30:
## : :...credit_history = delayed: No (9.2/1.8)
## : credit_history in {critical,repaid,fully repaid this bank,
## : : fully repaid}:
## : :...age > 41: Yes (34.6/1.1)
## : age <= 41:
## : :...housing = for free: No (4.5/0.3)
## : housing = rent: Yes (11.7)
## : housing = own:
## : :...existing_credits > 1: No (18.5/6.4)
## : existing_credits <= 1:
## : :...amount <= 797: No (3.2/0.3)
## : amount > 797: Yes (23.8)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...savings_balance in {unknown,> 1000 DM}: Yes (68.7/23)
## savings_balance in {< 100 DM,101 - 500 DM,501 - 1000 DM}:
## :...months_loan_duration > 45: No (36.2/7.4)
## months_loan_duration <= 45:
## :...purpose in {others,repairs,domestic appliances,
## : retraining}: Yes (28.3/10.1)
## purpose = education: No (17.6/3.9)
## purpose = radio/tv:
## :...savings_balance in {< 100 DM,501 - 1000 DM}: Yes (83.1/31.4)
## : savings_balance = 101 - 500 DM: No (9.4/0.9)
## purpose = car (used):
## :...existing_credits > 1: Yes (4.8)
## : existing_credits <= 1:
## : :...installment_rate <= 1: Yes (4.3)
## : installment_rate > 1: No (16.8/3.9)
## purpose = business:
## :...employment_length in {4 - 7 yrs,0 - 1 yrs}: Yes (10.2)
## : employment_length in {unemployed,1 - 4 yrs,> 7 yrs}:
## : :...months_loan_duration <= 18: Yes (4.7)
## : months_loan_duration > 18: No (15.6/3.3)
## purpose = car (new):
## :...residence_history <= 2: No (26/4.6)
## : residence_history > 2:
## : :...savings_balance = 101 - 500 DM: No (8.1/3.1)
## : savings_balance = 501 - 1000 DM: Yes (0.9)
## : savings_balance = < 100 DM:
## : :...installment_plan = stores: Yes (0)
## : installment_plan = bank: No (9/3.4)
## : installment_plan = none:
## : :...months_loan_duration <= 22: Yes (33.7/7.7)
## : months_loan_duration > 22: No (5.9)
## purpose = furniture:
## :...installment_plan = stores: Yes (4)
## installment_plan in {none,bank}:
## :...other_debtors = guarantor: Yes (3.9)
## other_debtors in {none,co-applicant}:
## :...personal_status = married male: Yes (2.7)
## personal_status = divorced male: No (9.7)
## personal_status in {single male,female}:
## :...months_loan_duration > 27: No (13.3/0.8)
## months_loan_duration <= 27:
## :...property in {other,real estate}: No (35.2/10)
## property = unknown/none: Yes (9.5/4.1)
## property = building society savings:
## :...checking_balance = < 0 DM: Yes (17.1/4.9)
## checking_balance = 1 - 200 DM: No (5.3/0.3)
##
## ----- Trial 6: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...employment_length in {4 - 7 yrs,> 7 yrs}: Yes (102.2/17.2)
## : employment_length = unemployed: No (14.2/6.2)
## : employment_length = 0 - 1 yrs:
## : :...other_debtors = co-applicant: No (3)
## : : other_debtors = guarantor: Yes (1.9)
## : : other_debtors = none:
## : : :...amount <= 5507: Yes (26.7/4.8)
## : : amount > 5507: No (5.6)
## : employment_length = 1 - 4 yrs:
## : :...foreign_worker = no: Yes (3.5)
## : foreign_worker = yes:
## : :...installment_rate <= 1: Yes (13.1/0.9)
## : installment_rate > 1:
## : :...installment_plan in {stores,bank}: No (19.6/6.9)
## : installment_plan = none:
## : :...purpose in {car (used),radio/tv,others,repairs,
## : : domestic appliances,retraining}: Yes (16.7)
## : purpose in {car (new),business,furniture,education}:
## : :...property in {other,
## : : building society savings}: No (23.1/7.2)
## : property in {unknown/none,real estate}: Yes (21.8/6.2)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...credit_history in {fully repaid this bank,fully repaid}: No (71.4/24.2)
## credit_history = delayed:
## :...savings_balance in {101 - 500 DM,unknown,501 - 1000 DM,
## : : > 1000 DM}: Yes (15)
## : savings_balance = < 100 DM:
## : :...installment_rate <= 2: Yes (8.2/0.9)
## : installment_rate > 2: No (13.9/1.7)
## credit_history = critical:
## :...foreign_worker = no: Yes (8.2/1)
## : foreign_worker = yes:
## : :...other_debtors in {co-applicant,guarantor}: No (9.4/2.2)
## : other_debtors = none:
## : :...employment_length in {4 - 7 yrs,unemployed,
## : : 0 - 1 yrs}: Yes (37.2/12.3)
## : employment_length = 1 - 4 yrs:
## : :...dependents <= 1: No (22.5/6)
## : : dependents > 1: Yes (2.7)
## : employment_length = > 7 yrs:
## : :...residence_history <= 3: No (12.8/3.4)
## : residence_history > 3:
## : :...months_loan_duration <= 45: Yes (20.5/2.5)
## : months_loan_duration > 45: No (2.2)
## credit_history = repaid:
## :...other_debtors = guarantor: Yes (15.4/2.9)
## other_debtors in {none,co-applicant}:
## :...amount > 7721: No (28.1/3.3)
## amount <= 7721:
## :...job in {mangement self-employed,unemployed non-resident}:
## :...installment_plan in {none,bank}: Yes (43.9/9)
## : installment_plan = stores: No (2.6)
## job in {skilled employee,unskilled resident}:
## :...other_debtors = co-applicant: No (10/2)
## other_debtors = none:
## :...purpose in {car (used),business,
## : education}: Yes (31.7/11.8)
## purpose in {others,repairs,domestic appliances,
## : retraining}: No (16.4/4.7)
## purpose = radio/tv:
## :...property = other: Yes (33.4/11.4)
## : property in {building society savings,unknown/none,
## : real estate}: No (37.9/9)
## purpose = car (new):
## :...personal_status = married male: Yes (6.5/2.5)
## : personal_status in {female,
## : : divorced male}: No (22.8/4.2)
## : personal_status = single male:
## : :...telephone = yes: Yes (6.5)
## : telephone = none: No (13.2/4.7)
## purpose = furniture:
## :...housing = for free: Yes (4.2)
## housing in {own,rent}:
## :...checking_balance = 1 - 200 DM: No (17.6/3.8)
## checking_balance = > 200 DM: Yes (2.5)
## checking_balance = < 0 DM:
## :...months_loan_duration > 27: No (7.4)
## months_loan_duration <= 27:
## :...age <= 23: No (9.3/2.9)
## age > 23: Yes (15.1/1.9)
##
## ----- Trial 7: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...foreign_worker = no: Yes (5.5)
## : foreign_worker = yes:
## : :...purpose in {car (used),furniture,others,domestic appliances,
## : : retraining}: Yes (71.1/15.3)
## : purpose = repairs: No (7.3/1.9)
## : purpose = education:
## : :...months_loan_duration <= 15: Yes (9.3/1.6)
## : : months_loan_duration > 15: No (10.9/1.6)
## : purpose = business:
## : :...job in {mangement self-employed,
## : : : unemployed non-resident}: No (11.2/3.1)
## : : job = unskilled resident: Yes (7.7/1.6)
## : : job = skilled employee:
## : : :...checking_balance = > 200 DM: Yes (3.8)
## : : checking_balance = unknown:
## : : :...personal_status in {single male,female}: Yes (13.5/2.1)
## : : personal_status in {married male,
## : : divorced male}: No (6.5/0.2)
## : purpose = radio/tv:
## : :...installment_rate > 3: Yes (40.3/4.3)
## : : installment_rate <= 3:
## : : :...dependents > 1: Yes (5.4)
## : : dependents <= 1:
## : : :...personal_status in {married male,
## : : : divorced male}: Yes (6.8)
## : : personal_status in {single male,female}:
## : : :...months_loan_duration > 27: Yes (5.3)
## : : months_loan_duration <= 27:
## : : :...months_loan_duration <= 13: Yes (10.3/2.7)
## : : months_loan_duration > 13: No (16.7/2.5)
## : purpose = car (new):
## : :...employment_length in {unemployed,0 - 1 yrs}: Yes (12.6)
## : employment_length in {4 - 7 yrs,1 - 4 yrs,> 7 yrs}:
## : :...months_loan_duration <= 9: Yes (9.3)
## : months_loan_duration > 9:
## : :...other_debtors = co-applicant: Yes (0.5)
## : other_debtors = guarantor: No (1.9)
## : other_debtors = none:
## : :...installment_plan in {stores,bank}: No (16.3/4.1)
## : installment_plan = none:
## : :...housing = own: Yes (17.9/2.7)
## : housing in {rent,for free}: No (13.3/4.3)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...checking_balance = 1 - 200 DM:
## :...credit_history = delayed: Yes (24/4.2)
## : credit_history in {critical,repaid,fully repaid this bank,fully repaid}:
## : :...purpose in {car (used),repairs,domestic appliances,
## : : retraining}: Yes (32.9/8.9)
## : purpose in {others,education}: No (14.9/4.6)
## : purpose = business:
## : :...residence_history <= 3: Yes (17.7/4.2)
## : : residence_history > 3: No (9.9/2.5)
## : purpose = radio/tv:
## : :...employment_length = > 7 yrs: Yes (7.9)
## : : employment_length in {4 - 7 yrs,unemployed,1 - 4 yrs,0 - 1 yrs}:
## : : :...personal_status in {female,divorced male}: Yes (17.6/6.1)
## : : personal_status in {single male,married male}:
## : : :...months_loan_duration <= 10: Yes (5.2)
## : : months_loan_duration > 10: No (28.5/2.1)
## : purpose = car (new):
## : :...other_debtors = co-applicant: Yes (1.3)
## : : other_debtors = guarantor: No (2.9)
## : : other_debtors = none:
## : : :...credit_history = fully repaid: Yes (0)
## : : credit_history = fully repaid this bank: No (2.8)
## : : credit_history in {critical,repaid}:
## : : :...age <= 29: No (19.3/7)
## : : age > 29: Yes (15.4/1.5)
## : purpose = furniture:
## : :...job in {unskilled resident,
## : : unemployed non-resident}: No (4.5)
## : job in {mangement self-employed,skilled employee}:
## : :...other_debtors = guarantor: Yes (0)
## : other_debtors = co-applicant: No (1.7)
## : other_debtors = none:
## : :...existing_credits > 1: Yes (4.1/0.2)
## : existing_credits <= 1:
## : :...installment_rate <= 1: No (4.8)
## : installment_rate > 1:
## : :...age <= 42: Yes (18.3/5.1)
## : age > 42: No (3.4)
## checking_balance = < 0 DM:
## :...foreign_worker = no: Yes (12.9/3.1)
## foreign_worker = yes:
## :...other_debtors in {co-applicant,guarantor}: Yes (24.9/9.4)
## other_debtors = none:
## :...personal_status = divorced male: No (12.7/0.8)
## personal_status in {single male,married male,female}:
## :...residence_history <= 1:
## :...job in {mangement self-employed,skilled employee,
## : : unskilled resident}: Yes (23.7/4.1)
## : job = unemployed non-resident: No (4.5)
## residence_history > 1:
## :...months_loan_duration > 39: No (13.2)
## months_loan_duration <= 39:
## :...purpose in {car (used),furniture,others,repairs,
## : domestic appliances,education,
## : retraining}: No (84.3/31.6)
## purpose = business: Yes (5.3/2.2)
## purpose = radio/tv:
## :...age <= 37: No (24.3/6)
## : age > 37: Yes (10.7/2.8)
## purpose = car (new):
## :...installment_rate <= 2: Yes (14.6/3)
## installment_rate > 2:
## :...months_loan_duration <= 8: Yes (3.3)
## months_loan_duration > 8: No (24.7/6.9)
##
## ----- Trial 8: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...foreign_worker = no: Yes (4.5)
## : foreign_worker = yes:
## : :...employment_length in {4 - 7 yrs,unemployed}: Yes (58.5/15.5)
## : employment_length = > 7 yrs:
## : :...dependents <= 1: Yes (50/9.7)
## : : dependents > 1:
## : : :...amount <= 1262: No (6.5)
## : : amount > 1262: Yes (15.3/3.5)
## : employment_length = 0 - 1 yrs:
## : :...other_debtors = co-applicant: No (4)
## : : other_debtors = guarantor: Yes (2)
## : : other_debtors = none:
## : : :...amount <= 7418: Yes (38.6/16.9)
## : : amount > 7418: No (3.1)
## : employment_length = 1 - 4 yrs:
## : :...residence_history <= 1: Yes (7.1)
## : residence_history > 1:
## : :...months_loan_duration <= 7: Yes (8.6)
## : months_loan_duration > 7:
## : :...installment_plan = stores: No (8.1/1.8)
## : installment_plan in {none,bank}:
## : :...personal_status in {single male,married male,
## : : divorced male}: Yes (49.8/13.7)
## : personal_status = female:
## : :...other_debtors in {co-applicant,
## : : guarantor}: Yes (3.5)
## : other_debtors = none:
## : :...age <= 30: No (24.6/5.4)
## : age > 30: Yes (5.2)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...savings_balance in {501 - 1000 DM,> 1000 DM}: Yes (34.4/13.7)
## savings_balance = 101 - 500 DM:
## :...purpose in {car (used),car (new),business,others,repairs,education,
## : : retraining}: Yes (36.3/8.2)
## : purpose in {radio/tv,furniture,domestic appliances}: No (16.9/1.9)
## savings_balance = unknown:
## :...existing_credits > 1: Yes (12.5/1.1)
## : existing_credits <= 1:
## : :...months_loan_duration > 45: Yes (6.2)
## : months_loan_duration <= 45:
## : :...job = mangement self-employed: No (7.9/0.9)
## : job in {unskilled resident,
## : : unemployed non-resident}: Yes (6.8/1.1)
## : job = skilled employee:
## : :...telephone = yes: Yes (11.9/4)
## : telephone = none: No (15.9/5.8)
## savings_balance = < 100 DM:
## :...months_loan_duration > 45: No (26.2/2.6)
## months_loan_duration <= 45:
## :...personal_status = divorced male:
## :...other_debtors = none: No (20.6/2.1)
## : other_debtors in {co-applicant,guarantor}: Yes (3.6)
## personal_status in {single male,married male,female}:
## :...residence_history <= 2:
## :...months_loan_duration <= 8: Yes (8.1)
## : months_loan_duration > 8:
## : :...purpose in {car (used),business,
## : : retraining}: Yes (20.4/6.7)
## : purpose in {car (new),others,repairs,
## : : domestic appliances,
## : : education}: No (34.1/3.8)
## : purpose = radio/tv:
## : :...job in {mangement self-employed,
## : : : unskilled resident}: Yes (12.9/2.7)
## : : job in {skilled employee,
## : : unemployed non-resident}: No (24.6/5.4)
## : purpose = furniture:
## : :...employment_length in {4 - 7 yrs,
## : : unemployed}: No (6.8)
## : employment_length in {1 - 4 yrs,> 7 yrs,0 - 1 yrs}:
## : :...checking_balance = < 0 DM: Yes (15.7/2.5)
## : checking_balance = 1 - 200 DM: No (10.2/3.8)
## residence_history > 2:
## :...foreign_worker = no: Yes (4.5)
## foreign_worker = yes:
## :...installment_plan = stores: No (10.4/2.8)
## installment_plan = bank:
## :...employment_length in {4 - 7 yrs,1 - 4 yrs,
## : : > 7 yrs}: No (25/6.7)
## : employment_length in {unemployed,
## : 0 - 1 yrs}: Yes (3.7)
## installment_plan = none: [S1]
##
## SubTree [S1]
##
## credit_history in {fully repaid this bank,fully repaid}: No (5.6)
## credit_history in {critical,repaid,delayed}:
## :...installment_rate <= 1: Yes (9.1)
## installment_rate > 1:
## :...checking_balance = 1 - 200 DM: Yes (37.9/7.3)
## checking_balance = < 0 DM:
## :...purpose in {repairs,domestic appliances,education,
## : retraining}: No (9.2/1.3)
## purpose = others: Yes (0.5)
## purpose in {car (used),radio/tv,car (new),business,furniture}:
## :...personal_status = married male: Yes (6)
## personal_status in {single male,female}:
## :...existing_credits > 2: Yes (3.8)
## existing_credits <= 2:
## :...residence_history <= 3: No (17.9/5.4)
## residence_history > 3:
## :...telephone = yes: No (15.2/5)
## telephone = none: Yes (29.8/6.2)
##
## ----- Trial 9: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...purpose in {car (used),radio/tv,others,domestic appliances,
## : : retraining}: Yes (66.1/8.7)
## : purpose in {car (new),business,furniture,repairs,education}:
## : :...employment_length = 4 - 7 yrs: Yes (17.1/2.9)
## : employment_length = unemployed: No (10.8/3.9)
## : employment_length = 0 - 1 yrs:
## : :...credit_history = critical: Yes (3.3)
## : : credit_history in {repaid,fully repaid this bank,delayed,
## : : fully repaid}: No (19.3/2.3)
## : employment_length = > 7 yrs:
## : :...months_loan_duration > 22: Yes (9.3)
## : : months_loan_duration <= 22:
## : : :...property in {other,unknown/none}: No (12.8/1.6)
## : : property in {building society savings,
## : : real estate}: Yes (6.6)
## : employment_length = 1 - 4 yrs:
## : :...months_loan_duration <= 9: Yes (8.2)
## : months_loan_duration > 9:
## : :...installment_plan in {stores,bank}: No (18.8/4.9)
## : installment_plan = none:
## : :...existing_credits > 2: No (2.7)
## : existing_credits <= 2:
## : :...installment_rate <= 3: Yes (20.9/4.1)
## : installment_rate > 3:
## : :...age <= 30: No (17.4/5.9)
## : age > 30: Yes (6.7)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...months_loan_duration > 45:
## :...savings_balance in {< 100 DM,101 - 500 DM,501 - 1000 DM,
## : : > 1000 DM}: No (32.8/3.9)
## : savings_balance = unknown: Yes (6)
## months_loan_duration <= 45:
## :...credit_history = fully repaid:
## :...installment_rate <= 3: Yes (13.3/4.3)
## : installment_rate > 3: No (9.2)
## credit_history = fully repaid this bank:
## :...installment_plan = none: No (15.8)
## : installment_plan in {stores,bank}:
## : :...months_loan_duration <= 9: No (4.9)
## : months_loan_duration > 9: Yes (22.4/6.2)
## credit_history = delayed:
## :...savings_balance in {101 - 500 DM,unknown,501 - 1000 DM,
## : : > 1000 DM}: Yes (8.4)
## : savings_balance = < 100 DM:
## : :...installment_rate <= 1: Yes (4.5)
## : installment_rate > 1:
## : :...months_loan_duration <= 20: Yes (7.4/1.6)
## : months_loan_duration > 20: No (13.3)
## credit_history = critical:
## :...installment_plan = stores: Yes (3.8)
## : installment_plan = bank: No (16.2/6.6)
## : installment_plan = none:
## : :...personal_status = divorced male: No (8.4/2.6)
## : personal_status in {single male,married male,female}:
## : :...checking_balance in {< 0 DM,> 200 DM}: Yes (59.2/16.4)
## : checking_balance = 1 - 200 DM:
## : :...residence_history <= 3: No (23.1/7.5)
## : residence_history > 3: Yes (10)
## credit_history = repaid:
## :...amount > 8065: No (20.7/1.6)
## amount <= 8065:
## :...months_loan_duration <= 7: Yes (15.5/1.3)
## months_loan_duration > 7:
## :...other_debtors = co-applicant: No (11.8/4.1)
## other_debtors = guarantor: Yes (12.8/2.4)
## other_debtors = none:
## :...amount <= 2764:
## :...purpose in {car (used),business,
## : : education}: Yes (19.7/6.5)
## : purpose in {car (new),others,repairs,
## : : domestic appliances,
## : : retraining}: No (50.8/15.8)
## : purpose = radio/tv:
## : :...employment_length in {4 - 7 yrs,
## : : : > 7 yrs}: Yes (15.2/3.6)
## : : employment_length in {unemployed,1 - 4 yrs,
## : : 0 - 1 yrs}: No (48.5/17.9)
## : purpose = furniture:
## : :...checking_balance = 1 - 200 DM: No (14.4/1.6)
## : checking_balance = > 200 DM: Yes (2.2)
## : checking_balance = < 0 DM:
## : :...months_loan_duration <= 15: Yes (11.2/2)
## : months_loan_duration > 15: No (11.9/1.2)
## amount > 2764:
## :...installment_rate <= 2: Yes (40.6/3.4)
## installment_rate > 2:
## :...installment_plan in {stores,
## : bank}: Yes (3.3)
## installment_plan = none:
## :...dependents > 1: No (5.7)
## dependents <= 1:
## :...amount <= 6872: Yes (26.6/7.8)
## amount > 6872: No (3.5)
##
##
## Evaluation on training data (800 cases):
##
## Trial Decision Tree
## ----- ----------------
## Size Errors
##
## 0 57 104(13.0%)
## 1 32 167(20.9%)
## 2 35 146(18.3%)
## 3 45 152(19.0%)
## 4 48 153(19.1%)
## 5 44 171(21.4%)
## 6 43 160(20.0%)
## 7 56 149(18.6%)
## 8 50 128(16.0%)
## 9 48 139(17.4%)
## boost 13( 1.6%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 556 2 (a): class Yes
## 11 231 (b): class No
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 100.00% months_loan_duration
## 99.63% purpose
## 99.00% amount
## 98.00% other_debtors
## 97.00% installment_plan
## 95.00% credit_history
## 87.88% foreign_worker
## 87.13% employment_length
## 83.75% savings_balance
## 82.25% personal_status
## 78.75% existing_credits
## 74.50% property
## 68.75% residence_history
## 64.63% job
## 61.25% age
## 60.88% dependents
## 56.63% installment_rate
## 54.13% housing
## 28.50% telephone
##
##
## Time: 0.0 secs
Predict on the Training, Validation and Test Data Sets with Boosted Deicision Tree
predict.train = predict(credit.fit.boost, newdata = credit.train, type="prob")
predict.val = predict(credit.fit.boost, newdata = credit.val, type="prob")
predict.test = predict(credit.fit.boost, newdata = credit.test, type="prob")Accuracy and ROC on Training Data Set
library(Metrics)
accuracy(credit.train$default, ifelse(predict.train[,1]>0.5, 'Yes', 'No'))## [1] 0.9775
library(ROCR)
ROCRpred = prediction(predict.train[,1], credit.train$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)Accuracy and ROC on Validation Data Set
accuracy(credit.val$default, ifelse(predict.val[,1]>0.5, 'Yes', 'No'))## [1] 0.74
ROCRpred = prediction(predict.val[,1], credit.val$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)Accuracy and ROC on Testing Data Set
accuracy(credit.test$default, ifelse(predict.test[,1]>0.5, 'Yes', 'No'))## [1] 0.83
ROCRpred = prediction(predict.test[,1], credit.test$default)
ROCRperf = performance(ROCRpred, "tpr", "fpr")
auc_ROCR = performance(ROCRpred, measure = "auc")
auc_ROCR = auc_ROCR@y.values[[1]]
plot(ROCRperf, main = paste0("Training ROC curve (AUC: ", round(auc_ROCR,2),")"), colorize = T)
abline(a = 0, b = 1)