library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readr)
library(C50)
## Warning: package 'C50' was built under R version 4.3.3
library(gmodels)
## Warning: package 'gmodels' was built under R version 4.3.3
set.seed(1234)
credit <- read.csv("C:/Users/dnred/Downloads/credit.csv", stringsAsFactors=TRUE)
View(credit)
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 ...
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
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
train_sample <- sample(1000, 900)
str(train_sample)
##  int [1:900] 284 848 918 101 623 905 645 934 400 900 ...
credit_train <- credit[train_sample, ]
credit_test  <- credit[-train_sample, ]
prop.table(table(credit_train$default))
## 
##        no       yes 
## 0.6922222 0.3077778
credit_train <- credit[train_sample, ]
credit_test  <- credit[-train_sample, ]
prop.table(table(credit_train$default))
## 
##        no       yes 
## 0.6922222 0.3077778
prop.table(table(credit_test$default))
## 
##   no  yes 
## 0.77 0.23
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: 59 
## 
## Non-standard options: attempt to group attributes
summary(credit_model)
## 
## Call:
## C5.0.default(x = credit_train[-17], y = credit_train$default)
## 
## 
## C5.0 [Release 2.07 GPL Edition]      Tue Mar 26 20:33:04 2024
## -------------------------------
## 
## Class specified by attribute `outcome'
## 
## Read 900 cases (17 attributes) from undefined.data
## 
## Decision tree:
## 
## checking_balance in {> 200 DM,unknown}: no (411/57)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history in {perfect,very good}:
##     :...housing in {other,rent}:
##     :   :...other_credit in {none,store}: yes (21)
##     :   :   other_credit = bank:
##     :   :   :...percent_of_income <= 1: no (2)
##     :   :       percent_of_income > 1: yes (7/1)
##     :   housing = own:
##     :   :...savings_balance = < 100 DM: yes (19/6)
##     :       savings_balance in {> 1000 DM,500 - 1000 DM}: no (3)
##     :       savings_balance = 100 - 500 DM:
##     :       :...months_loan_duration <= 18: yes (3)
##     :       :   months_loan_duration > 18: no (3)
##     :       savings_balance = unknown:
##     :       :...checking_balance = < 0 DM: yes (2)
##     :           checking_balance = 1 - 200 DM: no (2)
##     credit_history in {critical,good,poor}:
##     :...months_loan_duration > 27:
##         :...savings_balance = > 1000 DM: no (2/1)
##         :   savings_balance = 500 - 1000 DM: yes (1)
##         :   savings_balance = 100 - 500 DM:
##         :   :...credit_history = critical: no (1)
##         :   :   credit_history = good: yes (8)
##         :   :   credit_history = poor:
##         :   :   :...job = management: yes (2)
##         :   :       job in {skilled,unemployed,unskilled}: no (3)
##         :   savings_balance = unknown:
##         :   :...checking_balance = 1 - 200 DM: no (11/1)
##         :   :   checking_balance = < 0 DM:
##         :   :   :...credit_history = critical: no (1)
##         :   :       credit_history in {good,poor}: yes (4)
##         :   savings_balance = < 100 DM:
##         :   :...dependents > 1:
##         :       :...job in {management,unemployed,unskilled}: no (2)
##         :       :   job = skilled:
##         :       :   :...other_credit in {bank,store}: yes (3)
##         :       :       other_credit = none: no (9/3)
##         :       dependents <= 1:
##         :       :...years_at_residence > 1: yes (45/7)
##         :           years_at_residence <= 1:
##         :           :...housing = other: no (1)
##         :               housing = rent: yes (1)
##         :               housing = own:
##         :               :...checking_balance = < 0 DM: yes (5/1)
##         :                   checking_balance = 1 - 200 DM: no (3)
##         months_loan_duration <= 27:
##         :...months_loan_duration <= 11: no (74/14)
##             months_loan_duration > 11:
##             :...checking_balance = 1 - 200 DM:
##                 :...other_credit = store: yes (4/1)
##                 :   other_credit = none:
##                 :   :...amount <= 9157: no (94/21)
##                 :   :   amount > 9157: yes (4)
##                 :   other_credit = bank:
##                 :   :...credit_history = poor: no (4)
##                 :       credit_history in {critical,good}:
##                 :       :...savings_balance in {> 1000 DM,500 - 1000 DM,
##                 :           :                   unknown}: no (5/1)
##                 :           savings_balance = 100 - 500 DM: yes (5/1)
##                 :           savings_balance = < 100 DM:
##                 :           :...years_at_residence <= 2: no (2)
##                 :               years_at_residence > 2:
##                 :               :...age <= 44: yes (5)
##                 :                   age > 44: no (2)
##                 checking_balance = < 0 DM:
##                 :...job = unemployed: yes (2)
##                     job = management:
##                     :...amount <= 7238: no (14/1)
##                     :   amount > 7238: yes (2)
##                     job = unskilled:
##                     :...employment_duration = < 1 year: yes (7/1)
##                     :   employment_duration in {> 7 years,1 - 4 years,
##                     :                           4 - 7 years,
##                     :                           unemployed}: no (23/4)
##                     job = skilled:
##                     :...savings_balance in {> 1000 DM,
##                         :                   500 - 1000 DM}: no (3)
##                         savings_balance = 100 - 500 DM: yes (3/1)
##                         savings_balance = unknown:
##                         :...phone = no: yes (8/1)
##                         :   phone = yes: no (5/1)
##                         savings_balance = < 100 DM:
##                         :...credit_history = poor: yes (4)
##                             credit_history in {critical,good}:
##                             :...other_credit = bank: yes (7/1)
##                                 other_credit = store: no (2)
##                                 other_credit = none:
##                                 :...percent_of_income <= 1: no (4)
##                                     percent_of_income > 1: [S1]
## 
## SubTree [S1]
## 
## employment_duration in {4 - 7 years,unemployed}: yes (5)
## employment_duration in {< 1 year,> 7 years,1 - 4 years}:
## :...purpose in {business,car0,renovations}: no (0)
##     purpose = education: yes (1)
##     purpose = car:
##     :...amount <= 3031: no (11/3)
##     :   amount > 3031: yes (5)
##     purpose = furniture/appliances:
##     :...amount <= 1743: no (7)
##         amount > 1743:
##         :...years_at_residence <= 1: no (3)
##             years_at_residence > 1:
##             :...months_loan_duration <= 22: yes (7)
##                 months_loan_duration > 22: no (3/1)
## 
## 
## Evaluation on training data (900 cases):
## 
##      Decision Tree   
##    ----------------  
##    Size      Errors  
## 
##      58  129(14.3%)   <<
## 
## 
##     (a)   (b)    <-classified as
##    ----  ----
##     602    21    (a): class no
##     108   169    (b): class yes
## 
## 
##  Attribute usage:
## 
##  100.00% checking_balance
##   54.33% credit_history
##   48.11% months_loan_duration
##   25.67% savings_balance
##   24.67% other_credit
##   16.67% amount
##   16.11% job
##    8.56% years_at_residence
##    8.00% employment_duration
##    8.00% housing
##    7.67% dependents
##    6.11% percent_of_income
##    4.11% purpose
##    1.44% phone
##    0.78% age
## 
## 
## Time: 0.0 secs
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 |        64 |        13 |        77 | 
##                |     0.640 |     0.130 |           | 
## ---------------|-----------|-----------|-----------|
##            yes |        15 |         8 |        23 | 
##                |     0.150 |     0.080 |           | 
## ---------------|-----------|-----------|-----------|
##   Column Total |        79 |        21 |       100 | 
## ---------------|-----------|-----------|-----------|
## 
## 
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: 48.2 
## 
## 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 Mar 26 20:33:04 2024
## -------------------------------
## 
## Class specified by attribute `outcome'
## 
## Read 900 cases (17 attributes) from undefined.data
## 
## -----  Trial 0:  -----
## 
## Decision tree:
## 
## checking_balance in {> 200 DM,unknown}: no (411/57)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history in {perfect,very good}:
##     :...housing in {other,rent}:
##     :   :...other_credit in {none,store}: yes (21)
##     :   :   other_credit = bank:
##     :   :   :...percent_of_income <= 1: no (2)
##     :   :       percent_of_income > 1: yes (7/1)
##     :   housing = own:
##     :   :...savings_balance = < 100 DM: yes (19/6)
##     :       savings_balance in {> 1000 DM,500 - 1000 DM}: no (3)
##     :       savings_balance = 100 - 500 DM:
##     :       :...months_loan_duration <= 18: yes (3)
##     :       :   months_loan_duration > 18: no (3)
##     :       savings_balance = unknown:
##     :       :...checking_balance = < 0 DM: yes (2)
##     :           checking_balance = 1 - 200 DM: no (2)
##     credit_history in {critical,good,poor}:
##     :...months_loan_duration > 27:
##         :...savings_balance = > 1000 DM: no (2/1)
##         :   savings_balance = 500 - 1000 DM: yes (1)
##         :   savings_balance = 100 - 500 DM:
##         :   :...credit_history = critical: no (1)
##         :   :   credit_history = good: yes (8)
##         :   :   credit_history = poor:
##         :   :   :...job = management: yes (2)
##         :   :       job in {skilled,unemployed,unskilled}: no (3)
##         :   savings_balance = unknown:
##         :   :...checking_balance = 1 - 200 DM: no (11/1)
##         :   :   checking_balance = < 0 DM:
##         :   :   :...credit_history = critical: no (1)
##         :   :       credit_history in {good,poor}: yes (4)
##         :   savings_balance = < 100 DM:
##         :   :...dependents > 1:
##         :       :...job in {management,unemployed,unskilled}: no (2)
##         :       :   job = skilled:
##         :       :   :...other_credit in {bank,store}: yes (3)
##         :       :       other_credit = none: no (9/3)
##         :       dependents <= 1:
##         :       :...years_at_residence > 1: yes (45/7)
##         :           years_at_residence <= 1:
##         :           :...housing = other: no (1)
##         :               housing = rent: yes (1)
##         :               housing = own:
##         :               :...checking_balance = < 0 DM: yes (5/1)
##         :                   checking_balance = 1 - 200 DM: no (3)
##         months_loan_duration <= 27:
##         :...months_loan_duration <= 11: no (74/14)
##             months_loan_duration > 11:
##             :...checking_balance = 1 - 200 DM:
##                 :...other_credit = store: yes (4/1)
##                 :   other_credit = none:
##                 :   :...amount <= 9157: no (94/21)
##                 :   :   amount > 9157: yes (4)
##                 :   other_credit = bank:
##                 :   :...credit_history = poor: no (4)
##                 :       credit_history in {critical,good}:
##                 :       :...savings_balance in {> 1000 DM,500 - 1000 DM,
##                 :           :                   unknown}: no (5/1)
##                 :           savings_balance = 100 - 500 DM: yes (5/1)
##                 :           savings_balance = < 100 DM:
##                 :           :...years_at_residence <= 2: no (2)
##                 :               years_at_residence > 2:
##                 :               :...age <= 44: yes (5)
##                 :                   age > 44: no (2)
##                 checking_balance = < 0 DM:
##                 :...job = unemployed: yes (2)
##                     job = management:
##                     :...amount <= 7238: no (14/1)
##                     :   amount > 7238: yes (2)
##                     job = unskilled:
##                     :...employment_duration = < 1 year: yes (7/1)
##                     :   employment_duration in {> 7 years,1 - 4 years,
##                     :                           4 - 7 years,
##                     :                           unemployed}: no (23/4)
##                     job = skilled:
##                     :...savings_balance in {> 1000 DM,
##                         :                   500 - 1000 DM}: no (3)
##                         savings_balance = 100 - 500 DM: yes (3/1)
##                         savings_balance = unknown:
##                         :...phone = no: yes (8/1)
##                         :   phone = yes: no (5/1)
##                         savings_balance = < 100 DM:
##                         :...credit_history = poor: yes (4)
##                             credit_history in {critical,good}:
##                             :...other_credit = bank: yes (7/1)
##                                 other_credit = store: no (2)
##                                 other_credit = none:
##                                 :...percent_of_income <= 1: no (4)
##                                     percent_of_income > 1: [S1]
## 
## SubTree [S1]
## 
## employment_duration in {4 - 7 years,unemployed}: yes (5)
## employment_duration in {< 1 year,> 7 years,1 - 4 years}:
## :...purpose in {business,car0,renovations}: no (0)
##     purpose = education: yes (1)
##     purpose = car:
##     :...amount <= 3031: no (11/3)
##     :   amount > 3031: yes (5)
##     purpose = furniture/appliances:
##     :...amount <= 1743: no (7)
##         amount > 1743:
##         :...years_at_residence <= 1: no (3)
##             years_at_residence > 1:
##             :...months_loan_duration <= 22: yes (7)
##                 months_loan_duration > 22: no (3/1)
## 
## -----  Trial 1:  -----
## 
## Decision tree:
## 
## amount > 10722: yes (35.4/7.8)
## amount <= 10722:
## :...checking_balance = unknown:
##     :...other_credit in {bank,store}:
##     :   :...savings_balance in {> 1000 DM,100 - 500 DM}: no (5.5)
##     :   :   savings_balance in {< 100 DM,500 - 1000 DM,unknown}:
##     :   :   :...purpose in {business,car,car0,education,
##     :   :       :           renovations}: yes (41.7/10.3)
##     :   :       purpose = furniture/appliances: no (21.8/6.7)
##     :   other_credit = none:
##     :   :...credit_history in {critical,perfect,very good}: no (101.9/4.5)
##     :       credit_history in {good,poor}:
##     :       :...existing_loans_count <= 1:
##     :           :...credit_history = good: no (115/24.7)
##     :           :   credit_history = poor: yes (6.9/2.4)
##     :           existing_loans_count > 1:
##     :           :...years_at_residence <= 1: yes (4.5)
##     :               years_at_residence > 1:
##     :               :...housing in {other,rent}: yes (8.3/1.6)
##     :                   housing = own:
##     :                   :...job = management: yes (5.3/0.8)
##     :                       job in {skilled,unemployed,unskilled}: no (20.5/2.2)
##     checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
##     :...percent_of_income <= 2:
##         :...housing in {other,own}: no (142.5/51.5)
##         :   housing = rent:
##         :   :...years_at_residence <= 1: yes (7.5)
##         :       years_at_residence > 1: no (42/13.9)
##         percent_of_income > 2:
##         :...years_at_residence <= 1:
##             :...existing_loans_count > 1: no (6.2)
##             :   existing_loans_count <= 1:
##             :   :...age <= 24: no (10/0.8)
##             :       age > 24:
##             :       :...phone = no: yes (20.9/7.1)
##             :           phone = yes: no (7.8/1.6)
##             years_at_residence > 1:
##             :...credit_history = perfect: yes (12.5/0.8)
##                 credit_history = critical:
##                 :...purpose in {business,car0,renovations}: no (8.4/2.2)
##                 :   purpose = education: yes (3)
##                 :   purpose = furniture/appliances:
##                 :   :...employment_duration in {< 1 year,
##                 :   :   :                       1 - 4 years}: yes (16.1/6.2)
##                 :   :   employment_duration in {> 7 years,4 - 7 years,
##                 :   :                           unemployed}: no (15.7/0.8)
##                 :   purpose = car:
##                 :   :...other_credit in {bank,store}: yes (6.2/0.8)
##                 :       other_credit = none:
##                 :       :...age <= 29: yes (7/0.8)
##                 :           age > 29: no (24.2/6.1)
##                 credit_history in {good,poor,very good}:
##                 :...checking_balance = < 0 DM: yes (93.4/24.4)
##                     checking_balance in {> 200 DM,1 - 200 DM}:
##                     :...existing_loans_count > 1: no (15.8/4.8)
##                         existing_loans_count <= 1:
##                         :...credit_history = poor: yes (11.5/4)
##                             credit_history = very good: no (7.8/2.4)
##                             credit_history = good: [S1]
## 
## SubTree [S1]
## 
## employment_duration in {< 1 year,1 - 4 years,4 - 7 years}: yes (63.6/23.6)
## employment_duration in {> 7 years,unemployed}: no (11.1/0.8)
## 
## -----  Trial 2:  -----
## 
## Decision tree:
## 
## checking_balance = unknown:
## :...other_credit = bank:
## :   :...employment_duration in {< 1 year,1 - 4 years,
## :   :   :                       unemployed}: yes (27.7/8.1)
## :   :   employment_duration = 4 - 7 years: no (6.6/1.9)
## :   :   employment_duration = > 7 years:
## :   :   :...age <= 41: yes (12.7/3.3)
## :   :       age > 41: no (8.8)
## :   other_credit in {none,store}:
## :   :...employment_duration in {> 7 years,4 - 7 years}: no (109.5/11.3)
## :       employment_duration in {< 1 year,1 - 4 years,unemployed}:
## :       :...amount <= 4153: no (112.2/31.1)
## :           amount > 4153:
## :           :...job = unemployed: yes (0)
## :               job = unskilled: no (3.9)
## :               job in {management,skilled}:
## :               :...purpose in {business,car0,education,furniture/appliances,
## :                   :           renovations}: yes (24.8/3.3)
## :                   purpose = car: no (9.8/1.9)
## checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...months_loan_duration > 47:
##     :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM}: yes (32.7/2.7)
##     :   savings_balance in {500 - 1000 DM,unknown}: no (6.7)
##     months_loan_duration <= 47:
##     :...credit_history = perfect:
##         :...percent_of_income <= 3: no (18.1/6.8)
##         :   percent_of_income > 3: yes (7.8)
##         credit_history = very good:
##         :...age <= 23: no (3.9)
##         :   age > 23: yes (28.3/6.8)
##         credit_history = poor:
##         :...housing = rent: no (8.6/0.7)
##         :   housing in {other,own}:
##         :   :...job = unemployed: yes (0)
##         :       job = unskilled: no (3.4)
##         :       job in {management,skilled}:
##         :       :...percent_of_income <= 1: no (2.6)
##         :           percent_of_income > 1:
##         :           :...savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM,
##         :               :                   500 - 1000 DM}: yes (23.9/5.3)
##         :               savings_balance = unknown: no (2.7)
##         credit_history = critical:
##         :...other_credit = bank: yes (14/5.3)
##         :   other_credit = store: no (3.2)
##         :   other_credit = none:
##         :   :...savings_balance in {> 1000 DM,100 - 500 DM,
##         :       :                   unknown}: no (23.6/3.7)
##         :       savings_balance = 500 - 1000 DM: yes (6.4/1.3)
##         :       savings_balance = < 100 DM:
##         :       :...housing = other: no (7.9/1.4)
##         :           housing in {own,rent}:
##         :           :...job = management: yes (9.6/1.3)
##         :               job in {unemployed,unskilled}: no (15.9/4.2)
##         :               job = skilled:
##         :               :...purpose in {business,education}: yes (4.7)
##         :                   purpose in {car,car0,furniture/appliances,
##         :                               renovations}: no (36.2/12.9)
##         credit_history = good:
##         :...savings_balance = > 1000 DM: no (10.2)
##             savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM,unknown}:
##             :...purpose in {business,car0,education,
##                 :           renovations}: no (39.1/12.5)
##                 purpose = car: yes (97.5/37.9)
##                 purpose = furniture/appliances:
##                 :...months_loan_duration <= 7: no (12.2)
##                     months_loan_duration > 7:
##                     :...savings_balance = 500 - 1000 DM: no (8/1.9)
##                         savings_balance in {100 - 500 DM,
##                         :                   unknown}: yes (34.9/9.3)
##                         savings_balance = < 100 DM:
##                         :...dependents > 1: yes (14.3/5.3)
##                             dependents <= 1:
##                             :...percent_of_income <= 1: yes (12.2/3.3)
##                                 percent_of_income > 1:
##                                 :...other_credit = bank: no (8/1.3)
##                                     other_credit = store: yes (7.1/2)
##                                     other_credit = none:
##                                     :...phone = no: no (66.8/23.9)
##                                         phone = yes: yes (13.5/5.3)
## 
## -----  Trial 3:  -----
## 
## Decision tree:
## 
## months_loan_duration <= 7:
## :...amount > 3380: yes (10.5/2.7)
## :   amount <= 3380:
## :   :...purpose in {business,car,car0,furniture/appliances,
## :       :           renovations}: no (52.3/2.7)
## :       purpose = education: yes (6.3/2.2)
## months_loan_duration > 7:
## :...savings_balance in {> 1000 DM,unknown}:
##     :...housing = other:
##     :   :...other_credit = bank: no (6.1)
##     :   :   other_credit in {none,store}: yes (21/6.6)
##     :   housing in {own,rent}:
##     :   :...other_credit = store: no (7.4/1.7)
##     :       other_credit = bank:
##     :       :...percent_of_income <= 1: yes (6/0.5)
##     :       :   percent_of_income > 1: no (23.8/7.5)
##     :       other_credit = none:
##     :       :...credit_history in {critical,perfect}: no (31.2)
##     :           credit_history in {good,poor,very good}:
##     :           :...employment_duration in {> 7 years,
##     :               :                       4 - 7 years}: no (32.6/2.9)
##     :               employment_duration in {< 1 year,1 - 4 years,unemployed}:
##     :               :...savings_balance = > 1000 DM: no (7.3/1.5)
##     :                   savings_balance = unknown:
##     :                   :...percent_of_income <= 1: no (9.3/1.5)
##     :                       percent_of_income > 1:
##     :                       :...job in {unemployed,unskilled}: yes (4)
##     :                           job in {management,skilled}:
##     :                           :...amount <= 5943: no (22/8.8)
##     :                               amount > 5943: yes (3.9)
##     savings_balance in {< 100 DM,100 - 500 DM,500 - 1000 DM}:
##     :...age <= 25:
##         :...employment_duration in {< 1 year,4 - 7 years,
##         :   :                       unemployed}: yes (80.9/23.8)
##         :   employment_duration = > 7 years: no (7.1/1.8)
##         :   employment_duration = 1 - 4 years:
##         :   :...amount <= 1795: no (20.5/4.2)
##         :       amount > 1795: yes (40.1/9.8)
##         age > 25:
##         :...checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
##             :...percent_of_income <= 3:
##             :   :...employment_duration in {4 - 7 years,
##             :   :   :                       unemployed}: no (52.8/16.1)
##             :   :   employment_duration = < 1 year:
##             :   :   :...age <= 28: yes (12.8/1.7)
##             :   :   :   age > 28:
##             :   :   :   :...purpose in {business,car,car0,
##             :   :   :       :           furniture/appliances}: no (19.6/2.2)
##             :   :   :       purpose in {education,renovations}: yes (2.8)
##             :   :   employment_duration = > 7 years:
##             :   :   :...savings_balance = 100 - 500 DM: yes (7/3)
##             :   :   :   savings_balance = 500 - 1000 DM: no (1.7)
##             :   :   :   savings_balance = < 100 DM:
##             :   :   :   :...job in {management,skilled,
##             :   :   :       :       unemployed}: yes (27.4/7.4)
##             :   :   :       job = unskilled: no (3)
##             :   :   employment_duration = 1 - 4 years:
##             :   :   :...amount > 7824: yes (6)
##             :   :       amount <= 7824:
##             :   :       :...amount <= 1056: yes (4.8)
##             :   :           amount > 1056: no (57.4/15.5)
##             :   percent_of_income > 3:
##             :   :...credit_history in {perfect,very good}: yes (15.4/1.3)
##             :       credit_history in {critical,good,poor}:
##             :       :...job in {management,unemployed}: no (26.7/10.7)
##             :           job = unskilled:
##             :           :...age <= 27: no (5.7)
##             :           :   age > 27: yes (32.5/12.2)
##             :           job = skilled:
##             :           :...savings_balance = 100 - 500 DM: no (9.9/2.2)
##             :               savings_balance = 500 - 1000 DM: yes (1.5)
##             :               savings_balance = < 100 DM:
##             :               :...amount <= 1007: yes (13.4/1.1)
##             :                   amount > 1007:
##             :                   :...months_loan_duration <= 15: no (9.4)
##             :                       months_loan_duration > 15: yes (44.5/12.1)
##             checking_balance = unknown:
##             :...age > 44: no (19.6)
##                 age <= 44:
##                 :...years_at_residence > 2:
##                     :...years_at_residence <= 3: no (15.6)
##                     :   years_at_residence > 3:
##                     :   :...age <= 31: yes (9.6/2.7)
##                     :       age > 31:
##                     :       :...other_credit = bank: yes (4.3/1.3)
##                     :           other_credit in {none,store}: no (18.6)
##                     years_at_residence <= 2:
##                     :...age > 39: yes (13/1.6)
##                         age <= 39:
##                         :...years_at_residence <= 1: no (10.4/1.5)
##                             years_at_residence > 1:
##                             :...percent_of_income <= 1: no (5.9)
##                                 percent_of_income > 1:
##                                 :...job in {unemployed,unskilled}: no (4.4)
##                                     job in {management,skilled}: [S1]
## 
## SubTree [S1]
## 
## savings_balance in {100 - 500 DM,500 - 1000 DM}: yes (12.2/2.9)
## savings_balance = < 100 DM:
## :...months_loan_duration <= 16: no (10.2)
##     months_loan_duration > 16:
##     :...other_credit = bank: yes (7.1)
##         other_credit in {none,store}:
##         :...credit_history in {critical,very good}: no (6.2)
##             credit_history in {good,perfect,poor}: yes (16.1/5.6)
## 
## -----  Trial 4:  -----
## 
## Decision tree:
## 
## checking_balance in {> 200 DM,unknown}:
## :...months_loan_duration <= 8: no (29.9/1.9)
## :   months_loan_duration > 8:
## :   :...employment_duration = unemployed: yes (14.5/5)
## :       employment_duration in {> 7 years,4 - 7 years}:
## :       :...dependents <= 1: no (108.5/17)
## :       :   dependents > 1:
## :       :   :...checking_balance = > 200 DM: yes (5.4)
## :       :       checking_balance = unknown: no (20.4/7.5)
## :       employment_duration in {< 1 year,1 - 4 years}:
## :       :...job in {management,skilled}: no (133/49.3)
## :           job = unemployed: yes (1.3)
## :           job = unskilled:
## :           :...phone = yes: no (3.1)
## :               phone = no:
## :               :...percent_of_income <= 1: no (4.4)
## :                   percent_of_income > 1:
## :                   :...existing_loans_count <= 1: yes (25.9/6.5)
## :                       existing_loans_count > 1: no (6.3/1.3)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...job = unskilled:
##     :...months_loan_duration <= 18: no (71.9/14.4)
##     :   months_loan_duration > 18:
##     :   :...existing_loans_count > 1: yes (12.8/1)
##     :       existing_loans_count <= 1:
##     :       :...dependents > 1: yes (2.4)
##     :           dependents <= 1:
##     :           :...amount <= 1680: yes (4.4)
##     :               amount > 1680: no (20.4/5.6)
##     job in {management,skilled,unemployed}:
##     :...savings_balance in {> 1000 DM,500 - 1000 DM}: no (27.6/8.7)
##         savings_balance = 100 - 500 DM:
##         :...employment_duration in {< 1 year,1 - 4 years,
##         :   :                       unemployed}: yes (27.8/6.7)
##         :   employment_duration in {> 7 years,4 - 7 years}: no (19.9/2.8)
##         savings_balance = unknown:
##         :...existing_loans_count > 1: no (7.3)
##         :   existing_loans_count <= 1:
##         :   :...age > 56: no (4.5)
##         :       age <= 56:
##         :       :...job = management: yes (8.5/2.2)
##         :           job = unemployed: no (3.7/1.3)
##         :           job = skilled:
##         :           :...amount <= 1597: yes (14/1.4)
##         :               amount > 1597:
##         :               :...percent_of_income <= 1: yes (6.5/1.5)
##         :                   percent_of_income > 1: no (21/5.7)
##         savings_balance = < 100 DM:
##         :...months_loan_duration > 42: yes (29.2/3.7)
##             months_loan_duration <= 42:
##             :...purpose in {business,education,renovations}: yes (36.3/11.9)
##                 purpose = car0: no (4.4/1.5)
##                 purpose = furniture/appliances:
##                 :...other_credit = bank: yes (16.8/5.7)
##                 :   other_credit = store: no (7.4/1.4)
##                 :   other_credit = none:
##                 :   :...dependents > 1: no (7.2/1.3)
##                 :       dependents <= 1:
##                 :       :...years_at_residence > 3:
##                 :           :...months_loan_duration <= 10: yes (9.3/2.3)
##                 :           :   months_loan_duration > 10: no (30.1/7)
##                 :           years_at_residence <= 3:
##                 :           :...months_loan_duration <= 8: no (5.1)
##                 :               months_loan_duration > 8:
##                 :               :...years_at_residence <= 1: no (18.3/7.6)
##                 :                   years_at_residence > 1: yes (37.7/8.6)
##                 purpose = car:
##                 :...amount > 11054: yes (5.4)
##                     amount <= 11054:
##                     :...housing = other: no (19.9/5.2)
##                         housing in {own,rent}:
##                         :...checking_balance = 1 - 200 DM:
##                             :...employment_duration in {< 1 year,> 7 years,
##                             :   :                       unemployed}: yes (17/6)
##                             :   employment_duration in {1 - 4 years,
##                             :                           4 - 7 years}: no (10/0.4)
##                             checking_balance = < 0 DM:
##                             :...job in {management,unemployed}: yes (2.8)
##                                 job = skilled:
##                                 :...percent_of_income <= 1: no (5.8/0.9)
##                                     percent_of_income > 1:
##                                     :...age <= 48: yes (28.8/6.7)
##                                         age > 48: no (3.3)
## 
## -----  Trial 5:  -----
## 
## Decision tree:
## 
## credit_history = very good: yes (51.8/20.5)
## credit_history = poor:
## :...savings_balance = > 1000 DM: yes (5.9/0.7)
## :   savings_balance in {100 - 500 DM,500 - 1000 DM,unknown}: no (24.4/6.1)
## :   savings_balance = < 100 DM:
## :   :...percent_of_income <= 3: no (26.6/11.1)
## :       percent_of_income > 3: yes (24.8/5.6)
## credit_history = perfect:
## :...housing in {other,rent}: yes (11.7/0.8)
## :   housing = own:
## :   :...other_credit = store: yes (4.1)
## :       other_credit in {bank,none}:
## :       :...existing_loans_count > 2: yes (2.2)
## :           existing_loans_count <= 2:
## :           :...percent_of_income <= 3: no (17.5/3.5)
## :               percent_of_income > 3: yes (5.6/1.4)
## credit_history = critical:
## :...other_credit = store: yes (8.8/4.1)
## :   other_credit = bank:
## :   :...purpose in {car0,renovations}: yes (0)
## :   :   purpose in {business,education}: no (6.3)
## :   :   purpose in {car,furniture/appliances}:
## :   :   :...age <= 46: yes (25/4.9)
## :   :       age > 46: no (4.5)
## :   other_credit = none:
## :   :...checking_balance = unknown: no (63.9/8.7)
## :       checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :       :...savings_balance in {> 1000 DM,500 - 1000 DM}: yes (11.1/3.9)
## :           savings_balance in {100 - 500 DM,unknown}: no (16.6/2.7)
## :           savings_balance = < 100 DM:
## :           :...purpose in {business,car0,education,
## :               :           renovations}: yes (14.7/5.9)
## :               purpose = car:
## :               :...age <= 29: yes (5.3)
## :               :   age > 29: no (30/6.7)
## :               purpose = furniture/appliances:
## :               :...months_loan_duration > 36: yes (3.7)
## :                   months_loan_duration <= 36:
## :                   :...amount <= 7308: no (28.5/7.1)
## :                       amount > 7308: yes (2.2)
## credit_history = good:
## :...existing_loans_count > 1:
##     :...dependents > 1: no (3.3/0.4)
##     :   dependents <= 1:
##     :   :...existing_loans_count > 2: yes (4.4)
##     :       existing_loans_count <= 2:
##     :       :...amount <= 1209: no (5.7)
##     :           amount > 1209:
##     :           :...job in {management,unemployed}: yes (3.1)
##     :               job = unskilled: no (4.1/1.3)
##     :               job = skilled:
##     :               :...percent_of_income <= 1: yes (7.3)
##     :                   percent_of_income > 1:
##     :                   :...amount <= 3621: yes (18/2.7)
##     :                       amount > 3621: no (5.5)
##     existing_loans_count <= 1:
##     :...purpose = car0: no (3.5)
##         purpose = renovations: yes (13.5/4.9)
##         purpose = business:
##         :...months_loan_duration <= 18: no (15.1)
##         :   months_loan_duration > 18: yes (11.1/3.8)
##         purpose = education:
##         :...housing in {other,rent}: no (10.1/2.1)
##         :   housing = own: yes (11.7/3.1)
##         purpose = furniture/appliances:
##         :...employment_duration = unemployed: yes (8.8/2.9)
##         :   employment_duration = < 1 year:
##         :   :...dependents <= 1: no (56.8/24.6)
##         :   :   dependents > 1: yes (2.7/0.4)
##         :   employment_duration = 1 - 4 years:
##         :   :...months_loan_duration <= 33: no (85.3/38.1)
##         :   :   months_loan_duration > 33: yes (17/3.8)
##         :   employment_duration = 4 - 7 years:
##         :   :...age <= 23: yes (7.8/1)
##         :   :   age > 23: no (21.3/3.7)
##         :   employment_duration = > 7 years:
##         :   :...amount > 5711: yes (3.8)
##         :       amount <= 5711:
##         :       :...checking_balance in {> 200 DM,unknown}: no (14.4)
##         :           checking_balance in {< 0 DM,1 - 200 DM}:
##         :           :...years_at_residence <= 2: yes (9/2.9)
##         :               years_at_residence > 2: no (14.1/1.9)
##         purpose = car:
##         :...amount > 11328: yes (8)
##             amount <= 11328:
##             :...employment_duration = unemployed: no (11.9)
##                 employment_duration in {< 1 year,> 7 years,1 - 4 years,
##                 :                       4 - 7 years}:
##                 :...amount > 1391:
##                     :...checking_balance in {< 0 DM,1 - 200 DM}:
##                     :   :...age <= 43: no (43.9/16)
##                     :   :   age > 43: yes (8.8/1.3)
##                     :   checking_balance in {> 200 DM,unknown}:
##                     :   :...age <= 22: yes (4.2/0.7)
##                     :       age > 22: no (29)
##                     amount <= 1391:
##                     :...months_loan_duration <= 7: no (3.4)
##                         months_loan_duration > 7:
##                         :...percent_of_income <= 3: yes (12.1)
##                             percent_of_income > 3:
##                             :...years_at_residence <= 1: no (3.7)
##                                 years_at_residence > 1:
##                                 :...age <= 43: yes (19.7/3.1)
##                                     age > 43: no (2.6)
## 
## -----  Trial 6:  -----
## 
## Decision tree:
## 
## months_loan_duration <= 7:
## :...existing_loans_count > 1: no (16.2)
## :   existing_loans_count <= 1:
## :   :...amount <= 4057: no (42.6/8.8)
## :       amount > 4057: yes (5.7)
## months_loan_duration > 7:
## :...checking_balance = unknown:
##     :...age <= 30:
##     :   :...amount <= 6458:
##     :   :   :...employment_duration in {< 1 year,> 7 years,
##     :   :   :   :                       4 - 7 years}: no (38.9/10.2)
##     :   :   :   employment_duration in {1 - 4 years,unemployed}: yes (49.1/20.9)
##     :   :   amount > 6458:
##     :   :   :...months_loan_duration <= 54: yes (22.7/2.8)
##     :   :       months_loan_duration > 54: no (2.9)
##     :   age > 30:
##     :   :...other_credit = none: no (90.5/13.9)
##     :       other_credit in {bank,store}:
##     :       :...years_at_residence <= 2: yes (22.3/5.4)
##     :           years_at_residence > 2: no (23.6/6.2)
##     checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
##     :...credit_history = perfect: yes (30.1/10.4)
##         credit_history = very good:
##         :...years_at_residence <= 1: yes (3)
##         :   years_at_residence > 1:
##         :   :...dependents <= 1: no (31/11.4)
##         :       dependents > 1: yes (6.2/1.5)
##         credit_history = poor:
##         :...savings_balance = 500 - 1000 DM: yes (0)
##         :   savings_balance = unknown: no (5.9)
##         :   savings_balance in {< 100 DM,> 1000 DM,100 - 500 DM}:
##         :   :...months_loan_duration <= 13: no (4.6)
##         :       months_loan_duration > 13:
##         :       :...percent_of_income <= 1: no (2.8)
##         :           percent_of_income > 1: yes (31/5.8)
##         credit_history = critical:
##         :...age > 61: no (7.4)
##         :   age <= 61:
##         :   :...purpose = business: no (9.9/1.3)
##         :       purpose in {car0,education,renovations}: yes (11.5/3.4)
##         :       purpose = car:
##         :       :...existing_loans_count <= 1: no (9.1/0.9)
##         :       :   existing_loans_count > 1:
##         :       :   :...months_loan_duration <= 11: no (4.9)
##         :       :       months_loan_duration > 11:
##         :       :       :...amount <= 1473: yes (9.7/0.3)
##         :       :           amount > 1473:
##         :       :           :...amount <= 2197: no (7.4)
##         :       :               amount > 2197: yes (13.9/4.1)
##         :       purpose = furniture/appliances:
##         :       :...housing = other: yes (3.3)
##         :           housing in {own,rent}:
##         :           :...years_at_residence <= 1: no (3.2)
##         :               years_at_residence > 1:
##         :               :...phone = yes: no (12.9/2.8)
##         :                   phone = no:
##         :                   :...amount <= 1199: no (3.4)
##         :                       amount > 1199: yes (21.8/7.1)
##         credit_history = good:
##         :...amount > 8086: yes (25.7/3.6)
##             amount <= 8086:
##             :...purpose in {business,car0,education,
##                 :           renovations}: no (43.3/11.9)
##                 purpose in {car,furniture/appliances}:
##                 :...savings_balance in {> 1000 DM,
##                     :                   500 - 1000 DM}: no (15.9/5.9)
##                     savings_balance = 100 - 500 DM: yes (26.7/8.3)
##                     savings_balance = unknown:
##                     :...job in {management,skilled}: yes (37.4/12.9)
##                     :   job in {unemployed,unskilled}: no (3.5)
##                     savings_balance = < 100 DM:
##                     :...employment_duration = < 1 year: yes (53.2/20.3)
##                         employment_duration = unemployed: no (7.3/1.4)
##                         employment_duration = > 7 years:
##                         :...age <= 33: no (5.8)
##                         :   age > 33: yes (21/6.6)
##                         employment_duration = 4 - 7 years:
##                         :...phone = no: no (20.5/7.1)
##                         :   phone = yes: yes (8.5/2.5)
##                         employment_duration = 1 - 4 years:
##                         :...job = unemployed: yes (0)
##                             job = management: no (3.4)
##                             job in {skilled,unskilled}:
##                             :...phone = yes: no (11.4/3.1)
##                                 phone = no: [S1]
## 
## SubTree [S1]
## 
## checking_balance in {> 200 DM,1 - 200 DM}: yes (33.9/9)
## checking_balance = < 0 DM:
## :...months_loan_duration <= 15: no (12.2/1.6)
##     months_loan_duration > 15: yes (22.6/4.6)
## 
## -----  Trial 7:  -----
## 
## Decision tree:
## 
## checking_balance in {> 200 DM,unknown}:
## :...purpose = car0: no (0)
## :   purpose = renovations: yes (10.3/4.1)
## :   purpose = education:
## :   :...savings_balance in {< 100 DM,> 1000 DM,500 - 1000 DM,
## :   :   :                   unknown}: no (16.8/3.5)
## :   :   savings_balance = 100 - 500 DM: yes (6.4/0.2)
## :   purpose = business:
## :   :...employment_duration in {< 1 year,unemployed}: yes (12.1/0.9)
## :   :   employment_duration in {> 7 years,1 - 4 years,4 - 7 years}:
## :   :   :...existing_loans_count <= 2: no (26.8/7.1)
## :   :       existing_loans_count > 2: yes (2.9)
## :   purpose = car:
## :   :...other_credit = bank:
## :   :   :...months_loan_duration <= 16: no (4.2)
## :   :   :   months_loan_duration > 16: yes (20.3/6.3)
## :   :   other_credit in {none,store}:
## :   :   :...age > 30: no (33/1.1)
## :   :       age <= 30:
## :   :       :...housing = other: yes (2.8)
## :   :           housing in {own,rent}: no (35.4/9.5)
## :   purpose = furniture/appliances:
## :   :...age > 44: no (23.7)
## :       age <= 44:
## :       :...job = unemployed: no (0)
## :           job in {management,skilled}:
## :           :...employment_duration in {> 7 years,1 - 4 years}: no (65.3/15.6)
## :           :   employment_duration = unemployed: yes (3.8/1.5)
## :           :   employment_duration = < 1 year:
## :           :   :...existing_loans_count <= 1: no (12.6/2.7)
## :           :   :   existing_loans_count > 1: yes (11.5/1.8)
## :           :   employment_duration = 4 - 7 years:
## :           :   :...age <= 23: yes (8.6/2.4)
## :           :       age > 23: no (12.8)
## :           job = unskilled:
## :           :...existing_loans_count > 1: no (3.7)
## :               existing_loans_count <= 1:
## :               :...credit_history = poor: yes (0)
## :                   credit_history in {perfect,very good}: no (2.7)
## :                   credit_history in {critical,good}:
## :                   :...age <= 24: no (2.3)
## :                       age > 24: yes (20.7/3.3)
## checking_balance in {< 0 DM,1 - 200 DM}:
## :...credit_history = perfect:
##     :...housing in {other,rent}: yes (7.4)
##     :   housing = own: no (22.1/7.6)
##     credit_history = very good:
##     :...age <= 23: no (4.6)
##     :   age > 23: yes (41.4/11.2)
##     credit_history = poor:
##     :...checking_balance = < 0 DM: yes (11.2/2.1)
##     :   checking_balance = 1 - 200 DM:
##     :   :...housing = rent: no (6.6)
##     :       housing in {other,own}:
##     :       :...dependents > 1: no (2.7)
##     :           dependents <= 1:
##     :           :...years_at_residence <= 2: no (9/1.8)
##     :               years_at_residence > 2: yes (13.8/3.8)
##     credit_history = critical:
##     :...years_at_residence <= 1: no (5.6)
##     :   years_at_residence > 1:
##     :   :...savings_balance in {> 1000 DM,100 - 500 DM,500 - 1000 DM,
##     :       :                   unknown}: no (20.1/4.3)
##     :       savings_balance = < 100 DM:
##     :       :...dependents > 1: no (14.4/3.1)
##     :           dependents <= 1:
##     :           :...housing = other: no (7.5/1.4)
##     :               housing = rent: yes (16/5)
##     :               housing = own:
##     :               :...checking_balance = < 0 DM: no (24.5/8.6)
##     :                   checking_balance = 1 - 200 DM: yes (20.5/7.4)
##     credit_history = good:
##     :...amount > 8648:
##         :...phone = no: no (2.1/0.2)
##         :   phone = yes: yes (19.4/1.9)
##         amount <= 8648:
##         :...dependents > 1: no (38.3/13.1)
##             dependents <= 1:
##             :...months_loan_duration > 33: yes (33.4/7.9)
##                 months_loan_duration <= 33:
##                 :...purpose in {business,car0,renovations}: no (21.6/4.5)
##                     purpose = education: yes (8.4/3.1)
##                     purpose = car:
##                     :...amount > 5302: no (8.8)
##                     :   amount <= 5302:
##                     :   :...percent_of_income <= 2: no (20.8/7.1)
##                     :       percent_of_income > 2: yes (38.2/11.8)
##                     purpose = furniture/appliances:
##                     :...savings_balance in {> 1000 DM,
##                         :                   500 - 1000 DM}: no (10.6/3.9)
##                         savings_balance in {100 - 500 DM,
##                         :                   unknown}: yes (34.1/13.1)
##                         savings_balance = < 100 DM:
##                         :...job = management: no (8.2/2.6)
##                             job = unemployed: yes (2)
##                             job = skilled: [S1]
##                             job = unskilled:
##                             :...other_credit in {bank,none}: no (23/4.2)
##                                 other_credit = store: yes (2.1)
## 
## SubTree [S1]
## 
## employment_duration in {< 1 year,1 - 4 years,4 - 7 years,
## :                       unemployed}: yes (57.8/23.7)
## employment_duration = > 7 years: no (5.2)
## 
## -----  Trial 8:  -----
## 
## Decision tree:
## 
## checking_balance = < 0 DM:
## :...savings_balance in {> 1000 DM,100 - 500 DM,500 - 1000 DM}: no (19.8/6)
## :   savings_balance = unknown:
## :   :...existing_loans_count > 1: no (4.5/0.2)
## :   :   existing_loans_count <= 1:
## :   :   :...other_credit = bank: no (4.6/0.6)
## :   :       other_credit in {none,store}: yes (20.9/7.8)
## :   savings_balance = < 100 DM:
## :   :...credit_history in {perfect,poor,very good}: yes (35.8/7.3)
## :       credit_history in {critical,good}:
## :       :...years_at_residence <= 1:
## :           :...dependents <= 1: no (27.7/6.8)
## :           :   dependents > 1: yes (2.2)
## :           years_at_residence > 1:
## :           :...purpose in {business,car0}: no (6.7/1.4)
## :               purpose in {education,renovations}: yes (9.4/1.8)
## :               purpose = car:
## :               :...dependents <= 1: yes (54.2/18.4)
## :               :   dependents > 1: no (15.8/5.5)
## :               purpose = furniture/appliances:
## :               :...phone = yes: yes (16.2/3.3)
## :                   phone = no:
## :                   :...percent_of_income <= 1: no (8.8/1)
## :                       percent_of_income > 1:
## :                       :...dependents > 1: yes (6.9/1)
## :                           dependents <= 1:
## :                           :...job in {management,unemployed,
## :                               :       unskilled}: no (9.5/1.8)
## :                               job = skilled:
## :                               :...amount <= 1795: no (13.9/2.7)
## :                                   amount > 1795:
## :                                   :...amount <= 3422: yes (13.1)
## :                                       amount > 3422: no (13.2/4.8)
## checking_balance in {> 200 DM,1 - 200 DM,unknown}:
## :...employment_duration in {4 - 7 years,unemployed}:
##     :...years_at_residence > 2: no (76.7/9.3)
##     :   years_at_residence <= 2:
##     :   :...age <= 22: yes (5.1)
##     :       age > 22: no (49.3/16.7)
##     employment_duration in {< 1 year,> 7 years,1 - 4 years}:
##     :...housing = rent:
##         :...checking_balance = > 200 DM: no (7.2/2.1)
##         :   checking_balance = 1 - 200 DM:
##         :   :...credit_history in {critical,poor}: no (5.6)
##         :   :   credit_history in {good,perfect,very good}: yes (33.6/5)
##         :   checking_balance = unknown:
##         :   :...months_loan_duration <= 30: no (27.9/9.1)
##         :       months_loan_duration > 30: yes (5.1)
##         housing in {other,own}:
##         :...dependents > 1:
##             :...months_loan_duration > 24: no (12.5/1)
##             :   months_loan_duration <= 24:
##             :   :...months_loan_duration <= 7: no (3.6)
##             :       months_loan_duration > 7: yes (45.1/12.7)
##             dependents <= 1:
##             :...job = management:
##                 :...years_at_residence <= 1: no (6.2)
##                 :   years_at_residence > 1:
##                 :   :...savings_balance in {< 100 DM,> 1000 DM,
##                 :       :                   100 - 500 DM}: yes (36/7.3)
##                 :       savings_balance in {500 - 1000 DM,
##                 :                           unknown}: no (12.6/2.3)
##                 job in {skilled,unemployed,unskilled}:
##                 :...employment_duration = > 7 years: no (52.4/6.3)
##                     employment_duration in {< 1 year,1 - 4 years}:
##                     :...age > 44: no (19.2/2)
##                         age <= 44:
##                         :...savings_balance = > 1000 DM: no (7.2)
##                             savings_balance in {< 100 DM,100 - 500 DM,
##                             :                   500 - 1000 DM,unknown}:
##                             :...age > 35: yes (29.6/7.4)
##                                 age <= 35:
##                                 :...percent_of_income <= 1: [S1]
##                                     percent_of_income > 1: [S2]
## 
## SubTree [S1]
## 
## employment_duration = < 1 year: yes (13.3/1.9)
## employment_duration = 1 - 4 years: no (14.1/3.3)
## 
## SubTree [S2]
## 
## savings_balance = 100 - 500 DM: no (19.2/5.9)
## savings_balance = 500 - 1000 DM: yes (6.4/1.9)
## savings_balance = unknown:
## :...amount <= 1597: yes (7.2/1.6)
## :   amount > 1597: no (14.6)
## savings_balance = < 100 DM:
## :...existing_loans_count > 1: no (38.4/6.4)
##     existing_loans_count <= 1:
##     :...purpose in {business,car,renovations}: yes (17.9/5.4)
##         purpose in {car0,education,furniture/appliances}: no (46.7/16.5)
## 
## -----  Trial 9:  -----
## 
## Decision tree:
## 
## checking_balance = unknown:
## :...other_credit = none: no (185/44.6)
## :   other_credit in {bank,store}:
## :   :...employment_duration in {< 1 year,> 7 years,4 - 7 years}: no (38.4/15.1)
## :       employment_duration = unemployed: yes (4.5)
## :       employment_duration = 1 - 4 years:
## :       :...amount <= 1503: no (4.3)
## :           amount > 1503: yes (21.6/6.2)
## checking_balance in {< 0 DM,> 200 DM,1 - 200 DM}:
## :...months_loan_duration > 30:
##     :...employment_duration = unemployed: no (6.9)
##     :   employment_duration in {< 1 year,> 7 years,1 - 4 years,4 - 7 years}:
##     :   :...savings_balance in {> 1000 DM,100 - 500 DM,
##     :       :                   500 - 1000 DM}: yes (21.6/6.3)
##     :       savings_balance = unknown: no (12.1/3.3)
##     :       savings_balance = < 100 DM:
##     :       :...months_loan_duration > 47: yes (31.1/3.1)
##     :           months_loan_duration <= 47:
##     :           :...percent_of_income > 3: yes (27.7/6.2)
##     :               percent_of_income <= 3:
##     :               :...age <= 31: yes (15.4/3.1)
##     :                   age > 31: no (15.9/1)
##     months_loan_duration <= 30:
##     :...credit_history = perfect: yes (21.8/10)
##         credit_history = critical:
##         :...years_at_residence <= 2: yes (26.5/9.8)
##         :   years_at_residence > 2: no (89.7/29.3)
##         credit_history = poor:
##         :...age > 52: yes (5.8)
##         :   age <= 52:
##         :   :...employment_duration in {< 1 year,unemployed}: yes (8.8/2.9)
##         :       employment_duration in {> 7 years,1 - 4 years,
##         :                               4 - 7 years}: no (17.8/0.9)
##         credit_history = very good:
##         :...age <= 23: no (4)
##         :   age > 23:
##         :   :...months_loan_duration <= 27: yes (24.1/3.4)
##         :       months_loan_duration > 27: no (2.3)
##         credit_history = good:
##         :...savings_balance in {> 1000 DM,500 - 1000 DM,
##             :                   unknown}: no (66.3/19.9)
##             savings_balance = 100 - 500 DM:
##             :...housing in {other,rent}: yes (9.3/0.5)
##             :   housing = own:
##             :   :...percent_of_income <= 3: no (12.6)
##             :       percent_of_income > 3: yes (9.4/2)
##             savings_balance = < 100 DM:
##             :...purpose = business: no (9.8/2.7)
##                 purpose in {car0,education,renovations}: yes (13.9/5.7)
##                 purpose = car:
##                 :...other_credit in {bank,store}: yes (5.4/0.4)
##                 :   other_credit = none:
##                 :   :...checking_balance = > 200 DM: no (2.8)
##                 :       checking_balance in {< 0 DM,1 - 200 DM}:
##                 :       :...years_at_residence <= 2: yes (17/2.7)
##                 :           years_at_residence > 2:
##                 :           :...job = management: yes (2.4)
##                 :               job in {skilled,unemployed,
##                 :                       unskilled}: no (26.6/8.3)
##                 purpose = furniture/appliances:
##                 :...months_loan_duration <= 7: no (8.4)
##                     months_loan_duration > 7:
##                     :...job = management: no (10.3/3.3)
##                         job = unemployed: yes (2.3)
##                         job = skilled:
##                         :...employment_duration in {> 7 years,
##                         :   :                       unemployed}: no (4.8)
##                         :   employment_duration in {< 1 year,1 - 4 years,
##                         :   :                       4 - 7 years}:
##                         :   :...checking_balance = > 200 DM: no (7.8/2.4)
##                         :       checking_balance = < 0 DM:
##                         :       :...years_at_residence <= 1: no (8.5)
##                         :       :   years_at_residence > 1: yes (26.2/11.3)
##                         :       checking_balance = 1 - 200 DM:
##                         :       :...existing_loans_count <= 1: yes (26/8.3)
##                         :           existing_loans_count > 1: no (2.3)
##                         job = unskilled:
##                         :...other_credit = bank: no (2.1)
##                             other_credit = store: yes (3.3/0.9)
##                             other_credit = none:
##                             :...checking_balance = > 200 DM: yes (8.7/2)
##                                 checking_balance in {< 0 DM,1 - 200 DM}:
##                                 :...housing in {other,own}: no (16.4/2.9)
##                                     housing = rent: yes (5.3/1.4)
## 
## 
## Evaluation on training data (900 cases):
## 
## Trial        Decision Tree   
## -----      ----------------  
##    Size      Errors  
## 
##    0     58  129(14.3%)
##    1     32  198(22.0%)
##    2     41  192(21.3%)
##    3     53  198(22.0%)
##    4     45  181(20.1%)
##    5     59  177(19.7%)
##    6     48  210(23.3%)
##    7     55  171(19.0%)
##    8     45  208(23.1%)
##    9     46  167(18.6%)
## boost             33( 3.7%)   <<
## 
## 
##     (a)   (b)    <-classified as
##    ----  ----
##     617     6    (a): class no
##      27   250    (b): class yes
## 
## 
##  Attribute usage:
## 
##  100.00% checking_balance
##  100.00% months_loan_duration
##  100.00% credit_history
##  100.00% amount
##   97.67% savings_balance
##   97.00% age
##   96.67% employment_duration
##   94.22% purpose
##   92.33% job
##   90.33% other_credit
##   89.33% dependents
##   86.67% housing
##   81.89% years_at_residence
##   78.22% percent_of_income
##   77.67% existing_loans_count
##   27.67% phone
## 
## 
## Time: 0.1 secs
credit_boost10_pred<-predict(credit_boost10, credit_test)
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 |        67 |        10 |        77 | 
##                |     0.670 |     0.100 |           | 
## ---------------|-----------|-----------|-----------|
##            yes |        12 |        11 |        23 | 
##                |     0.120 |     0.110 |           | 
## ---------------|-----------|-----------|-----------|
##   Column Total |        79 |        21 |       100 | 
## ---------------|-----------|-----------|-----------|
## 
## 
matrix_dimensions <- list(c("no", "yes"), c("no", "yes"))
names(matrix_dimensions) <- c("predicted", "actual")
matrix_dimensions
## $predicted
## [1] "no"  "yes"
## 
## $actual
## [1] "no"  "yes"
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
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 |        43 |        34 |        77 | 
##                |     0.430 |     0.340 |           | 
## ---------------|-----------|-----------|-----------|
##            yes |         5 |        18 |        23 | 
##                |     0.050 |     0.180 |           | 
## ---------------|-----------|-----------|-----------|
##   Column Total |        48 |        52 |       100 | 
## ---------------|-----------|-----------|-----------|
## 
##