library(openxlsx)
library(tm)
library(car)
library(foreign)
library(readr)
library(dplyr)
library(RWeka)
library(RODBC)
library(class)
library(gmodels)
library(C50)
This project explores a basic application of “decision tree” classification. The data used are for practice and were drawn from credit data and text: “Machine Learning with R”.
C5.0 algorithm
# call data
credit<-read.xlsx("C:\\Users\\Jaire\\OneDrive\\Desktop\\Exploratory Research\\ML\\credit.xlsx")
# check data
str(credit)
## 'data.frame': 1000 obs. of 17 variables:
## $ checking_balance : chr "< 0 DM" "1 - 200 DM" "unknown" "< 0 DM" ...
## $ months_loan_duration: num 6 48 12 42 24 36 24 36 12 30 ...
## $ credit_history : chr "critical" "good" "critical" "good" ...
## $ purpose : chr "furniture/appliances" "furniture/appliances" "education" "furniture/appliances" ...
## $ amount : num 1169 5951 2096 7882 4870 ...
## $ savings_balance : chr "unknown" "< 100 DM" "< 100 DM" "< 100 DM" ...
## $ employment_duration : chr "> 7 years" "1 - 4 years" "4 - 7 years" "4 - 7 years" ...
## $ percent_of_income : num 4 2 2 2 3 2 3 2 2 4 ...
## $ years_at_residence : num 4 2 3 4 4 4 4 2 4 2 ...
## $ age : num 67 22 49 45 53 35 53 35 61 28 ...
## $ other_credit : chr "none" "none" "none" "none" ...
## $ housing : chr "own" "own" "own" "other" ...
## $ existing_loans_count: num 2 1 1 1 2 1 1 1 1 2 ...
## $ job : chr "skilled" "skilled" "unskilled" "skilled" ...
## $ dependents : num 1 1 2 2 2 2 1 1 1 1 ...
## $ phone : chr "yes" "no" "no" "no" ...
## $ default : chr "no" "yes" "no" "no" ...
# examine some features
table(credit$default)
##
## no yes
## 700 300
table(credit$dependents)
##
## 1 2
## 845 155
table(credit$housing)
##
## other own rent
## 108 713 179
table(credit$savings_balance)
##
## < 100 DM > 1000 DM 100 - 500 DM 500 - 1000 DM unknown
## 603 48 103 63 183
table(credit$checking_balance)
##
## < 0 DM > 200 DM 1 - 200 DM unknown
## 274 63 269 394
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
# randomize the order of raw data
set.seed(12345)
credit_r <- credit[order(runif(1000)), ]
# check randomization
table(credit$checking_balance)
##
## < 0 DM > 200 DM 1 - 200 DM unknown
## 274 63 269 394
table(credit_r$checking_balance)
##
## < 0 DM > 200 DM 1 - 200 DM unknown
## 274 63 269 394
# check order of feature values
head(credit$checking_balance)
## [1] "< 0 DM" "1 - 200 DM" "unknown" "< 0 DM" "< 0 DM"
## [6] "unknown"
head(credit_r$checking_balance)
## [1] "< 0 DM" "1 - 200 DM" "1 - 200 DM" "< 0 DM" "1 - 200 DM"
## [6] "unknown"
str(credit_r)
## 'data.frame': 1000 obs. of 17 variables:
## $ checking_balance : chr "< 0 DM" "1 - 200 DM" "1 - 200 DM" "< 0 DM" ...
## $ months_loan_duration: num 24 7 12 24 9 18 33 9 20 15 ...
## $ credit_history : chr "critical" "good" "good" "good" ...
## $ purpose : chr "car" "furniture/appliances" "furniture/appliances" "furniture/appliances" ...
## $ amount : num 1199 2576 1103 4020 1501 ...
## $ savings_balance : chr "< 100 DM" "< 100 DM" "< 100 DM" "< 100 DM" ...
## $ employment_duration : chr "> 7 years" "1 - 4 years" "4 - 7 years" "1 - 4 years" ...
## $ percent_of_income : num 4 2 4 2 2 3 1 4 2 4 ...
## $ years_at_residence : num 4 2 3 2 3 4 4 1 3 1 ...
## $ age : num 60 35 29 27 34 24 23 30 29 46 ...
## $ other_credit : chr "none" "none" "none" "store" ...
## $ housing : chr "own" "own" "own" "own" ...
## $ existing_loans_count: num 2 1 2 1 2 1 2 1 2 1 ...
## $ job : chr "unskilled" "skilled" "skilled" "skilled" ...
## $ dependents : num 1 1 1 1 1 1 1 1 1 1 ...
## $ phone : chr "no" "no" "no" "no" ...
## $ default : chr "yes" "no" "no" "no" ...
# create training (%90) and test data (%10)
credit_train <- credit_r[1:900, ]
credit_test <- credit_r[901:1000, ]
# check proportions of target vector
prop.table(table(credit_train$default))
##
## no yes
## 0.7022222 0.2977778
prop.table(table(credit_test$default))
##
## no yes
## 0.68 0.32
# train model, build classifier
credit_train$default<-as.factor(credit_train$default)
credit_model <- C5.0(credit_train[-17], credit_train$default)
# check decision tree object
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: 67
##
## Non-standard options: attempt to group attributes
# examine decisions
summary(credit_model)
##
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default)
##
##
## C5.0 [Release 2.07 GPL Edition] Mon Feb 6 23:56:17 2023
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## Decision tree:
##
## checking_balance = unknown: no (358/44)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...credit_history in {perfect,very good}:
## :...dependents > 1: yes (10/1)
## : dependents <= 1:
## : :...savings_balance = < 100 DM: yes (39/11)
## : savings_balance in {500 - 1000 DM,unknown,> 1000 DM}: no (8/1)
## : savings_balance = 100 - 500 DM:
## : :...checking_balance = < 0 DM: no (1)
## : checking_balance in {1 - 200 DM,> 200 DM}: yes (5/1)
## credit_history in {critical,good,poor}:
## :...months_loan_duration <= 11: no (87/14)
## months_loan_duration > 11:
## :...savings_balance = > 1000 DM: no (13)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...checking_balance = > 200 DM:
## :...dependents > 1: yes (3)
## : dependents <= 1:
## : :...credit_history in {good,poor}: no (23/3)
## : credit_history = critical:
## : :...amount <= 2337: yes (3)
## : amount > 2337: no (6)
## checking_balance = 1 - 200 DM:
## :...savings_balance = unknown: no (34/6)
## : savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## : :...months_loan_duration > 45: yes (11/1)
## : months_loan_duration <= 45:
## : :...other_credit = store:
## : :...age <= 35: yes (4)
## : : age > 35: no (2)
## : other_credit = none:
## : :...job = unemployed: no (1)
## : : job = unskilled: [S1]
## : : job = management:
## : : :...amount <= 7511: no (10/3)
## : : : amount > 7511: yes (7)
## : : job = skilled:
## : : :...dependents <= 1: no (55/15)
## : : dependents > 1:
## : : :...age <= 34: no (3)
## : : age > 34: yes (4)
## : other_credit = bank:
## : :...years_at_residence <= 1: no (3)
## : years_at_residence > 1:
## : :...existing_loans_count <= 1: yes (5)
## : existing_loans_count > 1:
## : :...percent_of_income <= 2: no (4/1)
## : percent_of_income > 2: yes (3)
## checking_balance = < 0 DM:
## :...job = management: no (26/6)
## job = unemployed: yes (4/1)
## job = unskilled:
## :...employment_duration in {4 - 7 years,
## : : unemployed}: no (4)
## : employment_duration = > 7 years:
## : :...other_credit in {none,bank}: no (5/1)
## : : other_credit = store: yes (2)
## : employment_duration = < 1 year:
## : :...other_credit in {none,store}: yes (11/2)
## : : other_credit = bank: no (1)
## : employment_duration = 1 - 4 years:
## : :...age <= 39: no (14/3)
## : age > 39:
## : :...credit_history in {critical,good}: yes (3)
## : credit_history = poor: no (1)
## job = skilled:
## :...credit_history = poor:
## :...savings_balance in {< 100 DM,100 - 500 DM,
## : : 500 - 1000 DM}: yes (8)
## : savings_balance = unknown: no (1)
## credit_history = critical:
## :...other_credit = store: no (0)
## : other_credit = bank: yes (4)
## : other_credit = none:
## : :...savings_balance in {100 - 500 DM,
## : : unknown}: no (1)
## : savings_balance = 500 - 1000 DM: yes (1)
## : savings_balance = < 100 DM:
## : :...months_loan_duration <= 13:
## : :...percent_of_income <= 3: yes (3)
## : : percent_of_income > 3: no (3/1)
## : months_loan_duration > 13:
## : :...amount <= 5293: no (10/1)
## : amount > 5293: yes (2)
## credit_history = good:
## :...existing_loans_count > 1: yes (5)
## existing_loans_count <= 1:
## :...other_credit = store: no (2)
## other_credit = bank:
## :...percent_of_income <= 2: yes (2)
## : percent_of_income > 2: no (6/1)
## other_credit = none: [S2]
##
## SubTree [S1]
##
## employment_duration in {> 7 years,4 - 7 years,unemployed}: no (8)
## employment_duration in {1 - 4 years,< 1 year}: yes (11/3)
##
## SubTree [S2]
##
## savings_balance = 100 - 500 DM: yes (3)
## savings_balance = 500 - 1000 DM: no (1)
## savings_balance = unknown:
## :...phone = no: yes (9/1)
## : phone = yes: no (3/1)
## savings_balance = < 100 DM:
## :...percent_of_income <= 1: no (4)
## percent_of_income > 1:
## :...phone = yes: yes (10/1)
## phone = no:
## :...purpose in {education,business,car0,renovations}: yes (3)
## purpose = car:
## :...percent_of_income <= 3: no (2)
## : percent_of_income > 3: yes (6/1)
## purpose = furniture/appliances:
## :...years_at_residence <= 1: no (4)
## years_at_residence > 1:
## :...housing = rent: yes (2)
## housing = other: no (1)
## housing = own:
## :...amount <= 1778: no (3)
## amount > 1778:
## :...years_at_residence <= 3: yes (6)
## years_at_residence > 3: no (3/1)
##
##
## Evaluation on training data (900 cases):
##
## Decision Tree
## ----------------
## Size Errors
##
## 66 125(13.9%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 609 23 (a): class no
## 102 166 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 60.22% credit_history
## 53.22% months_loan_duration
## 49.44% savings_balance
## 30.89% job
## 25.89% other_credit
## 17.78% dependents
## 9.67% existing_loans_count
## 7.22% percent_of_income
## 6.67% employment_duration
## 5.78% phone
## 5.56% amount
## 3.78% years_at_residence
## 3.44% age
## 3.33% purpose
## 1.67% housing
##
##
## Time: 0.0 secs
# create prediction vector
credit_pred <- predict(credit_model, credit_test)
# performance test
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 | 57 | 11 | 68 |
## | 0.570 | 0.110 | |
## ---------------|-----------|-----------|-----------|
## yes | 16 | 16 | 32 |
## | 0.160 | 0.160 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 73 | 27 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
The model classified 57% as true negatives (not likely to default), 11% as false positives, 16% as false negatives, and 16% as true positives (likely to default). The model has an accuracy rate of 73% and an error rate of 27%
# adaptive boosting
credit_boost10 <- C5.0(credit_train[-17], credit_train$default,
trials = 10)
# examine boosted model and decisions by trial
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: 51.8
##
## 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] Mon Feb 6 23:56:17 2023
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## ----- Trial 0: -----
##
## Decision tree:
##
## checking_balance = unknown: no (358/44)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...credit_history in {perfect,very good}:
## :...dependents > 1: yes (10/1)
## : dependents <= 1:
## : :...savings_balance = < 100 DM: yes (39/11)
## : savings_balance in {500 - 1000 DM,unknown,> 1000 DM}: no (8/1)
## : savings_balance = 100 - 500 DM:
## : :...checking_balance = < 0 DM: no (1)
## : checking_balance in {1 - 200 DM,> 200 DM}: yes (5/1)
## credit_history in {critical,good,poor}:
## :...months_loan_duration <= 11: no (87/14)
## months_loan_duration > 11:
## :...savings_balance = > 1000 DM: no (13)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...checking_balance = > 200 DM:
## :...dependents > 1: yes (3)
## : dependents <= 1:
## : :...credit_history in {good,poor}: no (23/3)
## : credit_history = critical:
## : :...amount <= 2337: yes (3)
## : amount > 2337: no (6)
## checking_balance = 1 - 200 DM:
## :...savings_balance = unknown: no (34/6)
## : savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## : :...months_loan_duration > 45: yes (11/1)
## : months_loan_duration <= 45:
## : :...other_credit = store:
## : :...age <= 35: yes (4)
## : : age > 35: no (2)
## : other_credit = none:
## : :...job = unemployed: no (1)
## : : job = unskilled: [S1]
## : : job = management:
## : : :...amount <= 7511: no (10/3)
## : : : amount > 7511: yes (7)
## : : job = skilled:
## : : :...dependents <= 1: no (55/15)
## : : dependents > 1:
## : : :...age <= 34: no (3)
## : : age > 34: yes (4)
## : other_credit = bank:
## : :...years_at_residence <= 1: no (3)
## : years_at_residence > 1:
## : :...existing_loans_count <= 1: yes (5)
## : existing_loans_count > 1:
## : :...percent_of_income <= 2: no (4/1)
## : percent_of_income > 2: yes (3)
## checking_balance = < 0 DM:
## :...job = management: no (26/6)
## job = unemployed: yes (4/1)
## job = unskilled:
## :...employment_duration in {4 - 7 years,
## : : unemployed}: no (4)
## : employment_duration = > 7 years:
## : :...other_credit in {none,bank}: no (5/1)
## : : other_credit = store: yes (2)
## : employment_duration = < 1 year:
## : :...other_credit in {none,store}: yes (11/2)
## : : other_credit = bank: no (1)
## : employment_duration = 1 - 4 years:
## : :...age <= 39: no (14/3)
## : age > 39:
## : :...credit_history in {critical,good}: yes (3)
## : credit_history = poor: no (1)
## job = skilled:
## :...credit_history = poor:
## :...savings_balance in {< 100 DM,100 - 500 DM,
## : : 500 - 1000 DM}: yes (8)
## : savings_balance = unknown: no (1)
## credit_history = critical:
## :...other_credit = store: no (0)
## : other_credit = bank: yes (4)
## : other_credit = none:
## : :...savings_balance in {100 - 500 DM,
## : : unknown}: no (1)
## : savings_balance = 500 - 1000 DM: yes (1)
## : savings_balance = < 100 DM:
## : :...months_loan_duration <= 13:
## : :...percent_of_income <= 3: yes (3)
## : : percent_of_income > 3: no (3/1)
## : months_loan_duration > 13:
## : :...amount <= 5293: no (10/1)
## : amount > 5293: yes (2)
## credit_history = good:
## :...existing_loans_count > 1: yes (5)
## existing_loans_count <= 1:
## :...other_credit = store: no (2)
## other_credit = bank:
## :...percent_of_income <= 2: yes (2)
## : percent_of_income > 2: no (6/1)
## other_credit = none: [S2]
##
## SubTree [S1]
##
## employment_duration in {> 7 years,4 - 7 years,unemployed}: no (8)
## employment_duration in {1 - 4 years,< 1 year}: yes (11/3)
##
## SubTree [S2]
##
## savings_balance = 100 - 500 DM: yes (3)
## savings_balance = 500 - 1000 DM: no (1)
## savings_balance = unknown:
## :...phone = no: yes (9/1)
## : phone = yes: no (3/1)
## savings_balance = < 100 DM:
## :...percent_of_income <= 1: no (4)
## percent_of_income > 1:
## :...phone = yes: yes (10/1)
## phone = no:
## :...purpose in {education,business,car0,renovations}: yes (3)
## purpose = car:
## :...percent_of_income <= 3: no (2)
## : percent_of_income > 3: yes (6/1)
## purpose = furniture/appliances:
## :...years_at_residence <= 1: no (4)
## years_at_residence > 1:
## :...housing = rent: yes (2)
## housing = other: no (1)
## housing = own:
## :...amount <= 1778: no (3)
## amount > 1778:
## :...years_at_residence <= 3: yes (6)
## years_at_residence > 3: no (3/1)
##
## ----- Trial 1: -----
##
## Decision tree:
##
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (29/8.6)
## : savings_balance = 100 - 500 DM:
## : :...credit_history in {critical,poor,perfect}: no (18/3.2)
## : : credit_history in {good,very good}: yes (30.5/9.5)
## : savings_balance = unknown:
## : :...credit_history in {critical,poor,perfect}: no (16.6)
## : : credit_history in {good,very good}:
## : : :...job in {unskilled,unemployed}: no (7.9/0.8)
## : : job = management: yes (9.3/2.4)
## : : job = skilled:
## : : :...purpose in {business,car0,renovations}: yes (0)
## : : purpose = education: no (3.2)
## : : purpose in {car,furniture/appliances}:
## : : :...months_loan_duration <= 18: yes (16.2/3.2)
## : : months_loan_duration > 18: no (16.5/7)
## : savings_balance = < 100 DM:
## : :...months_loan_duration > 47: yes (24.3/3.1)
## : months_loan_duration <= 47:
## : :...job = unemployed: yes (7/3.1)
## : job = unskilled:
## : :...housing = own: no (66.4/20.3)
## : : housing in {rent,other}: yes (14.2/4.7)
## : job = skilled:
## : :...percent_of_income > 2: yes (109.5/40.2)
## : : percent_of_income <= 2:
## : : :...employment_duration in {> 7 years,4 - 7 years,
## : : : < 1 year}: yes (36/15)
## : : employment_duration in {1 - 4 years,
## : : unemployed}: no (31.3/7)
## : job = management:
## : :...existing_loans_count > 2: no (3.2)
## : existing_loans_count <= 2:
## : :...employment_duration in {> 7 years,
## : : 1 - 4 years}: yes (30.3/7.1)
## : employment_duration in {4 - 7 years,
## : : < 1 year}: no (9.4/0.8)
## : employment_duration = unemployed:
## : :...percent_of_income <= 2: no (4.7)
## : percent_of_income > 2: yes (13.9/4)
## checking_balance in {unknown,> 200 DM}:
## :...other_credit in {store,bank}:
## :...purpose = renovations: yes (0)
## : purpose in {furniture/appliances,car0}: no (31.4/6.9)
## : purpose in {car,education,business}:
## : :...percent_of_income <= 1: no (7/2.3)
## : percent_of_income > 1: yes (44.8/11.1)
## other_credit = none:
## :...credit_history in {critical,perfect}: no (116.7/10.1)
## credit_history in {good,poor,very good}:
## :...existing_loans_count > 1:
## :...employment_duration = 4 - 7 years: no (7.9)
## : employment_duration in {> 7 years,1 - 4 years,< 1 year,
## : : unemployed}:
## : :...job in {management,unemployed}: yes (6.9)
## : job in {unskilled,skilled}:
## : :...years_at_residence <= 1: yes (4.6)
## : years_at_residence > 1:
## : :...years_at_residence <= 3: no (15.7/2.3)
## : years_at_residence > 3: yes (15.5/4)
## existing_loans_count <= 1:
## :...credit_history = poor: yes (9.3/2.4)
## credit_history = very good: no (1.6/0.8)
## credit_history = good:
## :...phone = yes: no (54.4/4.6)
## phone = no:
## :...job in {management,unemployed}: no (2.4)
## job = unskilled:
## :...checking_balance = > 200 DM: yes (10.1/2.4)
## : checking_balance = unknown:
## : :...percent_of_income <= 3: no (9.5)
## : percent_of_income > 3: yes (9.3/2.4)
## job = skilled:
## :...savings_balance in {100 - 500 DM,500 - 1000 DM,
## : unknown,
## : > 1000 DM}: no (23.7)
## savings_balance = < 100 DM:
## :...years_at_residence <= 2: no (19.6/4.6)
## years_at_residence > 2: yes (12.4/3.2)
##
## ----- Trial 2: -----
##
## Decision tree:
##
## months_loan_duration <= 8:
## :...existing_loans_count > 1: no (19.1)
## : existing_loans_count <= 1:
## : :...amount <= 3161: no (45.5/7.7)
## : amount > 3161: yes (6.3/0.6)
## months_loan_duration > 8:
## :...checking_balance = unknown:
## :...other_credit = bank:
## : :...age <= 44: yes (40.5/11.9)
## : : age > 44: no (11.5/1.9)
## : other_credit in {none,store}:
## : :...age > 30: no (147.2/21.8)
## : age <= 30:
## : :...amount > 6458: yes (16/2.6)
## : amount <= 6458:
## : :...age <= 22: yes (17.4/5.9)
## : age > 22: no (62.8/15.3)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...employment_duration = 4 - 7 years:
## :...months_loan_duration <= 22: no (44.7/6.7)
## : months_loan_duration > 22:
## : :...job in {unskilled,skilled,unemployed}: yes (35.9/15.8)
## : job = management: no (4.6/0.6)
## employment_duration = unemployed:
## :...months_loan_duration > 33: no (11.4)
## : months_loan_duration <= 33:
## : :...phone = no: yes (11/2.7)
## : phone = yes: no (15.5/6.5)
## employment_duration = > 7 years:
## :...amount > 6948: yes (13/1.3)
## : amount <= 6948:
## : :...purpose in {education,business,car0}: yes (22.8/7.8)
## : purpose = renovations: no (1.3)
## : purpose = car:
## : :...job = unemployed: no (0)
## : : job = unskilled: yes (6.9)
## : : job in {skilled,management}:
## : : :...years_at_residence <= 1: yes (2.5)
## : : years_at_residence > 1: no (28.6/7.1)
## : purpose = furniture/appliances:
## : :...other_credit in {store,bank}: yes (7.3/2.1)
## : other_credit = none:
## : :...job in {unskilled,skilled,unemployed}: no (29.2/3.4)
## : job = management: yes (5.1/1.3)
## employment_duration = 1 - 4 years:
## :...savings_balance = > 1000 DM: no (6.4)
## : savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## : :...housing = other: yes (12/1.9)
## : housing in {own,rent}:
## : :...credit_history in {poor,perfect,very good}: no (29.3/8.6)
## : credit_history = critical:
## : :...months_loan_duration <= 16: no (10.6/0.6)
## : : months_loan_duration > 16: yes (14.5/4.1)
## : credit_history = good:
## : :...phone = no: yes (81.6/33.5)
## : phone = yes: no (30.2/11)
## employment_duration = < 1 year:
## :...savings_balance in {100 - 500 DM,500 - 1000 DM}: yes (15.6/3.4)
## savings_balance in {unknown,> 1000 DM}: no (9.1/1.9)
## savings_balance = < 100 DM:
## :...housing = other: no (4.7)
## housing in {own,rent}:
## :...years_at_residence > 1: yes (41.6/11)
## years_at_residence <= 1:
## :...job in {unskilled,management}: no (13.9/4.9)
## job = unemployed: yes (2.1)
## job = skilled:
## :...percent_of_income <= 3: yes (12.3/3.3)
## percent_of_income > 3: no (9.7/0.6)
##
## ----- Trial 3: -----
##
## Decision tree:
##
## amount > 11054:
## :...credit_history in {critical,good,perfect,very good}: yes (26.4/3.9)
## : credit_history = poor: no (3.7)
## amount <= 11054:
## :...employment_duration = 4 - 7 years:
## :...age <= 22: yes (7.7/1.3)
## : age > 22:
## : :...checking_balance = unknown: no (41.5/1.6)
## : checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## : :...purpose in {furniture/appliances,education,business,
## : : car0}: no (52.1/10.6)
## : purpose = renovations: yes (1.3)
## : purpose = car:
## : :...amount <= 1715: yes (14/3.4)
## : amount > 1715: no (20.6/3.2)
## employment_duration in {> 7 years,1 - 4 years,< 1 year,unemployed}:
## :...credit_history = very good: yes (40.8/17.3)
## credit_history = perfect:
## :...other_credit in {none,bank}: no (25.8/11.7)
## : other_credit = store: yes (4.5)
## credit_history = critical:
## :...other_credit = store: no (9.9/4.6)
## : other_credit = none:
## : :...purpose in {car,furniture/appliances,business,car0,
## : : : renovations}: no (132.6/29.1)
## : : purpose = education: yes (15.1/4.9)
## : other_credit = bank:
## : :...job in {unskilled,skilled,unemployed}: yes (18.1/6.5)
## : job = management: no (4.8)
## credit_history = poor:
## :...phone = no:
## : :...age <= 46: no (26.1/3.8)
## : : age > 46: yes (7.7/1.1)
## : phone = yes:
## : :...dependents <= 1: yes (31.1/8.9)
## : dependents > 1: no (3.5)
## credit_history = good:
## :...existing_loans_count > 1:
## :...job = unskilled: no (2.9)
## : job in {management,unemployed}: yes (4.1)
## : job = skilled:
## : :...percent_of_income > 3: no (10.3/1.1)
## : percent_of_income <= 3:
## : :...months_loan_duration <= 24: yes (19.3/1.7)
## : months_loan_duration > 24: no (2.6)
## existing_loans_count <= 1:
## :...months_loan_duration > 33:
## :...percent_of_income <= 2: no (13.6/3.3)
## : percent_of_income > 2: yes (33.7/7.8)
## months_loan_duration <= 33:
## :...purpose in {education,renovations}: yes (22.2/9)
## purpose in {business,car0}: no (18.4/1.8)
## purpose = car:
## :...checking_balance in {unknown,> 200 DM}: no (33.6/5.6)
## : checking_balance in {< 0 DM,1 - 200 DM}:
## : :...employment_duration = < 1 year: yes (16.6/2.2)
## : employment_duration = unemployed: no (7.1)
## : employment_duration in {> 7 years,1 - 4 years}:
## : :...housing = rent: no (7.8/2.4)
## : housing = other: yes (3.9/1.1)
## : housing = own:
## : :...phone = no: yes (17.1/5.6)
## : phone = yes: no (8.8/1.3)
## purpose = furniture/appliances:
## :...savings_balance in {100 - 500 DM,500 - 1000 DM,
## : > 1000 DM}: no (30.9/8.4)
## savings_balance = unknown:
## :...checking_balance in {< 0 DM,
## : : 1 - 200 DM}: yes (18.5/5.7)
## : checking_balance in {unknown,
## : > 200 DM}: no (5.9)
## savings_balance = < 100 DM:
## :...job in {skilled,management}: no (96.2/30.7)
## job = unemployed: yes (0.5)
## job = unskilled:
## :...checking_balance in {unknown,
## : > 200 DM}: yes (10.7/2.1)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...phone = no: no (25.3/5)
## phone = yes: yes (3.1/0.5)
##
## ----- Trial 4: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...employment_duration in {> 7 years,4 - 7 years}: no (137.6/26.1)
## : employment_duration in {1 - 4 years,< 1 year,unemployed}:
## : :...job = management:
## : :...years_at_residence <= 3: yes (25.4/6)
## : : years_at_residence > 3: no (3.3)
## : job in {unskilled,skilled,unemployed}:
## : :...months_loan_duration <= 16:
## : :...dependents > 1: no (10.9)
## : : dependents <= 1:
## : : :...job in {skilled,unemployed}: no (44.1/6.8)
## : : job = unskilled:
## : : :...existing_loans_count <= 1: yes (15.9/5.2)
## : : existing_loans_count > 1: no (6.9)
## : months_loan_duration > 16:
## : :...housing = rent: yes (17.4/4.5)
## : housing in {own,other}:
## : :...other_credit in {store,bank}: yes (22.7/8.3)
## : other_credit = none:
## : :...percent_of_income <= 1: yes (5.6/1.4)
## : percent_of_income > 1:
## : :...months_loan_duration <= 18: yes (16.6/7.1)
## : months_loan_duration > 18: no (29.7/2)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...savings_balance in {unknown,> 1000 DM}: no (92.2/28)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
## :...months_loan_duration > 47: yes (33.3/6)
## months_loan_duration <= 47:
## :...dependents > 1:
## :...credit_history = critical: no (13.2/1.1)
## : credit_history in {poor,perfect,very good}: yes (9.8/1.9)
## : credit_history = good:
## : :...percent_of_income <= 3: no (20.1/4.8)
## : percent_of_income > 3: yes (14.9/4.9)
## dependents <= 1:
## :...housing = other: no (24.7/10.5)
## housing = rent:
## :...credit_history = poor: no (5/0.4)
## : credit_history = perfect: yes (5.7)
## : credit_history in {critical,good,very good}:
## : :...phone = yes:
## : :...amount <= 2613: no (3.3/0.4)
## : : amount > 2613: yes (21.4/2.4)
## : phone = no:
## : :...job in {unskilled,management}: no (10.9/2.6)
## : job = unemployed: yes (0.4)
## : job = skilled:
## : :...months_loan_duration <= 13: yes (11.7/1)
## : months_loan_duration > 13: no (22.6/9.5)
## housing = own:
## :...years_at_residence <= 1: no (56.4/20)
## years_at_residence > 1:
## :...job = unemployed: no (2)
## job = management:
## :...checking_balance = < 0 DM: no (8.1/2.6)
## : checking_balance = 1 - 200 DM: yes (19.2/4.5)
## job = unskilled:
## :...purpose in {education,business,car0,
## : : renovations}: no (5.8)
## : purpose in {car,furniture/appliances}:
## : :...months_loan_duration <= 11: no (10.9/2)
## : months_loan_duration > 11: yes (38.6/7.8)
## job = skilled:
## :...savings_balance in {100 - 500 DM,
## : 500 - 1000 DM}: no (23/5.7)
## savings_balance = < 100 DM:
## :...other_credit in {store,bank}: yes (15.5/3.4)
## other_credit = none:
## :...years_at_residence > 2: no (59/24.7)
## years_at_residence <= 2:
## :...months_loan_duration <= 8: no (3.3)
## months_loan_duration > 8: [S1]
##
## SubTree [S1]
##
## credit_history in {critical,good,very good}: yes (30.2/6.9)
## credit_history in {poor,perfect}: no (2.9)
##
## ----- Trial 5: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...purpose = car0: no (1.6)
## : purpose = renovations: yes (7/2.6)
## : purpose = education:
## : :...savings_balance in {< 100 DM,500 - 1000 DM,unknown,
## : : : > 1000 DM}: no (22.6/4.4)
## : : savings_balance = 100 - 500 DM: yes (5.8/0.9)
## : purpose = business:
## : :...job in {unskilled,skilled}: no (26.2/8.4)
## : : job in {management,unemployed}: yes (11.6/2.9)
## : purpose = car:
## : :...other_credit in {none,store}:
## : : :...amount <= 11760: no (80.1/15.5)
## : : : amount > 11760: yes (2.6)
## : : other_credit = bank:
## : : :...housing = own: yes (15.9/5)
## : : housing in {rent,other}: no (9.4/3.2)
## : purpose = furniture/appliances:
## : :...age > 44: no (20.7)
## : age <= 44:
## : :...credit_history in {critical,poor,very good}: no (48.3/11)
## : credit_history = perfect: yes (2.2/0.7)
## : credit_history = good:
## : :...existing_loans_count <= 1: no (64.6/20.5)
## : existing_loans_count > 1: yes (13.8/3.2)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...checking_balance = < 0 DM:
## :...job = unemployed: yes (6.2/2)
## : job = skilled:
## : :...months_loan_duration <= 11: no (15.8/4.4)
## : : months_loan_duration > 11:
## : : :...dependents <= 1: yes (141.1/43.6)
## : : dependents > 1:
## : : :...existing_loans_count <= 1: no (16.2/6.2)
## : : existing_loans_count > 1: yes (5.8/0.8)
## : job = management:
## : :...percent_of_income <= 1: yes (3.7)
## : : percent_of_income > 1:
## : : :...percent_of_income <= 2: no (4)
## : : percent_of_income > 2:
## : : :...employment_duration in {> 7 years,
## : : : 1 - 4 years}: yes (17.6/6.3)
## : : employment_duration in {4 - 7 years,< 1 year,
## : : unemployed}: no (13.6/1.8)
## : job = unskilled:
## : :...purpose in {education,business,car0}: no (6.4/0.4)
## : purpose = renovations: yes (2.3)
## : purpose = car:
## : :...phone = no: yes (23.8/7.8)
## : : phone = yes: no (3.7)
## : purpose = furniture/appliances:
## : :...percent_of_income <= 1: no (2.8)
## : percent_of_income > 1:
## : :...other_credit in {store,bank}: yes (5.9/1.4)
## : other_credit = none:
## : :...months_loan_duration <= 15: no (7.9/0.9)
## : months_loan_duration > 15: yes (12.5/2.8)
## checking_balance = 1 - 200 DM:
## :...savings_balance = 500 - 1000 DM: yes (8.6/3.1)
## savings_balance in {unknown,> 1000 DM}: no (58.6/19.2)
## savings_balance = 100 - 500 DM:
## :...credit_history in {critical,poor}: no (13.9/2.2)
## : credit_history in {perfect,very good}: yes (9.4/1.1)
## : credit_history = good:
## : :...months_loan_duration <= 30: no (14.9/4.8)
## : months_loan_duration > 30: yes (5.5)
## savings_balance = < 100 DM:
## :...months_loan_duration > 42: yes (9.2)
## months_loan_duration <= 42:
## :...amount > 9283: yes (7.9)
## amount <= 9283:
## :...amount > 5433:
## :...amount <= 8133: no (16.4)
## : amount > 8133: yes (5.3/1.8)
## amount <= 5433:
## :...months_loan_duration > 22: yes (42.2/11.8)
## months_loan_duration <= 22:
## :...amount > 1965:
## :...percent_of_income <= 3: no (20.9/0.9)
## : percent_of_income > 3: yes (2.4/0.4)
## amount <= 1965:
## :...percent_of_income <= 3:
## :...months_loan_duration <= 7: no (2)
## : months_loan_duration > 7: yes (23.1/3.9)
## percent_of_income > 3:
## :...existing_loans_count > 1: no (7.9)
## existing_loans_count <= 1:
## :...age <= 29: no (15.2/1.8)
## age > 29: yes (14.9/3.9)
##
## ----- Trial 6: -----
##
## Decision tree:
##
## housing in {rent,other}:
## :...job = unemployed: no (5/2.5)
## : job = unskilled:
## : :...housing = other: yes (8.1/0.6)
## : : housing = rent:
## : : :...months_loan_duration <= 33: no (32.8/12.7)
## : : months_loan_duration > 33: yes (3.9)
## : job = management:
## : :...amount <= 3275: no (13.6)
## : : amount > 3275:
## : : :...months_loan_duration <= 28: yes (17.1/3.7)
## : : months_loan_duration > 28: no (17.5/4.4)
## : job = skilled:
## : :...percent_of_income <= 2:
## : :...credit_history in {critical,poor,very good}: no (24.3/8.6)
## : : credit_history = perfect: yes (1.1)
## : : credit_history = good:
## : : :...existing_loans_count > 1: yes (7.8)
## : : existing_loans_count <= 1:
## : : :...percent_of_income <= 1: yes (16.8/6.7)
## : : percent_of_income > 1: no (13.6/1.2)
## : percent_of_income > 2:
## : :...years_at_residence <= 1: no (7.6/1.7)
## : years_at_residence > 1:
## : :...phone = no: yes (61.5/15.4)
## : phone = yes:
## : :...other_credit = store: yes (3.2)
## : other_credit = bank: no (7.2/1.4)
## : other_credit = none:
## : :...percent_of_income <= 3: yes (10.7/2.3)
## : percent_of_income > 3:
## : :...checking_balance = < 0 DM: yes (7.5/1)
## : checking_balance in {1 - 200 DM,unknown,
## : > 200 DM}: no (12.2/1.7)
## housing = own:
## :...savings_balance = > 1000 DM: no (19.9/1.4)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...credit_history = very good:
## :...amount > 5381: yes (4.5)
## : amount <= 5381:
## : :...other_credit = none: yes (5.3/0.8)
## : other_credit in {store,bank}: no (19.4/6.1)
## credit_history = perfect:
## :...other_credit = store: yes (3.5)
## : other_credit in {none,bank}:
## : :...percent_of_income > 3: yes (7.9/2.1)
## : percent_of_income <= 3:
## : :...age <= 30: yes (7.5/2.8)
## : age > 30: no (13.3/0.7)
## credit_history = critical:
## :...years_at_residence <= 1: no (9.9)
## : years_at_residence > 1:
## : :...age > 35: no (66.6/8.5)
## : age <= 35:
## : :...checking_balance in {< 0 DM,> 200 DM}: yes (21.7/9.3)
## : checking_balance = 1 - 200 DM:
## : :...months_loan_duration <= 15: no (4.3/0.9)
## : : months_loan_duration > 15: yes (18.8/4.1)
## : checking_balance = unknown:
## : :...other_credit = none: no (22.7/2)
## : other_credit in {store,bank}: yes (12.5/3.6)
## credit_history = poor:
## :...savings_balance in {500 - 1000 DM,unknown}: no (6.6)
## : savings_balance in {< 100 DM,100 - 500 DM}:
## : :...years_at_residence <= 1: yes (8.2/0.3)
## : years_at_residence > 1:
## : :...percent_of_income <= 1: no (7.5)
## : percent_of_income > 1:
## : :...job in {management,unemployed}: yes (12.3/0.3)
## : job in {unskilled,skilled}:
## : :...existing_loans_count <= 1: yes (4.1/0.7)
## : existing_loans_count > 1: no (18/6.1)
## credit_history = good:
## :...purpose = education: yes (18.3/7.1)
## purpose in {car0,renovations}: no (12.2/5.6)
## purpose = business:
## :...months_loan_duration <= 18: no (10)
## : months_loan_duration > 18: yes (9/3.9)
## purpose = furniture/appliances:
## :...employment_duration = unemployed: yes (11.9/1.5)
## : employment_duration in {> 7 years,1 - 4 years,4 - 7 years,
## : : < 1 year}:
## : :...months_loan_duration > 33:
## : :...years_at_residence <= 1: no (4.4/0.8)
## : : years_at_residence > 1: yes (18.9/3.9)
## : months_loan_duration <= 33:
## : :...phone = no: no (124.5/43.9)
## : phone = yes:
## : :...years_at_residence > 3: no (10.1/1.4)
## : years_at_residence <= 3:
## : :...job = unskilled: yes (3.5/0.8)
## : job in {management,unemployed}: no (1.5)
## : job = skilled:
## : :...amount <= 1393: no (4.3)
## : amount > 1393: yes (23.1/5.9)
## purpose = car:
## :...existing_loans_count > 1: no (4.3)
## existing_loans_count <= 1:
## :...checking_balance in {unknown,> 200 DM}: no (25.2/3.2)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...dependents > 1: no (8.1/1.8)
## dependents <= 1:
## :...amount <= 1103: yes (9.1)
## amount > 1103:
## :...percent_of_income <= 1: no (5.1/1.6)
## percent_of_income > 1:
## :...amount <= 1213: no (5.9)
## amount > 1213:
## :...years_at_residence <= 1: yes (5.5)
## years_at_residence > 1: [S1]
##
## SubTree [S1]
##
## months_loan_duration <= 13: no (8.2/1.4)
## months_loan_duration > 13: yes (11.4/2.5)
##
## ----- Trial 7: -----
##
## Decision tree:
##
## credit_history = critical:
## :...other_credit = store: yes (10.8/5.4)
## : other_credit = bank:
## : :...housing = rent: yes (4.9)
## : : housing in {own,other}:
## : : :...phone = yes: no (7.7/0.2)
## : : phone = no:
## : : :...existing_loans_count <= 1: yes (5.6)
## : : existing_loans_count > 1: no (15.8/4.7)
## : other_credit = none:
## : :...checking_balance = unknown:
## : :...amount <= 6967: no (48.1/2.7)
## : : amount > 6967: yes (7.9/2.4)
## : checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## : :...savings_balance in {100 - 500 DM,unknown,> 1000 DM}: no (21.7/5.2)
## : savings_balance = 500 - 1000 DM: yes (6.6/1.7)
## : savings_balance = < 100 DM:
## : :...dependents > 1: no (11.6/2.1)
## : dependents <= 1:
## : :...amount > 7308: yes (4.6)
## : amount <= 7308:
## : :...employment_duration in {1 - 4 years,4 - 7 years,
## : : unemployed}: no (33.6/8.4)
## : employment_duration = < 1 year: yes (11.8/5.2)
## : employment_duration = > 7 years:
## : :...existing_loans_count <= 1: no (4.2)
## : existing_loans_count > 1:
## : :...existing_loans_count > 2: no (2.9)
## : existing_loans_count <= 2:
## : :...age <= 30: no (4.3)
## : age > 30:
## : :...age <= 61: yes (15.6/2.3)
## : age > 61: no (3.9)
## credit_history in {good,poor,perfect,very good}:
## :...savings_balance = 500 - 1000 DM: no (33.5/10.5)
## savings_balance = > 1000 DM:
## :...purpose in {car,furniture/appliances,car0}: no (11.9)
## : purpose in {education,business,renovations}: yes (8/1.7)
## savings_balance = 100 - 500 DM:
## :...purpose in {furniture/appliances,education}: yes (31.6/10.7)
## : purpose in {business,car0,renovations}: no (12.8/1.9)
## : purpose = car:
## : :...checking_balance in {< 0 DM,unknown}: no (8.2)
## : checking_balance in {1 - 200 DM,> 200 DM}:
## : :...amount <= 2746: yes (10.3)
## : amount > 2746: no (8.4/2.7)
## savings_balance = unknown:
## :...months_loan_duration <= 9: no (8.5)
## : months_loan_duration > 9:
## : :...employment_duration = 4 - 7 years: no (13.4/1.1)
## : employment_duration in {> 7 years,1 - 4 years,< 1 year,unemployed}:
## : :...purpose in {education,business,renovations}: no (20.2/5.1)
## : purpose = car0: yes (2.8/0.6)
## : purpose = furniture/appliances:
## : :...months_loan_duration > 33: no (3)
## : : months_loan_duration <= 33:
## : : :...amount <= 1459: no (5.4/0.7)
## : : amount > 1459: yes (22.4/6.5)
## : purpose = car:
## : :...job = unskilled: yes (6.2/0.8)
## : job in {management,unemployed}: no (5.2/1.2)
## : job = skilled:
## : :...employment_duration in {< 1 year,
## : : unemployed}: no (5)
## : employment_duration in {> 7 years,1 - 4 years}:
## : :...amount <= 6615: no (17.7/7.1)
## : amount > 6615: yes (8/0.2)
## savings_balance = < 100 DM:
## :...amount > 9283: yes (22.8/2.4)
## amount <= 9283:
## :...percent_of_income <= 1: no (49.3/15.7)
## percent_of_income > 1:
## :...credit_history = very good: yes (23.1/4.7)
## credit_history = poor:
## :...months_loan_duration <= 16: no (9.3/1.2)
## : months_loan_duration > 16: yes (32.6/6.2)
## credit_history = perfect:
## :...housing in {rent,other}: yes (5.5)
## : housing = own:
## : :...other_credit in {none,bank}: no (17.4/4.8)
## : other_credit = store: yes (2.9)
## credit_history = good:
## :...existing_loans_count > 1:
## :...age <= 26: yes (4.2)
## : age > 26: no (15.8)
## existing_loans_count <= 1:
## :...purpose in {education,renovations}: yes (19.9/4.4)
## purpose in {business,car0}: no (13.2/4)
## purpose = car:
## :...other_credit in {store,bank}: yes (7.7/1.7)
## : other_credit = none:
## : :...age <= 25: yes (11.8/1.2)
## : age > 25: no (37.5/13.4)
## purpose = furniture/appliances:
## :...dependents > 1:
## :...months_loan_duration <= 13: no (3.9)
## : months_loan_duration > 13: yes (18.2/3.3)
## dependents <= 1:
## :...years_at_residence <= 1:
## :...amount <= 1391: yes (7.7/2.7)
## : amount > 1391: no (19.3/0.7)
## years_at_residence > 1:
## :...age <= 22: yes (15.5/1.2)
## age > 22: [S1]
##
## SubTree [S1]
##
## employment_duration in {> 7 years,4 - 7 years,unemployed}: no (29.3/8.6)
## employment_duration = < 1 year: yes (17.8/8.4)
## employment_duration = 1 - 4 years:
## :...other_credit = store: no (1.9)
## other_credit = bank: yes (5.1)
## other_credit = none:
## :...housing = rent: no (5)
## housing = other: yes (0.7)
## housing = own:
## :...months_loan_duration > 30: yes (7.5/1)
## months_loan_duration <= 30:
## :...months_loan_duration > 21: no (5.5)
## months_loan_duration <= 21:
## :...percent_of_income <= 3: yes (15.8/5.3)
## percent_of_income > 3: no (9.6/2.8)
##
## ----- Trial 8: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...months_loan_duration <= 8: no (14.7)
## : months_loan_duration > 8:
## : :...other_credit = bank:
## : :...years_at_residence > 2: no (26.1/8.6)
## : : years_at_residence <= 2:
## : : :...dependents <= 1: yes (25.8/6.5)
## : : dependents > 1: no (2.3)
## : other_credit in {none,store}:
## : :...age <= 23:
## : :...savings_balance = < 100 DM: yes (18/3.6)
## : : savings_balance in {100 - 500 DM,500 - 1000 DM,unknown,
## : : > 1000 DM}: no (7)
## : age > 23:
## : :...employment_duration = 4 - 7 years: no (22.4)
## : employment_duration in {> 7 years,1 - 4 years,< 1 year,
## : : unemployed}:
## : :...purpose in {car,furniture/appliances,education,car0,
## : : renovations}: no (130.2/25.6)
## : purpose = business:
## : :...existing_loans_count <= 1: no (6.5/1.6)
## : existing_loans_count > 1: yes (15.1/4.8)
## checking_balance in {< 0 DM,1 - 200 DM,> 200 DM}:
## :...credit_history = poor:
## :...percent_of_income <= 1: no (5.9)
## : percent_of_income > 1:
## : :...employment_duration in {> 7 years,< 1 year,
## : : unemployed}: yes (17.7/4.3)
## : employment_duration in {1 - 4 years,4 - 7 years}: no (17.7/3.3)
## credit_history = perfect:
## :...percent_of_income > 3: yes (10.9)
## : percent_of_income <= 3:
## : :...housing = own: no (14.6/3.7)
## : housing in {rent,other}: yes (4.9)
## credit_history = very good:
## :...age <= 23: no (4.7)
## : age > 23:
## : :...amount <= 409: no (3.7)
## : amount > 409: yes (35.8/7.5)
## credit_history = critical:
## :...other_credit = store: no (5.6/0.5)
## : other_credit = bank: yes (14/6.2)
## : other_credit = none:
## : :...percent_of_income <= 1: no (10.8/3.3)
## : percent_of_income > 1:
## : :...phone = yes: no (41.8/13.6)
## : phone = no:
## : :...amount <= 2122: no (39.7/13.3)
## : amount > 2122: yes (24.4/7.3)
## credit_history = good:
## :...savings_balance = > 1000 DM: no (6.6)
## savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
## :...amount > 8648: yes (19.7/2.8)
## amount <= 8648:
## :...months_loan_duration <= 7: no (18.2/2.2)
## months_loan_duration > 7:
## :...purpose in {education,business,car0,
## : renovations}: no (39.7/12.1)
## purpose = car:
## :...employment_duration = unemployed: no (5.5)
## : employment_duration in {> 7 years,1 - 4 years,
## : : 4 - 7 years,< 1 year}:
## : :...job in {unskilled,skilled}: yes (81.2/24.6)
## : job in {management,unemployed}: no (9.6/2.2)
## purpose = furniture/appliances:
## :...housing = other: no (11.8/4.2)
## housing = own:
## :...employment_duration in {4 - 7 years,
## : : unemployed}: yes (23.1/8)
## : employment_duration = > 7 years:
## : :...other_credit = none: no (16.1/4.7)
## : : other_credit in {store,bank}: yes (5.9)
## : employment_duration = 1 - 4 years:
## : :...dependents <= 1: yes (65.5/30.5)
## : : dependents > 1: no (6.5/1.4)
## : employment_duration = < 1 year:
## : :...years_at_residence > 2: yes (8)
## : years_at_residence <= 2:
## : :...age <= 22: yes (7.3/1.4)
## : age > 22: no (15.7)
## housing = rent:
## :...age > 39: no (3.8)
## age <= 39:
## :...months_loan_duration > 33: no (2.2)
## months_loan_duration <= 33:
## :...amount <= 3448: yes (27.4/5.5)
## amount > 3448: no (2.7)
##
## ----- Trial 9: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...months_loan_duration <= 8: no (16)
## : months_loan_duration > 8:
## : :...other_credit = bank:
## : :...purpose in {education,business,renovations}: yes (13/5.3)
## : : purpose = car0: no (2.3)
## : : purpose = car:
## : : :...credit_history in {critical,poor,perfect,
## : : : : very good}: yes (17.3/2.2)
## : : : credit_history = good: no (6.7/1)
## : : purpose = furniture/appliances:
## : : :...months_loan_duration <= 13: yes (7.1/2.2)
## : : months_loan_duration > 13: no (14.8/2.1)
## : other_credit in {none,store}:
## : :...employment_duration in {> 7 years,unemployed}: no (65.8/14.6)
## : employment_duration = 1 - 4 years:
## : :...job in {unskilled,skilled,unemployed}: no (76.3/17.4)
## : : job = management: yes (14.7/6.3)
## : employment_duration = < 1 year:
## : :...amount <= 6681: no (39.2/12.6)
## : : amount > 6681: yes (6.6)
## : employment_duration = 4 - 7 years:
## : :...existing_loans_count > 2: yes (2.7)
## : existing_loans_count <= 2:
## : :...months_loan_duration <= 9: yes (2.8/0.2)
## : months_loan_duration > 9: no (24.2/1.4)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...savings_balance = 500 - 1000 DM: yes (16.5/7.9)
## savings_balance = > 1000 DM: no (11.4/1.6)
## savings_balance = 100 - 500 DM:
## :...credit_history in {critical,poor}: no (16/2.8)
## : credit_history in {good,perfect,very good}: yes (37.2/13.6)
## savings_balance = unknown:
## :...credit_history in {critical,poor,perfect}: no (14.8)
## : credit_history in {good,very good}:
## : :...months_loan_duration > 42: no (4.9)
## : months_loan_duration <= 42:
## : :...job in {unskilled,unemployed}: no (10.5/1)
## : job = management: yes (6.8/0.7)
## : job = skilled:
## : :...purpose in {business,car0,renovations}: yes (0)
## : purpose = education: no (4.1)
## : purpose in {car,furniture/appliances}:
## : :...amount <= 1597: yes (12.9/1.3)
## : amount > 1597:
## : :...years_at_residence <= 1: no (4.2)
## : years_at_residence > 1:
## : :...months_loan_duration > 27: yes (5.3)
## : months_loan_duration <= 27:
## : :...age <= 25: yes (2.8)
## : age > 25: no (15.9/3.3)
## savings_balance = < 100 DM:
## :...months_loan_duration > 47: yes (25.3/4.1)
## months_loan_duration <= 47:
## :...purpose = car0: no (7.1/1.4)
## purpose = renovations: yes (15/4.7)
## purpose = education:
## :...checking_balance = < 0 DM: yes (12.2/2.1)
## : checking_balance = 1 - 200 DM: no (8/2.7)
## purpose = business:
## :...other_credit = bank: no (4.8)
## : other_credit in {none,store}:
## : :...existing_loans_count <= 2: yes (20.3/7.5)
## : existing_loans_count > 2: no (2)
## purpose = car:
## :...dependents > 1:
## : :...years_at_residence <= 1: yes (2.1)
## : : years_at_residence > 1: no (17.7/3.4)
## : dependents <= 1:
## : :...employment_duration in {> 7 years,4 - 7 years,
## : : < 1 year}: yes (54.9/17.6)
## : employment_duration = unemployed: no (12.9/5.4)
## : employment_duration = 1 - 4 years:
## : :...years_at_residence <= 2: yes (9.9/3.8)
## : years_at_residence > 2: no (23.1/5.4)
## purpose = furniture/appliances:
## :...credit_history in {poor,perfect,very good}: yes (24.8/9)
## credit_history = critical:
## :...other_credit = store: no (1.5)
## : other_credit = bank: yes (0.4)
## : other_credit = none:
## : :...amount <= 1199: no (7.2)
## : amount > 1199:
## : :...years_at_residence <= 1: no (2.1)
## : years_at_residence > 1:
## : :...amount > 4473: yes (4.9)
## : amount <= 4473:
## : :...months_loan_duration <= 18: yes (16/5.2)
## : months_loan_duration > 18: no (6.5)
## credit_history = good:
## :...months_loan_duration <= 7: no (9.2)
## months_loan_duration > 7:
## :...phone = yes:
## :...housing = other: yes (4.5)
## : housing in {own,rent}:
## : :...months_loan_duration <= 30: yes (19.1/7.9)
## : months_loan_duration > 30: no (3.1)
## phone = no:
## :...dependents > 1: yes (14.7/6)
## dependents <= 1:
## :...percent_of_income <= 1: yes (8.7/2.2)
## percent_of_income > 1:
## :...years_at_residence <= 2: no (48.1/10.5)
## years_at_residence > 2:
## :...other_credit in {store,
## : bank}: yes (5.6/1.1)
## other_credit = none: [S1]
##
## SubTree [S1]
##
## employment_duration = < 1 year: yes (4.1)
## employment_duration = unemployed: no (0.6)
## employment_duration in {> 7 years,1 - 4 years,4 - 7 years}:
## :...months_loan_duration <= 8: yes (2.5)
## months_loan_duration > 8:
## :...age <= 23: yes (2.9)
## age > 23: no (17.2/1.8)
##
##
## Evaluation on training data (900 cases):
##
## Trial Decision Tree
## ----- ----------------
## Size Errors
##
## 0 66 125(13.9%)
## 1 40 205(22.8%)
## 2 39 199(22.1%)
## 3 44 206(22.9%)
## 4 40 193(21.4%)
## 5 50 177(19.7%)
## 6 62 191(21.2%)
## 7 68 189(21.0%)
## 8 45 194(21.6%)
## 9 64 169(18.8%)
## boost 29( 3.2%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 631 1 (a): class no
## 28 240 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 100.00% months_loan_duration
## 100.00% credit_history
## 100.00% amount
## 100.00% employment_duration
## 100.00% housing
## 99.11% purpose
## 98.11% savings_balance
## 87.89% other_credit
## 87.78% job
## 79.89% age
## 76.11% percent_of_income
## 75.22% years_at_residence
## 73.89% existing_loans_count
## 68.67% phone
## 67.33% dependents
##
##
## Time: 0.0 secs
After 10 trials the error rate has reduced to 3.2%.
# create new prediction with boosted model
credit_boost10_pred <- predict(credit_boost10, credit_test)
# performance test of boosted elements
CrossTable(credit_test$default, credit_boost10_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 | 59 | 9 | 68 |
## | 0.590 | 0.090 | |
## ---------------|-----------|-----------|-----------|
## yes | 16 | 16 | 32 |
## | 0.160 | 0.160 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 75 | 25 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
The boosted model has an accuracy rate of 75% (2% higher than the non-adaptive accuracy rate - 73%) and an error rate of 25% (2% lower than the non-adaptive error - 27%).
# create cost matrix to reduce false negatives
error_cost <- matrix(c(0, 1, 4, 0), nrow = 2)
error_cost
## [,1] [,2]
## [1,] 0 4
## [2,] 1 0
# implement cost matrix
credit_cost <- C5.0(credit_train[-17], credit_train$default,
costs = error_cost)
## Warning: no dimnames were given for the cost matrix; the factor levels will be
## used
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 | 42 | 26 | 68 |
## | 0.420 | 0.260 | |
## ---------------|-----------|-----------|-----------|
## yes | 6 | 26 | 32 |
## | 0.060 | 0.260 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 48 | 52 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
Overall, this model performed poorly however, it produced fewer false negatives than the non-adaptive and boosted models at the expense of accuracy.