| title: “Indetifying risky bank loans” |
| output: html_notebook |
I would have written a shorter letter but i didn’t have the time. Blaise Pascal
Our main aim is to identify factors leading to default
What information is available?
credit <- read.csv("credit.csv")
str(credit)
## 'data.frame': 1000 obs. of 17 variables:
## $ checking_balance : Factor w/ 4 levels "< 0 DM","> 200 DM",..: 1 3 4 1 1 4 4 3 4 3 ...
## $ months_loan_duration: int 6 48 12 42 24 36 24 36 12 30 ...
## $ credit_history : Factor w/ 5 levels "critical","good",..: 1 2 1 2 4 2 2 2 2 1 ...
## $ purpose : Factor w/ 6 levels "business","car",..: 5 5 4 5 2 4 5 2 5 2 ...
## $ amount : int 1169 5951 2096 7882 4870 9055 2835 6948 3059 5234 ...
## $ savings_balance : Factor w/ 5 levels "< 100 DM","> 1000 DM",..: 5 1 1 1 1 5 4 1 2 1 ...
## $ employment_duration : Factor w/ 5 levels "< 1 year","> 7 years",..: 2 3 4 4 3 3 2 3 4 5 ...
## $ percent_of_income : int 4 2 2 2 3 2 3 2 2 4 ...
## $ years_at_residence : int 4 2 3 4 4 4 4 2 4 2 ...
## $ age : int 67 22 49 45 53 35 53 35 61 28 ...
## $ other_credit : Factor w/ 3 levels "bank","none",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ housing : Factor w/ 3 levels "other","own",..: 2 2 2 1 1 1 2 3 2 2 ...
## $ existing_loans_count: int 2 1 1 1 2 1 1 1 1 2 ...
## $ job : Factor w/ 4 levels "management","skilled",..: 2 2 4 2 2 4 2 1 4 1 ...
## $ dependents : int 1 1 2 2 2 2 1 1 1 1 ...
## $ phone : Factor w/ 2 levels "no","yes": 2 1 1 1 1 2 1 2 1 1 ...
## $ default : Factor w/ 2 levels "no","yes": 1 2 1 1 2 1 1 1 1 2 ...
Let’s take a look of two potential predicting features
table( credit $ checking_balance)
##
## < 0 DM > 200 DM 1 - 200 DM unknown
## 274 63 269 394
table( credit $ savings_balance)
##
## < 100 DM > 1000 DM 100 - 500 DM 500 - 1000 DM unknown
## 603 48 103 63 183
DM= Deutsche Marks
Some features are numeric
summary( credit $ months_loan_duration)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.0 12.0 18.0 20.9 24.0 72.0
summary( credit $ amount)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 250 1366 2320 3271 3972 18424
table( credit $ default)
##
## no yes
## 700 300
In this scenario we will use a 90-10 split.
We can create a set of 900 random numbers.
set.seed(123)
train_sample <- sample( 1000, 900)
str( train_sample)
## int [1:900] 415 463 179 526 195 938 818 118 299 229 ...
credit_train <- credit[ train_sample, ]
credit_test <- credit[-train_sample, ]
prop.table( table( credit_train $ default))
##
## no yes
## 0.7055556 0.2944444
prop.table( table( credit_test $ default))
##
## no yes
## 0.65 0.35
library(C50)
Model training
credit_model <- C5.0( credit_train[-17], credit_train $ default)
credit_model
##
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default)
##
## Classification Tree
## Number of samples: 900
## Number of predictors: 16
##
## Tree size: 69
##
## Non-standard options: attempt to group attributes
Visualize tree
summary( credit_model)
##
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default)
##
##
## C5.0 [Release 2.07 GPL Edition] Thu Oct 31 09:07:10 2019
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## Decision tree:
##
## checking_balance in {> 200 DM,unknown}: no (412/54)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history in {perfect,very good}:
## :...housing = rent: yes (16/1)
## : housing = other:
## : :...employment_duration in {> 7 years,1 - 4 years,
## : : : 4 - 7 years}: yes (10)
## : : employment_duration in {< 1 year,unemployed}:
## : : :...job in {management,unemployed,unskilled}: no (3)
## : : job = skilled: yes (1)
## : housing = own:
## : :...purpose in {business,education}: no (9/2)
## : purpose in {car0,renovations}: yes (3)
## : purpose = car:
## : :...months_loan_duration <= 18: yes (5)
## : : months_loan_duration > 18:
## : : :...job in {management,skilled,unemployed}: no (3)
## : : job = unskilled: yes (1)
## : purpose = furniture/appliances:
## : :...other_credit = store: no (4)
## : other_credit in {bank,none}:
## : :...existing_loans_count <= 1: yes (6)
## : existing_loans_count > 1: no (2)
## credit_history in {critical,good,poor}:
## :...months_loan_duration <= 15:
## :...purpose in {business,car0}: no (10)
## : purpose = education:
## : :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM,
## : : : 500 - 1000 DM}: yes (7/1)
## : : savings_balance = unknown: no (3)
## : purpose = furniture/appliances:
## : :...savings_balance in {< 100 DM,> 1000 DM,500 - 1000 DM,
## : : : unknown}: no (88/14)
## : : savings_balance = 100 - 500 DM: yes (3)
## : purpose = renovations:
## : :...other_credit in {bank,none}: no (5/1)
## : : other_credit = store: yes (1)
## : purpose = car:
## : :...credit_history in {critical,poor}: no (27/4)
## : credit_history = good:
## : :...existing_loans_count > 1: yes (2)
## : existing_loans_count <= 1:
## : :...savings_balance in {> 1000 DM,100 - 500 DM,
## : : 500 - 1000 DM}: no (6/1)
## : savings_balance = unknown:
## : :...age <= 23: yes (2)
## : : age > 23: no (5)
## : savings_balance = < 100 DM:
## : :...years_at_residence <= 3:
## : :...percent_of_income <= 2: no (3/1)
## : : percent_of_income > 2: yes (7)
## : years_at_residence > 3:
## : :...employment_duration in {< 1 year,1 - 4 years,
## : : 4 - 7 years,
## : : unemployed}: no (8)
## : employment_duration = > 7 years: yes (3)
## months_loan_duration > 15:
## :...savings_balance in {> 1000 DM,unknown}:
## :...credit_history in {critical,poor}: no (14)
## : credit_history = good:
## : :...amount > 6110:
## : :...checking_balance = < 0 DM: yes (3)
## : : checking_balance = 1 - 200 DM:
## : : :...amount <= 9629: no (2)
## : : amount > 9629: yes (2)
## : amount <= 6110:
## : :...phone = yes: no (11)
## : phone = no:
## : :...savings_balance = > 1000 DM: no (2)
## : savings_balance = unknown:
## : :...months_loan_duration <= 27: yes (9/2)
## : months_loan_duration > 27: no (3)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## :...months_loan_duration > 47: yes (23/3)
## months_loan_duration <= 47:
## :...employment_duration = unemployed:
## :...years_at_residence <= 2: yes (7)
## : years_at_residence > 2: no (12/2)
## employment_duration = < 1 year:
## :...years_at_residence <= 1:
## : :...housing in {other,own}: no (14/4)
## : : housing = rent: yes (2)
## : years_at_residence > 1:
## : :...job in {management,unemployed,
## : : unskilled}: yes (11/1)
## : job = skilled:
## : :...percent_of_income <= 2: no (4)
## : percent_of_income > 2: yes (12/1)
## employment_duration = > 7 years:
## :...other_credit = store: no (2)
## : other_credit = bank:
## : :...job in {management,unskilled}: no (4/1)
## : : job in {skilled,unemployed}: yes (6)
## : other_credit = none:
## : :...purpose = business: yes (2)
## : purpose in {car0,education,
## : : renovations}: no (1)
## : purpose = furniture/appliances:
## : :...job = management: yes (2)
## : : job in {skilled,unemployed,unskilled}: no (9)
## : purpose = car:
## : :...amount <= 6999: no (7/1)
## : amount > 6999: [S1]
## employment_duration = 1 - 4 years:
## :...purpose in {business,car0}: no (5/2)
## : purpose in {education,renovations}: yes (4)
## : purpose = car:
## : :...phone = yes: no (6)
## : : phone = no:
## : : :...checking_balance = < 0 DM: yes (4)
## : : checking_balance = 1 - 200 DM: no (3/1)
## : purpose = furniture/appliances:
## : :...savings_balance in {100 - 500 DM,
## : : 500 - 1000 DM}: yes (6)
## : savings_balance = < 100 DM:
## : :...months_loan_duration <= 22: yes (12/1)
## : months_loan_duration > 22:
## : :...amount <= 2325: yes (3)
## : amount > 2325: no (6)
## employment_duration = 4 - 7 years:
## :...savings_balance in {100 - 500 DM,
## : 500 - 1000 DM}: no (8)
## savings_balance = < 100 DM:
## :...job in {management,unemployed,
## : unskilled}: no (6)
## job = skilled:
## :...dependents > 1: no (3/1)
## dependents <= 1:
## :...months_loan_duration <= 22: no (3)
## months_loan_duration > 22: yes (8)
##
## SubTree [S1]
##
## checking_balance = < 0 DM: no (1)
## checking_balance = 1 - 200 DM: yes (3)
##
##
## Evaluation on training data (900 cases):
##
## Decision Tree
## ----------------
## Size Errors
##
## 69 99(11.0%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 625 10 (a): class no
## 89 176 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 54.22% credit_history
## 48.22% months_loan_duration
## 42.22% savings_balance
## 31.89% purpose
## 22.33% employment_duration
## 9.22% years_at_residence
## 8.78% housing
## 8.44% job
## 6.11% other_credit
## 5.78% amount
## 4.89% existing_loans_count
## 4.22% phone
## 2.89% percent_of_income
## 1.56% dependents
## 0.78% age
##
##
## Time: 0.0 secs
However, we evaluated our results only on trainning data
credit_pred <- predict( credit_model, credit_test)
library(gmodels)
CrossTable( credit_test $ default, credit_pred,
prop.chisq = FALSE, prop.c =
FALSE, prop.r = FALSE,
dnn = c(' actual default', 'predicted default'))
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 100
##
##
## | predicted default
## actual default | no | yes | Row Total |
## ----------------|-----------|-----------|-----------|
## no | 55 | 10 | 65 |
## | 0.550 | 0.100 | |
## ----------------|-----------|-----------|-----------|
## yes | 20 | 15 | 35 |
## | 0.200 | 0.150 | |
## ----------------|-----------|-----------|-----------|
## Column Total | 75 | 25 | 100 |
## ----------------|-----------|-----------|-----------|
##
##
Boosting
credit_boost10 <- C5.0( credit_train[-17], credit_train $ default, trials = 10)
credit_boost10
##
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default, trials = 10)
##
## Classification Tree
## Number of samples: 900
## Number of predictors: 16
##
## Number of boosting iterations: 10
## Average tree size: 56.6
##
## Non-standard options: attempt to group attributes
summary( credit_boost10)
##
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default, trials = 10)
##
##
## C5.0 [Release 2.07 GPL Edition] Tue Nov 05 19:17:42 2019
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## ----- Trial 0: -----
##
## Decision tree:
##
## checking_balance in {> 200 DM,unknown}: no (412/54)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history in {perfect,very good}:
## :...housing = rent: yes (16/1)
## : housing = other:
## : :...employment_duration in {> 7 years,1 - 4 years,
## : : : 4 - 7 years}: yes (10)
## : : employment_duration in {< 1 year,unemployed}:
## : : :...job in {management,unemployed,unskilled}: no (3)
## : : job = skilled: yes (1)
## : housing = own:
## : :...purpose in {business,education}: no (9/2)
## : purpose in {car0,renovations}: yes (3)
## : purpose = car:
## : :...months_loan_duration <= 18: yes (5)
## : : months_loan_duration > 18:
## : : :...job in {management,skilled,unemployed}: no (3)
## : : job = unskilled: yes (1)
## : purpose = furniture/appliances:
## : :...other_credit = store: no (4)
## : other_credit in {bank,none}:
## : :...existing_loans_count <= 1: yes (6)
## : existing_loans_count > 1: no (2)
## credit_history in {critical,good,poor}:
## :...months_loan_duration <= 15:
## :...purpose in {business,car0}: no (10)
## : purpose = education:
## : :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM,
## : : : 500 - 1000 DM}: yes (7/1)
## : : savings_balance = unknown: no (3)
## : purpose = furniture/appliances:
## : :...savings_balance in {< 100 DM,> 1000 DM,500 - 1000 DM,
## : : : unknown}: no (88/14)
## : : savings_balance = 100 - 500 DM: yes (3)
## : purpose = renovations:
## : :...other_credit in {bank,none}: no (5/1)
## : : other_credit = store: yes (1)
## : purpose = car:
## : :...credit_history in {critical,poor}: no (27/4)
## : credit_history = good:
## : :...existing_loans_count > 1: yes (2)
## : existing_loans_count <= 1:
## : :...savings_balance in {> 1000 DM,100 - 500 DM,
## : : 500 - 1000 DM}: no (6/1)
## : savings_balance = unknown:
## : :...age <= 23: yes (2)
## : : age > 23: no (5)
## : savings_balance = < 100 DM:
## : :...years_at_residence <= 3:
## : :...percent_of_income <= 2: no (3/1)
## : : percent_of_income > 2: yes (7)
## : years_at_residence > 3:
## : :...employment_duration in {< 1 year,1 - 4 years,
## : : 4 - 7 years,
## : : unemployed}: no (8)
## : employment_duration = > 7 years: yes (3)
## months_loan_duration > 15:
## :...savings_balance in {> 1000 DM,unknown}:
## :...credit_history in {critical,poor}: no (14)
## : credit_history = good:
## : :...amount > 6110:
## : :...checking_balance = < 0 DM: yes (3)
## : : checking_balance = 1 - 200 DM:
## : : :...amount <= 9629: no (2)
## : : amount > 9629: yes (2)
## : amount <= 6110:
## : :...phone = yes: no (11)
## : phone = no:
## : :...savings_balance = > 1000 DM: no (2)
## : savings_balance = unknown:
## : :...months_loan_duration <= 27: yes (9/2)
## : months_loan_duration > 27: no (3)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## :...months_loan_duration > 47: yes (23/3)
## months_loan_duration <= 47:
## :...employment_duration = unemployed:
## :...years_at_residence <= 2: yes (7)
## : years_at_residence > 2: no (12/2)
## employment_duration = < 1 year:
## :...years_at_residence <= 1:
## : :...housing in {other,own}: no (14/4)
## : : housing = rent: yes (2)
## : years_at_residence > 1:
## : :...job in {management,unemployed,
## : : unskilled}: yes (11/1)
## : job = skilled:
## : :...percent_of_income <= 2: no (4)
## : percent_of_income > 2: yes (12/1)
## employment_duration = > 7 years:
## :...other_credit = store: no (2)
## : other_credit = bank:
## : :...job in {management,unskilled}: no (4/1)
## : : job in {skilled,unemployed}: yes (6)
## : other_credit = none:
## : :...purpose = business: yes (2)
## : purpose in {car0,education,
## : : renovations}: no (1)
## : purpose = furniture/appliances:
## : :...job = management: yes (2)
## : : job in {skilled,unemployed,unskilled}: no (9)
## : purpose = car:
## : :...amount <= 6999: no (7/1)
## : amount > 6999: [S1]
## employment_duration = 1 - 4 years:
## :...purpose in {business,car0}: no (5/2)
## : purpose in {education,renovations}: yes (4)
## : purpose = car:
## : :...phone = yes: no (6)
## : : phone = no:
## : : :...checking_balance = < 0 DM: yes (4)
## : : checking_balance = 1 - 200 DM: no (3/1)
## : purpose = furniture/appliances:
## : :...savings_balance in {100 - 500 DM,
## : : 500 - 1000 DM}: yes (6)
## : savings_balance = < 100 DM:
## : :...months_loan_duration <= 22: yes (12/1)
## : months_loan_duration > 22:
## : :...amount <= 2325: yes (3)
## : amount > 2325: no (6)
## employment_duration = 4 - 7 years:
## :...savings_balance in {100 - 500 DM,
## : 500 - 1000 DM}: no (8)
## savings_balance = < 100 DM:
## :...job in {management,unemployed,
## : unskilled}: no (6)
## job = skilled:
## :...dependents > 1: no (3/1)
## dependents <= 1:
## :...months_loan_duration <= 22: no (3)
## months_loan_duration > 22: yes (8)
##
## SubTree [S1]
##
## checking_balance = < 0 DM: no (1)
## checking_balance = 1 - 200 DM: yes (3)
##
## ----- Trial 1: -----
##
## Decision tree:
##
## months_loan_duration <= 7:
## :...job = management: yes (10.2/3.9)
## : job in {skilled,unemployed,unskilled}:
## : :...amount <= 4139: no (53.1/3.1)
## : amount > 4139: yes (4.3/0.8)
## months_loan_duration > 7:
## :...checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...savings_balance in {> 1000 DM,unknown}:
## : :...checking_balance = 1 - 200 DM: no (42.2/7.5)
## : : checking_balance in {< 0 DM,> 200 DM}:
## : : :...savings_balance = > 1000 DM: no (4.7)
## : : savings_balance = unknown:
## : : :...amount <= 1887: yes (16.1/2.3)
## : : amount > 1887: no (13.7/3.1)
## : savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## : :...credit_history = perfect: yes (28.6/6.2)
## : credit_history = poor:
## : :...checking_balance = < 0 DM: yes (11.8/1.6)
## : : checking_balance in {> 200 DM,1 - 200 DM}: no (18.4/4.7)
## : credit_history = very good:
## : :...age <= 23: no (5.1)
## : : age > 23: yes (20.7/3.9)
## : credit_history = critical:
## : :...purpose in {business,furniture/appliances}: no (37.6/12.1)
## : : purpose in {car0,education,renovations}: yes (13.8/3.1)
## : : purpose = car:
## : : :...percent_of_income <= 2: no (11.7/1.6)
## : : percent_of_income > 2:
## : : :...existing_loans_count <= 1: no (5.5/0.8)
## : : existing_loans_count > 1:
## : : :...months_loan_duration <= 11: no (2.3)
## : : months_loan_duration > 11: yes (25.6/5.5)
## : credit_history = good:
## : :...purpose in {business,car0,education}: no (29.8/11.8)
## : purpose = renovations: yes (8.7/2.3)
## : purpose = car:
## : :...percent_of_income > 2: yes (42.4/10.6)
## : : percent_of_income <= 2:
## : : :...amount <= 1386: yes (7.1)
## : : amount > 1386: no (15.6/3.1)
## : purpose = furniture/appliances:
## : :...savings_balance = 100 - 500 DM: yes (11.7/3.1)
## : savings_balance = 500 - 1000 DM: no (7.5/2.8)
## : savings_balance = < 100 DM:
## : :...job = management: no (12.6/4.3)
## : job = unemployed: yes (0.8)
## : job = unskilled:
## : :...checking_balance in {< 0 DM,
## : : : 1 - 200 DM}: no (21.9/5.9)
## : : checking_balance = > 200 DM: yes (10.7/2.3)
## : job = skilled:
## : :...checking_balance = > 200 DM: no (14.1/5.5)
## : checking_balance = 1 - 200 DM: yes (29.6/7)
## : checking_balance = < 0 DM:
## : :...years_at_residence <= 1: no (6.2/0.8)
## : years_at_residence > 1: yes (26.2/9.4)
## checking_balance = unknown:
## :...other_credit in {bank,store}:
## :...employment_duration = 4 - 7 years: no (7.8)
## : employment_duration in {< 1 year,> 7 years,1 - 4 years,unemployed}:
## : :...purpose in {business,car,education,renovations}: yes (50.2/8.6)
## : purpose in {car0,furniture/appliances}: no (21.6/8.3)
## other_credit = none:
## :...credit_history in {critical,perfect,very good}: no (91.4/5.5)
## credit_history in {good,poor}:
## :...existing_loans_count > 1:
## :...employment_duration = 4 - 7 years: no (7)
## : employment_duration in {< 1 year,> 7 years,1 - 4 years,
## : : unemployed}:
## : :...housing in {other,rent}: yes (11.9/0.8)
## : housing = own:
## : :...job in {management,unemployed}: yes (8.3)
## : job in {skilled,unskilled}:
## : :...years_at_residence <= 1: yes (5.5)
## : years_at_residence > 1: no (15.3/2.8)
## existing_loans_count <= 1:
## :...credit_history = poor: yes (7.9/2.3)
## credit_history = good:
## :...savings_balance in {> 1000 DM,100 - 500 DM,
## : unknown}: no (37.5)
## savings_balance in {< 100 DM,500 - 1000 DM}:
## :...employment_duration = > 7 years: no (13.3)
## employment_duration = unemployed: yes (2.8)
## employment_duration in {< 1 year,1 - 4 years,
## : 4 - 7 years}:
## :...phone = yes: no (18.4/2.8)
## phone = no: [S1]
##
## SubTree [S1]
##
## savings_balance = 500 - 1000 DM: yes (8.7/3.1)
## savings_balance = < 100 DM:
## :...age <= 23: yes (8.3)
## age > 23: no (13.7/2.8)
##
## ----- Trial 2: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...other_credit in {bank,store}:
## : :...employment_duration = 4 - 7 years: no (6.3)
## : : employment_duration in {< 1 year,> 7 years,1 - 4 years,unemployed}:
## : : :...existing_loans_count > 2: no (3.9)
## : : existing_loans_count <= 2:
## : : :...savings_balance in {> 1000 DM,100 - 500 DM}: no (8.3/2.2)
## : : savings_balance = 500 - 1000 DM: yes (10.6/2.5)
## : : savings_balance = < 100 DM:
## : : :...percent_of_income <= 1: no (4.9)
## : : : percent_of_income > 1: yes (30.4/6.7)
## : : savings_balance = unknown:
## : : :...housing in {other,rent}: no (4.9)
## : : housing = own: yes (13.2/2.9)
## : other_credit = none:
## : :...age > 30:
## : :...age <= 46: no (100.7/8.1)
## : : age > 46:
## : : :...dependents <= 1: no (31.9/4.5)
## : : dependents > 1: yes (7.1/1.3)
## : age <= 30:
## : :...percent_of_income <= 3: no (45.6/11.2)
## : percent_of_income > 3:
## : :...credit_history = perfect: no (0.6)
## : credit_history in {poor,very good}: yes (9.6/0.6)
## : credit_history in {critical,good}:
## : :...job = unemployed: no (0)
## : job in {management,unskilled}: yes (14.9/3.1)
## : job = skilled:
## : :...purpose in {business,car,car0,
## : : furniture/appliances}: no (20.6/2.2)
## : purpose in {education,renovations}: yes (6.5/0.6)
## checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...months_loan_duration <= 11:
## :...credit_history in {critical,good,poor}: no (90.4/25.9)
## : credit_history in {perfect,very good}: yes (8.4/0.6)
## months_loan_duration > 11:
## :...savings_balance = > 1000 DM: no (11.4/3.3)
## savings_balance = 100 - 500 DM:
## :...housing in {other,own}: no (42.4/16.3)
## : housing = rent: yes (12.2/3.1)
## savings_balance = 500 - 1000 DM:
## :...percent_of_income <= 3: no (10.2/2.3)
## : percent_of_income > 3: yes (9.4/1.3)
## savings_balance = unknown:
## :...purpose in {business,education,renovations}: no (9.5)
## : purpose in {car,car0,furniture/appliances}:
## : :...months_loan_duration <= 45: yes (44.5/18.4)
## : months_loan_duration > 45: no (3.8)
## savings_balance = < 100 DM:
## :...months_loan_duration > 42: yes (31.5/6.5)
## months_loan_duration <= 42:
## :...percent_of_income <= 3:
## :...employment_duration = unemployed: no (14.4/6.7)
## : employment_duration = < 1 year:
## : :...housing = other: no (3.3)
## : : housing in {own,rent}: yes (34.3/9.9)
## : employment_duration = > 7 years:
## : :...job in {management,unskilled}: no (9.3/0.6)
## : : job in {skilled,unemployed}: yes (19.3/5.4)
## : employment_duration = 1 - 4 years:
## : :...amount <= 7685: no (50/13.4)
## : : amount > 7685: yes (4.5)
## : employment_duration = 4 - 7 years:
## : :...housing in {other,rent}: no (9)
## : housing = own: yes (17.7/6.4)
## percent_of_income > 3:
## :...dependents > 1:
## :...age <= 42: yes (16.1/0.6)
## : age > 42: no (2.9)
## dependents <= 1:
## :...credit_history in {perfect,poor,
## : very good}: yes (18.5/2.3)
## credit_history = critical:
## :...age > 62: no (4.9)
## : age <= 62:
## : :...months_loan_duration <= 15: no (10.3/2.2)
## : months_loan_duration > 15: yes (17.6/6.6)
## credit_history = good:
## :...years_at_residence <= 1: no (14.3/3.5)
## years_at_residence > 1:
## :...housing = other: yes (5.5)
## housing in {own,rent}:
## :...existing_loans_count > 1: no (4.5/1.3)
## existing_loans_count <= 1:
## :...years_at_residence <= 3: yes (30.7/7)
## years_at_residence > 3: no (19.3/7.4)
##
## ----- Trial 3: -----
##
## Decision tree:
##
## employment_duration in {> 7 years,4 - 7 years}:
## :...checking_balance = unknown:
## : :...months_loan_duration > 24: no (26.5)
## : : months_loan_duration <= 24:
## : : :...amount > 10222: yes (3)
## : : amount <= 10222:
## : : :...age <= 22: yes (5.8/1)
## : : age > 22: no (88.1/14.4)
## : checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## : :...years_at_residence <= 1: no (23/3.7)
## : years_at_residence > 1:
## : :...other_credit = bank: yes (37.4/14.3)
## : other_credit = store: no (3.9/1.5)
## : other_credit = none:
## : :...housing = other:
## : :...purpose in {business,car0,education,
## : : : renovations}: yes (8.2)
## : : purpose in {car,furniture/appliances}:
## : : :...percent_of_income <= 1: yes (4.3)
## : : percent_of_income > 1: no (20.6/7.9)
## : housing in {own,rent}:
## : :...percent_of_income <= 1: no (12.3)
## : percent_of_income > 1:
## : :...savings_balance in {> 1000 DM,100 - 500 DM,
## : : unknown}: no (41.7/5.5)
## : savings_balance = 500 - 1000 DM: yes (2.9/1)
## : savings_balance = < 100 DM:
## : :...checking_balance = > 200 DM: no (5)
## : checking_balance = 1 - 200 DM:
## : :...job in {unemployed,unskilled}: no (6.9)
## : : job in {management,skilled}: [S1]
## : checking_balance = < 0 DM:
## : :...dependents > 1: no (5.4/0.5)
## : dependents <= 1:
## : :...months_loan_duration <= 11: no (3.4)
## : months_loan_duration > 11:
## : :...amount <= 666: no (3.2)
## : amount > 666: yes (24.5/2.4)
## employment_duration in {< 1 year,1 - 4 years,unemployed}:
## :...amount > 9566: yes (30/4.2)
## amount <= 9566:
## :...purpose = car0: no (4.2)
## purpose = renovations: yes (17.1/6.9)
## purpose = education:
## :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM}: yes (25.3/6.6)
## : savings_balance in {500 - 1000 DM,unknown}: no (6.3)
## purpose = business:
## :...housing = other: no (1.9)
## : housing = rent: yes (5.2/0.5)
## : housing = own:
## : :...age > 35: yes (18.8/2.6)
## : age <= 35:
## : :...credit_history in {critical,good,perfect}: no (13.8)
## : credit_history in {poor,very good}: yes (8.4/2.9)
## purpose = car:
## :...dependents > 1: no (24.5/5)
## : dependents <= 1:
## : :...checking_balance in {> 200 DM,unknown}: no (49.2/16.1)
## : checking_balance = < 0 DM:
## : :...percent_of_income <= 2: no (7.6/1.8)
## : : percent_of_income > 2: yes (22.5/5.3)
## : checking_balance = 1 - 200 DM:
## : :...other_credit in {bank,store}: yes (8/1.9)
## : other_credit = none:
## : :...job = management: yes (9.8/3.2)
## : job in {unemployed,unskilled}: no (5.2/1)
## : job = skilled:
## : :...housing in {other,own}: no (13.5/3.2)
## : housing = rent: yes (4.7/1)
## purpose = furniture/appliances:
## :...savings_balance = > 1000 DM: no (5.7)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...dependents > 1:
## :...months_loan_duration <= 15: no (5.2)
## : months_loan_duration > 15: yes (15.6/1.3)
## dependents <= 1:
## :...months_loan_duration > 30: yes (27.7/6.8)
## months_loan_duration <= 30:
## :...housing = other: no (10/2.9)
## housing = rent:
## :...credit_history in {critical,poor}: no (11.1/4.8)
## : credit_history in {perfect,
## : : very good}: yes (1.5)
## : credit_history = good:
## : :...job in {management,unemployed}: no (6.3)
## : job in {skilled,unskilled}:
## : :...age <= 34: yes (31.1/6.5)
## : age > 34: no (2.4)
## housing = own:
## :...checking_balance = unknown:
## :...amount <= 4594: no (24.1)
## : amount > 4594: yes (6.4/0.5)
## checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...employment_duration = unemployed: yes (12.4/2.7)
## employment_duration in {< 1 year,1 - 4 years}:
## :...years_at_residence <= 1: no (23.3/5.3)
## years_at_residence > 1: [S2]
##
## SubTree [S1]
##
## employment_duration = > 7 years: yes (12.2/4.5)
## employment_duration = 4 - 7 years: no (13.8/3.7)
##
## SubTree [S2]
##
## savings_balance = 100 - 500 DM: yes (5)
## savings_balance in {< 100 DM,500 - 1000 DM,unknown}:
## :...credit_history = critical: yes (8.2/2.9)
## credit_history in {perfect,poor,very good}: no (12.7/3.4)
## credit_history = good:
## :...other_credit = bank: no (1/0.5)
## other_credit = store: yes (3)
## other_credit = none:
## :...job in {management,unemployed}: no (0.5)
## job = unskilled: yes (23.7/10.3)
## job = skilled:
## :...percent_of_income <= 1: yes (2.9)
## percent_of_income > 1:
## :...age <= 24: yes (11.7/1.9)
## age > 24: no (20.6/4.5)
##
## ----- Trial 4: -----
##
## Decision tree:
##
## checking_balance = < 0 DM:
## :...savings_balance in {> 1000 DM,100 - 500 DM,500 - 1000 DM}: no (23.2/8.7)
## : savings_balance = unknown:
## : :...other_credit = bank: no (4/0.4)
## : : other_credit = store: yes (1.3)
## : : other_credit = none:
## : : :...housing = other: yes (3.2)
## : : housing in {own,rent}:
## : : :...employment_duration in {< 1 year,> 7 years,
## : : : unemployed}: no (7.9)
## : : employment_duration in {1 - 4 years,4 - 7 years}: yes (11.1/2.6)
## : savings_balance = < 100 DM:
## : :...job = unemployed: yes (7.7/2.1)
## : job = management:
## : :...percent_of_income <= 1: yes (4.8)
## : : percent_of_income > 1: no (26.2/6.8)
## : job = unskilled:
## : :...existing_loans_count > 1: no (12.8/4.1)
## : : existing_loans_count <= 1:
## : : :...employment_duration in {> 7 years,4 - 7 years,
## : : : unemployed}: no (5.7/0.4)
## : : employment_duration in {< 1 year,1 - 4 years}:
## : : :...months_loan_duration <= 36: yes (23.9/7.2)
## : : months_loan_duration > 36: no (2.1)
## : job = skilled:
## : :...purpose in {car0,education,renovations}: yes (9.5)
## : purpose in {business,car,furniture/appliances}:
## : :...existing_loans_count > 1: yes (43.4/10.5)
## : existing_loans_count <= 1:
## : :...credit_history in {critical,perfect}: no (7.5/1.5)
## : credit_history in {poor,very good}: yes (8.4/1.5)
## : credit_history = good:
## : :...dependents > 1: no (14.6/3.8)
## : dependents <= 1:
## : :...months_loan_duration <= 16: no (21.8/6.7)
## : months_loan_duration > 16:
## : :...age <= 54: yes (24.2/3.4)
## : age > 54: no (2.1)
## checking_balance in {> 200 DM,1 - 200 DM,unknown}:
## :...amount > 7824:
## :...savings_balance in {> 1000 DM,100 - 500 DM}: yes (12.4/2.8)
## : savings_balance in {500 - 1000 DM,unknown}: no (20.1/7.5)
## : savings_balance = < 100 DM:
## : :...percent_of_income > 2: yes (9.5)
## : percent_of_income <= 2:
## : :...purpose in {business,car0,education,renovations}: yes (9.4)
## : purpose in {car,furniture/appliances}: no (11.3/3.6)
## amount <= 7824:
## :...dependents > 1:
## :...months_loan_duration <= 7: no (12.6/1.1)
## : months_loan_duration > 7:
## : :...checking_balance = > 200 DM: yes (7.7)
## : checking_balance in {1 - 200 DM,unknown}:
## : :...savings_balance in {> 1000 DM,100 - 500 DM}: yes (12.5/2.9)
## : savings_balance in {500 - 1000 DM,unknown}: no (23.5/5.2)
## : savings_balance = < 100 DM:
## : :...existing_loans_count > 2: no (2.8)
## : existing_loans_count <= 2:
## : :...age <= 35: no (6.2)
## : age > 35:
## : :...credit_history = critical: no (4.7/1.1)
## : credit_history in {good,perfect,poor,
## : very good}: yes (20.6/0.8)
## dependents <= 1:
## :...employment_duration in {> 7 years,4 - 7 years}:
## :...months_loan_duration <= 36: no (142.6/19.7)
## : months_loan_duration > 36: yes (11.1/4.1)
## employment_duration in {< 1 year,1 - 4 years,unemployed}:
## :...credit_history = very good: yes (9.2/3.6)
## credit_history = perfect:
## :...years_at_residence <= 2: no (11.1/4.3)
## : years_at_residence > 2: yes (9/1.1)
## credit_history = critical:
## :...phone = yes: no (29.6/5.2)
## : phone = no:
## : :...months_loan_duration <= 16: no (14.4)
## : months_loan_duration > 16: yes (19.8/5.7)
## credit_history = poor:
## :...percent_of_income <= 2: no (11.8)
## : percent_of_income > 2:
## : :...housing in {other,rent}: no (2.2)
## : housing = own:
## : :...job in {management,skilled,
## : : unemployed}: yes (16.1/5.1)
## : job = unskilled: no (4)
## credit_history = good:
## :...existing_loans_count > 1: yes (16.4/4.5)
## existing_loans_count <= 1:
## :...months_loan_duration > 24:
## :...years_at_residence <= 1: no (6.6/1.1)
## : years_at_residence > 1: yes (25.4/5.4)
## months_loan_duration <= 24:
## :...phone = yes:
## :...checking_balance in {> 200 DM,
## : : unknown}: no (19.9)
## : checking_balance = 1 - 200 DM:
## : :...years_at_residence <= 2: yes (10.6/2.8)
## : years_at_residence > 2: no (12.6/1.3)
## phone = no:
## :...other_credit = bank: yes (6.3/1.5)
## other_credit = store: no (5.6/2.4)
## other_credit = none: [S1]
##
## SubTree [S1]
##
## savings_balance in {> 1000 DM,100 - 500 DM}: no (11.7)
## savings_balance in {< 100 DM,500 - 1000 DM,unknown}:
## :...job in {management,unemployed}: no (3)
## job = unskilled:
## :...months_loan_duration > 16: no (5)
## : months_loan_duration <= 16:
## : :...age <= 24: no (5.8)
## : age > 24: yes (17/6.8)
## job = skilled:
## :...checking_balance = > 200 DM: no (5.6)
## checking_balance in {1 - 200 DM,unknown}:
## :...age > 33: no (5.7)
## age <= 33:
## :...age <= 21: no (4.3)
## age > 21: yes (38.9/12.8)
##
## ----- Trial 5: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...other_credit in {none,store}: no (220.1/56.2)
## : other_credit = bank:
## : :...age <= 44: yes (44.7/15.1)
## : age > 44: no (11.8/2.1)
## checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...housing = other:
## :...other_credit = store: yes (3.1)
## : other_credit = bank:
## : :...phone = no: yes (5.2/1.5)
## : : phone = yes: no (13.2/2.2)
## : other_credit = none:
## : :...job in {skilled,unemployed,unskilled}: yes (44/10.8)
## : job = management:
## : :...credit_history in {critical,poor,very good}: no (7)
## : credit_history in {good,perfect}: yes (13.2/2.6)
## housing = rent:
## :...credit_history = perfect: yes (6)
## : credit_history = poor: no (9.5/1)
## : credit_history in {critical,good,very good}:
## : :...checking_balance = > 200 DM: no (6.9/1.2)
## : checking_balance in {< 0 DM,1 - 200 DM}:
## : :...purpose in {business,car0,education,
## : : renovations}: yes (13/1.7)
## : purpose = car:
## : :...dependents > 1: no (3.6)
## : : dependents <= 1:
## : : :...existing_loans_count <= 1: no (19.2/7.9)
## : : existing_loans_count > 1: yes (8.8/0.9)
## : purpose = furniture/appliances:
## : :...checking_balance = 1 - 200 DM: no (11.1/3.4)
## : checking_balance = < 0 DM:
## : :...years_at_residence <= 3: no (8.8/3.1)
## : years_at_residence > 3:
## : :...amount <= 1297: no (3.1)
## : amount > 1297: yes (17.7/2.9)
## housing = own:
## :...amount > 6468:
## :...other_credit = store: no (3.3/0.3)
## : other_credit in {bank,none}:
## : :...job in {management,skilled,unemployed}: yes (34.8/6.4)
## : job = unskilled: no (5.2/1.2)
## amount <= 6468:
## :...savings_balance in {> 1000 DM,500 - 1000 DM}: no (25.4/9.3)
## savings_balance = 100 - 500 DM:
## :...purpose in {car0,education}: no (0)
## : purpose = furniture/appliances: yes (16/1.8)
## : purpose in {business,car,renovations}:
## : :...employment_duration = < 1 year: yes (5.2/0.7)
## : employment_duration in {> 7 years,1 - 4 years,4 - 7 years,
## : unemployed}: no (18.2)
## savings_balance = unknown:
## :...credit_history = perfect: no (0)
## : credit_history = very good: yes (2.1)
## : credit_history in {critical,good,poor}:
## : :...amount <= 1345: yes (7/2.5)
## : amount > 1345: no (35.1/3.2)
## savings_balance = < 100 DM:
## :...job = unemployed: no (6.4/2.1)
## job = management:
## :...years_at_residence <= 1: no (5.5)
## : years_at_residence > 1:
## : :...other_credit in {bank,store}: yes (2.2/0.3)
## : other_credit = none:
## : :...credit_history in {critical,perfect,poor,
## : : very good}: yes (15.2/2.1)
## : credit_history = good: no (4.1)
## job = unskilled:
## :...months_loan_duration <= 14: no (47.8/7.9)
## : months_loan_duration > 14:
## : :...other_credit in {bank,store}: no (4.3/0.9)
## : other_credit = none:
## : :...percent_of_income <= 3: yes (11.7/0.9)
## : percent_of_income > 3: no (12.2/4)
## job = skilled:
## :...credit_history = perfect: no (9.6/1.9)
## credit_history in {poor,very good}: yes (9.1/2.6)
## credit_history = critical:
## :...other_credit = bank: yes (3.4)
## : other_credit in {none,store}: no (37.6/11.3)
## credit_history = good:
## :...other_credit = bank: no (7.9/3.5)
## other_credit = store: yes (4.4/1.2)
## other_credit = none:
## :...checking_balance in {> 200 DM,
## : 1 - 200 DM}: no (53.7/21.5)
## checking_balance = < 0 DM:
## :...dependents > 1: no (6.1)
## dependents <= 1:
## :...purpose in {business,car,car0,education,
## : renovations}: yes (14.7/2.6)
## purpose = furniture/appliances:
## :...phone = no: no (18.2/5.8)
## phone = yes: yes (3.4)
##
## ----- Trial 6: -----
##
## Decision tree:
##
## months_loan_duration <= 7:
## :...existing_loans_count > 1: no (14.8)
## : existing_loans_count <= 1:
## : :...amount <= 3380: no (32.5/5.8)
## : amount > 3380: yes (8.6/1.3)
## months_loan_duration > 7:
## :...checking_balance = > 200 DM:
## :...dependents > 1: yes (5.2)
## : dependents <= 1:
## : :...age > 39: no (17.2)
## : age <= 39:
## : :...age <= 24: no (6.9)
## : age > 24:
## : :...amount <= 2337: yes (21.9/3.3)
## : amount > 2337: no (9.7/2.6)
## checking_balance = < 0 DM:
## :...savings_balance = > 1000 DM: no (2.1)
## : savings_balance in {100 - 500 DM,500 - 1000 DM}: yes (20/7.1)
## : savings_balance = unknown:
## : :...phone = no: yes (13.7/2.9)
## : : phone = yes: no (13.3/3)
## : savings_balance = < 100 DM:
## : :...purpose in {business,car0}: no (11.4/2.4)
## : purpose in {car,education,renovations}: yes (93.4/33.9)
## : purpose = furniture/appliances:
## : :...credit_history = critical: no (14.5/4)
## : credit_history in {perfect,poor,very good}: yes (15.1/3.8)
## : credit_history = good:
## : :...phone = yes: yes (17.5/3.6)
## : phone = no:
## : :...job in {management,unemployed}: yes (4.4/1.3)
## : job = unskilled: no (13.1/2)
## : job = skilled:
## : :...years_at_residence <= 1: no (6.5)
## : years_at_residence > 1: yes (34.2/13.6)
## checking_balance = unknown:
## :...credit_history = perfect: yes (5.1/1.4)
## : credit_history = very good: no (11/4.5)
## : credit_history = poor:
## : :...years_at_residence <= 1: yes (6.3/0.7)
## : : years_at_residence > 1:
## : : :...percent_of_income <= 3: no (8.9/1)
## : : percent_of_income > 3: yes (21.3/6.2)
## : credit_history = critical:
## : :...other_credit = none:
## : : :...amount <= 11760: no (46/2.6)
## : : : amount > 11760: yes (3.9)
## : : other_credit in {bank,store}:
## : : :...age > 45: no (3)
## : : age <= 45:
## : : :...purpose in {business,car}: yes (11)
## : : purpose in {car0,education,furniture/appliances,
## : : renovations}: no (13.4/3.7)
## : credit_history = good:
## : :...existing_loans_count > 1:
## : :...amount <= 1963: no (5.7)
## : : amount > 1963: yes (20.8/3.7)
## : existing_loans_count <= 1:
## : :...savings_balance in {> 1000 DM,100 - 500 DM,
## : : unknown}: no (29.4/1)
## : savings_balance in {< 100 DM,500 - 1000 DM}:
## : :...percent_of_income <= 1: no (6.1)
## : percent_of_income > 1:
## : :...age <= 23: yes (13.4/1.4)
## : age > 23:
## : :...job in {management,skilled,
## : : unemployed}: no (35.4/9.2)
## : job = unskilled: yes (12.2/3.4)
## checking_balance = 1 - 200 DM:
## :...savings_balance = unknown: no (39.8/7.2)
## savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM,500 - 1000 DM}:
## :...months_loan_duration <= 20:
## :...employment_duration = 4 - 7 years: no (11.1)
## : employment_duration in {< 1 year,> 7 years,1 - 4 years,
## : : unemployed}:
## : :...phone = yes: no (39.7/12)
## : phone = no:
## : :...percent_of_income <= 3:
## : :...amount <= 1659: yes (15.5/1.4)
## : : amount > 1659: no (12.4/3.8)
## : percent_of_income > 3:
## : :...age <= 28: no (17.8/1.9)
## : age > 28: yes (22.8/6.3)
## months_loan_duration > 20:
## :...credit_history in {poor,very good}:
## :...existing_loans_count > 3: yes (2.1)
## : existing_loans_count <= 3:
## : :...amount <= 2288: yes (6.8/0.7)
## : amount > 2288: no (15/1)
## credit_history in {critical,good,perfect}:
## :...years_at_residence <= 1: no (17.7/7.3)
## years_at_residence > 1:
## :...dependents > 1: yes (8.4)
## dependents <= 1:
## :...purpose in {business,car0,
## : renovations}: yes (11.8/0.7)
## purpose = education: no (3.1/0.7)
## purpose = car:
## :...age <= 28: yes (13.1/1)
## : age > 28: no (6.9/1.7)
## purpose = furniture/appliances: [S1]
##
## SubTree [S1]
##
## employment_duration in {< 1 year,1 - 4 years,4 - 7 years}: yes (23.3)
## employment_duration in {> 7 years,unemployed}: no (4)
##
## ----- Trial 7: -----
##
## Decision tree:
##
## employment_duration in {< 1 year,unemployed}:
## :...housing = other:
## : :...dependents > 1: yes (2.1)
## : : dependents <= 1:
## : : :...amount <= 12389: no (16.3)
## : : amount > 12389: yes (2.4)
## : housing in {own,rent}:
## : :...credit_history = critical: no (34.8/10.9)
## : credit_history in {perfect,poor,very good}: yes (48.5/10.5)
## : credit_history = good:
## : :...savings_balance in {> 1000 DM,500 - 1000 DM}: no (5.6/1.3)
## : savings_balance = 100 - 500 DM: yes (12.1/2.6)
## : savings_balance = unknown:
## : :...purpose = car: no (6.5/1.2)
## : : purpose in {business,car0,education,furniture/appliances,
## : : renovations}: yes (11.8/3.8)
## : savings_balance = < 100 DM:
## : :...age <= 25: yes (34.5/7.8)
## : age > 25:
## : :...dependents > 1: yes (7.1/1.6)
## : dependents <= 1:
## : :...months_loan_duration > 22: yes (28.1/11.1)
## : months_loan_duration <= 22:
## : :...phone = yes: no (7.1)
## : phone = no:
## : :...years_at_residence <= 3: no (18.1/1.7)
## : years_at_residence > 3: yes (3.1)
## employment_duration in {> 7 years,1 - 4 years,4 - 7 years}:
## :...housing = other:
## :...credit_history in {perfect,very good}: yes (9.2)
## : credit_history in {critical,good,poor}:
## : :...other_credit = store: yes (4.8)
## : other_credit in {bank,none}:
## : :...amount > 11054: yes (10.6/0.6)
## : amount <= 11054:
## : :...years_at_residence <= 1: no (5.6)
## : years_at_residence > 1:
## : :...savings_balance = > 1000 DM: yes (3.3)
## : savings_balance in {100 - 500 DM,500 - 1000 DM,
## : : unknown}: no (21.7/8.4)
## : savings_balance = < 100 DM:
## : :...percent_of_income <= 2: no (12.7)
## : percent_of_income > 2:
## : :...checking_balance in {< 0 DM,
## : : 1 - 200 DM}: yes (18.9/4.3)
## : checking_balance in {> 200 DM,
## : unknown}: no (10.6/0.8)
## housing in {own,rent}:
## :...percent_of_income <= 1: no (65.1/15.1)
## percent_of_income > 1:
## :...months_loan_duration <= 15:
## :...months_loan_duration <= 7: no (14.8)
## : months_loan_duration > 7:
## : :...years_at_residence > 3: no (59.8/12.1)
## : years_at_residence <= 3:
## : :...employment_duration = > 7 years:
## : :...years_at_residence <= 2: no (4.9)
## : : years_at_residence > 2: yes (19.4/4.6)
## : employment_duration = 1 - 4 years:
## : :...purpose in {business,car0,education,
## : : : furniture/appliances}: no (52/12.4)
## : : purpose = renovations: yes (5.6/2.3)
## : : purpose = car:
## : : :...age <= 29: yes (14.4/3.4)
## : : age > 29: no (15.2)
## : employment_duration = 4 - 7 years:
## : :...housing = rent: no (1.2)
## : housing = own:
## : :...checking_balance in {< 0 DM,> 200 DM,
## : : unknown}: yes (16.7/6.1)
## : checking_balance = 1 - 200 DM: no (5.3)
## months_loan_duration > 15:
## :...savings_balance in {> 1000 DM,100 - 500 DM,500 - 1000 DM,
## : unknown}:
## :...phone = yes:
## : :...existing_loans_count <= 2: no (54.8/7)
## : : existing_loans_count > 2: yes (3.8)
## : phone = no:
## : :...savings_balance in {> 1000 DM,
## : : 500 - 1000 DM}: no (10.9/1.3)
## : savings_balance in {100 - 500 DM,unknown}:
## : :...credit_history in {poor,very good}: no (7.6/0.7)
## : credit_history in {critical,good,perfect}: [S1]
## savings_balance = < 100 DM:
## :...dependents > 1:
## :...months_loan_duration <= 45: yes (27/5.4)
## : months_loan_duration > 45: no (3.2)
## dependents <= 1:
## :...months_loan_duration > 45: yes (11.3/0.5)
## months_loan_duration <= 45:
## :...purpose in {business,car0,
## : renovations}: no (17.9/6.4)
## purpose = education: yes (1.9)
## purpose = car:
## :...job = unemployed: yes (0)
## : job = management: no (3.3)
## : job in {skilled,unskilled}:
## : :...amount <= 1042: no (3.2)
## : amount > 1042: yes (19.7/4)
## purpose = furniture/appliances:
## :...years_at_residence > 3:
## :...age <= 25: yes (3.9/0.2)
## : age > 25: no (17.5/1)
## years_at_residence <= 3:
## :...job = unemployed: yes (0)
## job = unskilled: no (7/1.3)
## job in {management,skilled}:
## :...existing_loans_count <= 1: yes (40.9/9.4)
## existing_loans_count > 1: no (15.6/4.6)
##
## SubTree [S1]
##
## employment_duration = > 7 years: no (10.8/2.9)
## employment_duration in {1 - 4 years,4 - 7 years}: yes (29.6/7.8)
##
## ----- Trial 8: -----
##
## Decision tree:
##
## checking_balance in {> 200 DM,unknown}:
## :...employment_duration = unemployed: yes (15.5/5)
## : employment_duration = 4 - 7 years:
## : :...percent_of_income <= 3: no (24.3)
## : : percent_of_income > 3:
## : : :...age <= 22: yes (4.5)
## : : age > 22: no (22.8/4.2)
## : employment_duration in {< 1 year,> 7 years,1 - 4 years}:
## : :...other_credit = store:
## : :...housing = other: yes (2.2)
## : : housing in {own,rent}: no (17.7/4.8)
## : other_credit = bank:
## : :...checking_balance = > 200 DM: no (2.7)
## : : checking_balance = unknown:
## : : :...age > 44: no (8.6)
## : : age <= 44:
## : : :...amount <= 709: no (3.4)
## : : amount > 709: yes (36.7/12)
## : other_credit = none:
## : :...job = unemployed: yes (1.6/0.4)
## : job = management:
## : :...existing_loans_count <= 1: no (15.6/5.4)
## : : existing_loans_count > 1: yes (7.4/1.6)
## : job = unskilled:
## : :...checking_balance = > 200 DM: yes (10/3.4)
## : : checking_balance = unknown: no (26.3/7)
## : job = skilled:
## : :...purpose = car0: no (0)
## : purpose in {business,education,renovations}:
## : :...months_loan_duration <= 22: yes (14.6/4.1)
## : : months_loan_duration > 22: no (13.2/3.7)
## : purpose in {car,furniture/appliances}:
## : :...employment_duration = > 7 years: no (23.9)
## : employment_duration in {< 1 year,1 - 4 years}:
## : :...housing = other: yes (4/0.9)
## : housing in {own,rent}:
## : :...credit_history in {critical,perfect,poor,
## : : very good}: no (16.8)
## : credit_history = good:
## : :...amount <= 4057: no (50/7.8)
## : amount > 4057: yes (11.3/2.7)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...housing = rent:
## :...credit_history = perfect: yes (5.8)
## : credit_history = poor: no (7.4/1.1)
## : credit_history in {critical,good,very good}:
## : :...percent_of_income > 2: yes (51.9/13.9)
## : percent_of_income <= 2:
## : :...years_at_residence <= 1: yes (3.4)
## : years_at_residence > 1:
## : :...phone = yes: yes (13.1/3.3)
## : phone = no:
## : :...age <= 21: yes (4.6/0.9)
## : age > 21: no (20.9/2.5)
## housing in {other,own}:
## :...years_at_residence <= 1:
## :...other_credit in {bank,store}: no (12.9/1.8)
## : other_credit = none:
## : :...employment_duration in {< 1 year,> 7 years,1 - 4 years,
## : : 4 - 7 years}: no (60.3/21.1)
## : employment_duration = unemployed: yes (4.9)
## years_at_residence > 1:
## :...checking_balance = < 0 DM:
## :...credit_history in {critical,perfect}: no (62.5/18.5)
## : credit_history in {poor,very good}: yes (24.5/8.9)
## : credit_history = good:
## : :...dependents > 1:
## : :...amount <= 6468: no (21.7/3.4)
## : : amount > 6468: yes (6.4/2)
## : dependents <= 1:
## : :...purpose in {business,car0}: no (4)
## : purpose in {car,education,renovations}: yes (23.8/7.2)
## : purpose = furniture/appliances:
## : :...amount > 4657: yes (6.3)
## : amount <= 4657:
## : :...job in {management,unemployed}: no (6.4)
## : job in {skilled,unskilled}:
## : :...months_loan_duration <= 16: no (12.7/2)
## : months_loan_duration > 16:
## : :...years_at_residence <= 3: yes (13.5/0.4)
## : years_at_residence > 3: no (11.4/4.6)
## checking_balance = 1 - 200 DM:
## :...amount > 12204: yes (11.7)
## amount <= 12204:
## :...savings_balance = unknown: no (23.5/1.8)
## savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM,
## : 500 - 1000 DM}:
## :...dependents > 1: yes (19.2/4.6)
## dependents <= 1:
## :...months_loan_duration > 22: yes (56.7/15.6)
## months_loan_duration <= 22:
## :...employment_duration = < 1 year: yes (14.4/5.5)
## employment_duration in {> 7 years,4 - 7 years,
## : unemployed}: no (24.4/6.5)
## employment_duration = 1 - 4 years:
## :...phone = yes: no (4.9)
## phone = no: [S1]
##
## SubTree [S1]
##
## savings_balance = 100 - 500 DM: no (5.7)
## savings_balance in {< 100 DM,> 1000 DM,500 - 1000 DM}:
## :...percent_of_income <= 3: yes (8.6/1.4)
## percent_of_income > 3:
## :...months_loan_duration <= 11: no (9.6)
## months_loan_duration > 11: yes (9.7/1.6)
##
## ----- Trial 9: -----
##
## Decision tree:
##
## checking_balance in {> 200 DM,unknown}:
## :...other_credit = store:
## : :...years_at_residence <= 1: no (3.3)
## : : years_at_residence > 1: yes (20.1/8.7)
## : other_credit = bank:
## : :...purpose = business: yes (7.3/2.6)
## : : purpose in {car0,education,furniture/appliances,
## : : : renovations}: no (33.7/6.6)
## : : purpose = car:
## : : :...months_loan_duration <= 16: no (3.7)
## : : months_loan_duration > 16:
## : : :...amount <= 7629: yes (11.3/0.7)
## : : amount > 7629: no (8.4/2.7)
## : other_credit = none:
## : :...age > 30: no (127.2/22.4)
## : age <= 30:
## : :...credit_history = perfect: no (1.1)
## : credit_history in {poor,very good}: yes (16/4.4)
## : credit_history in {critical,good}:
## : :...years_at_residence <= 1: no (8)
## : years_at_residence > 1:
## : :...percent_of_income <= 2: no (27.1/3)
## : percent_of_income > 2:
## : :...employment_duration in {< 1 year,
## : : 4 - 7 years}: no (19.9/5.8)
## : employment_duration in {> 7 years,
## : : unemployed}: yes (7.9/2.2)
## : employment_duration = 1 - 4 years:
## : :...checking_balance = > 200 DM: yes (5.2/0.5)
## : checking_balance = unknown:
## : :...age <= 22: yes (3.3/0.2)
## : age > 22: no (24.5/8.9)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history = perfect:
## :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM}: yes (24.5/5)
## : savings_balance in {500 - 1000 DM,unknown}: no (4.8)
## credit_history = very good:
## :...age <= 23: no (6.6)
## : age > 23: yes (37.9/11.2)
## credit_history = poor:
## :...percent_of_income <= 1: no (11.9)
## : percent_of_income > 1:
## : :...checking_balance = < 0 DM: yes (11.5/2)
## : checking_balance = 1 - 200 DM:
## : :...age <= 39: no (13.4/1.4)
## : age > 39: yes (13.2/3)
## credit_history = critical:
## :...savings_balance in {> 1000 DM,100 - 500 DM,500 - 1000 DM,
## : : unknown}: no (21.2/3.8)
## : savings_balance = < 100 DM:
## : :...months_loan_duration > 42: yes (5.6)
## : months_loan_duration <= 42:
## : :...housing = other: no (12.7/1.8)
## : housing in {own,rent}:
## : :...dependents > 1: no (11.5/2.1)
## : dependents <= 1:
## : :...purpose in {car0,education}: yes (4.9)
## : purpose = renovations: no (2.2)
## : purpose in {business,car,furniture/appliances}:
## : :...years_at_residence <= 1: no (3.7)
## : years_at_residence > 1:
## : :...amount <= 1922: no (26.6/7.3)
## : amount > 1922: yes (41.3/13.8)
## credit_history = good:
## :...amount > 8086: yes (24.1/4.8)
## amount <= 8086:
## :...savings_balance = > 1000 DM: no (7.9)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...months_loan_duration <= 7: no (16.5/1.4)
## months_loan_duration > 7:
## :...job = unemployed: no (2.1/0.8)
## job = management:
## :...savings_balance = 500 - 1000 DM: no (0)
## : savings_balance = unknown: yes (5.6/0.8)
## : savings_balance in {< 100 DM,100 - 500 DM}:
## : :...employment_duration in {< 1 year,1 - 4 years,
## : : 4 - 7 years,
## : : unemployed}: no (23/2.1)
## : employment_duration = > 7 years: yes (4.1/0.2)
## job = unskilled:
## :...percent_of_income <= 3: no (25/7.5)
## : percent_of_income > 3:
## : :...age <= 31: no (12/3.7)
## : age > 31: yes (23.8/6.5)
## job = skilled:
## :...months_loan_duration > 42: yes (14.5/2.3)
## months_loan_duration <= 42:
## :...housing = other: no (17.1/5.3)
## housing = rent:
## :...existing_loans_count > 1: yes (4.5)
## : existing_loans_count <= 1: [S1]
## housing = own:
## :...existing_loans_count > 1: no (9/1.6)
## existing_loans_count <= 1:
## :...age <= 22: yes (16.5/3.9)
## age > 22:
## :...checking_balance = 1 - 200 DM:
## :...years_at_residence <= 1: no (9.1)
## : years_at_residence > 1: yes (25.3/11.2)
## checking_balance = < 0 DM:
## :...dependents > 1: no (6.8/2)
## dependents <= 1: [S2]
##
## SubTree [S1]
##
## employment_duration in {> 7 years,unemployed}: no (5.2)
## employment_duration in {< 1 year,1 - 4 years,4 - 7 years}:
## :...phone = no: yes (19.9/5.2)
## phone = yes: no (5.3/1.1)
##
## SubTree [S2]
##
## months_loan_duration <= 16: no (15.9/3.2)
## months_loan_duration > 16: yes (21.1/7.9)
##
##
## Evaluation on training data (900 cases):
##
## Trial Decision Tree
## ----- ----------------
## Size Errors
##
## 0 69 99(11.0%)
## 1 50 167(18.6%)
## 2 48 182(20.2%)
## 3 64 175(19.4%)
## 4 63 176(19.6%)
## 5 50 178(19.8%)
## 6 56 162(18.0%)
## 7 55 179(19.9%)
## 8 54 191(21.2%)
## 9 57 171(19.0%)
## boost 13( 1.4%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 635 (a): class no
## 13 252 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 100.00% months_loan_duration
## 100.00% employment_duration
## 100.00% housing
## 99.33% amount
## 98.78% credit_history
## 94.67% dependents
## 94.00% savings_balance
## 92.56% percent_of_income
## 92.33% purpose
## 90.78% other_credit
## 86.22% job
## 85.78% years_at_residence
## 79.00% age
## 76.33% existing_loans_count
## 56.33% phone
##
##
## Time: 0.0 secs
Let’s see it in detail
Now, let’s use our model on testing data
credit_boost_pred10 <- predict( credit_boost10, credit_test)
CrossTable( credit_test $ default,
credit_boost_pred10,
prop.chisq = FALSE, prop.c = FALSE,
prop.r = FALSE,
dnn = c(' actual default', 'predicted default'))
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 100
##
##
## | predicted default
## actual default | no | yes | Row Total |
## ----------------|-----------|-----------|-----------|
## no | 52 | 13 | 65 |
## | 0.520 | 0.130 | |
## ----------------|-----------|-----------|-----------|
## yes | 17 | 18 | 35 |
## | 0.170 | 0.180 | |
## ----------------|-----------|-----------|-----------|
## Column Total | 69 | 31 | 100 |
## ----------------|-----------|-----------|-----------|
##
##
Boosting disadvantages:
Making mistakes more costlier than others
The most expensive cost in this scenario is:
Let’s create a matrix of weights
matrix_dimensions <- list( c(" no", "yes"), c(" no", "yes"))
names( matrix_dimensions) <- c(" predicted", "actual")
We will suppose that a loan default cost 4 times more than a missing opportunity
error_cost <- matrix( c( 0, 1, 4, 0),
nrow = 2,
dimnames = matrix_dimensions)
error_cost
## actual
## predicted no yes
## no 0 4
## yes 1 0
Now, let’s see how this cost can help us to improve our model
credit_cost <- C5.0( credit_train[-17],
credit_train $ default,
costs = error_cost)
credit_cost_pred <- predict( credit_cost, credit_test)
CrossTable( credit_test $ default,
credit_cost_pred, prop.chisq = FALSE,
prop.c = FALSE, prop.r = FALSE,
dnn = c('actual default', 'predicted default'))
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 100
##
##
## | predicted default
## actual default | no | yes | Row Total |
## ---------------|-----------|-----------|-----------|
## no | 39 | 26 | 65 |
## | 0.390 | 0.260 | |
## ---------------|-----------|-----------|-----------|
## yes | 7 | 28 | 35 |
## | 0.070 | 0.280 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 46 | 54 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
In general this model seems to be worse than our previous model. However, the mistakes are different