This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
##load data
#install.packages("C50")
library(C50)
## Warning: package 'C50' was built under R version 4.3.3
library(dplyr)
##
## 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)
creditS <- read_csv("C:/GGTUAN/DREAMS/Yankee/TSU/MSc_TSU/Spring_2024/CS-583 Data Minning/credit.csv")
## Rows: 1000 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): checking_balance, credit_history, purpose, savings_balance, employ...
## dbl (7): months_loan_duration, amount, percent_of_income, years_at_residenc...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
credit <- creditS
View(credit)
str(credit)
## spc_tbl_ [1,000 × 17] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ checking_balance : chr [1:1000] "< 0 DM" "1 - 200 DM" "unknown" "< 0 DM" ...
## $ months_loan_duration: num [1:1000] 6 48 12 42 24 36 24 36 12 30 ...
## $ credit_history : chr [1:1000] "critical" "good" "critical" "good" ...
## $ purpose : chr [1:1000] "furniture/appliances" "furniture/appliances" "education" "furniture/appliances" ...
## $ amount : num [1:1000] 1169 5951 2096 7882 4870 ...
## $ savings_balance : chr [1:1000] "unknown" "< 100 DM" "< 100 DM" "< 100 DM" ...
## $ employment_duration : chr [1:1000] "> 7 years" "1 - 4 years" "4 - 7 years" "4 - 7 years" ...
## $ percent_of_income : num [1:1000] 4 2 2 2 3 2 3 2 2 4 ...
## $ years_at_residence : num [1:1000] 4 2 3 4 4 4 4 2 4 2 ...
## $ age : num [1:1000] 67 22 49 45 53 35 53 35 61 28 ...
## $ other_credit : chr [1:1000] "none" "none" "none" "none" ...
## $ housing : chr [1:1000] "own" "own" "own" "other" ...
## $ existing_loans_count: num [1:1000] 2 1 1 1 2 1 1 1 1 2 ...
## $ job : chr [1:1000] "skilled" "skilled" "unskilled" "skilled" ...
## $ dependents : num [1:1000] 1 1 2 2 2 2 1 1 1 1 ...
## $ phone : chr [1:1000] "yes" "no" "no" "no" ...
## $ default : chr [1:1000] "no" "yes" "no" "no" ...
## - attr(*, "spec")=
## .. cols(
## .. checking_balance = col_character(),
## .. months_loan_duration = col_double(),
## .. credit_history = col_character(),
## .. purpose = col_character(),
## .. amount = col_double(),
## .. savings_balance = col_character(),
## .. employment_duration = col_character(),
## .. percent_of_income = col_double(),
## .. years_at_residence = col_double(),
## .. age = col_double(),
## .. other_credit = col_character(),
## .. housing = col_character(),
## .. existing_loans_count = col_double(),
## .. job = col_character(),
## .. dependents = col_double(),
## .. phone = col_character(),
## .. default = col_character()
## .. )
## - attr(*, "problems")=<externalptr>
#Look at the data and be familiar - Exploratory Analysis
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
##Split to train and test
train_sample <- sample(1000, 900)
str(train_sample)
## int [1:900] 448 90 128 43 480 520 711 657 601 484 ...
credit_train <- credit[train_sample, ]
credit_test <- credit[-train_sample, ]
prop.table(table(credit_train$default))
##
## no yes
## 0.7033333 0.2966667
prop.table(table(credit_test$default))
##
## no yes
## 0.67 0.33
View(credit_train)
str(credit_train$default)
## chr [1:900] "no" "yes" "yes" "no" "no" "no" "no" "yes" "no" "no" "no" "no" ...
#germ_df1\(seed <- as.integer(factor(germ_df1\)seed))
#Make default column a factor
credit_train$default <- factor(credit_train$default)
str(credit_train$default)
## Factor w/ 2 levels "no","yes": 1 2 2 1 1 1 1 2 1 1 ...
#Invoke C5.0 and view summary
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: 61
##
## 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] Sun Mar 31 16:37:43 2024
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}: no (419/59)
## checking_balance in {1 - 200 DM,< 0 DM}:
## :...credit_history in {perfect,very good}:
## :...housing in {other,rent}: yes (27/4)
## : housing = own:
## : :...savings_balance = < 100 DM: yes (17/5)
## : savings_balance in {500 - 1000 DM,> 1000 DM}: no (4)
## : savings_balance = unknown:
## : :...months_loan_duration <= 27: yes (2)
## : : months_loan_duration > 27: no (3)
## : savings_balance = 100 - 500 DM:
## : :...months_loan_duration <= 21: yes (3)
## : months_loan_duration > 21: no (2)
## credit_history in {good,poor,critical}:
## :...months_loan_duration > 22:
## :...savings_balance = 500 - 1000 DM: yes (4/1)
## : savings_balance = > 1000 DM: no (3)
## : savings_balance = unknown:
## : :...checking_balance = 1 - 200 DM: no (16/1)
## : : checking_balance = < 0 DM: yes (11/4)
## : savings_balance = 100 - 500 DM:
## : :...purpose = furniture/appliances: yes (13/3)
## : : purpose in {renovations,business,car0,education}: no (7/1)
## : : purpose = car:
## : : :...amount <= 6361: no (4)
## : : amount > 6361: yes (2)
## : savings_balance = < 100 DM:
## : :...months_loan_duration > 47: yes (18/2)
## : months_loan_duration <= 47:
## : :...housing = other:
## : :...percent_of_income <= 3: no (8)
## : : percent_of_income > 3:
## : : :...age <= 36: no (2)
## : : age > 36: yes (4)
## : housing = own:
## : :...employment_duration = 4 - 7 years: yes (11/2)
## : : employment_duration = > 7 years: no (12/5)
## : : employment_duration = unemployed:
## : : :...years_at_residence <= 2: yes (3)
## : : : years_at_residence > 2: no (3)
## : : employment_duration = 1 - 4 years:
## : : :...purpose in {furniture/appliances,
## : : : : renovations}: no (7)
## : : : purpose in {business,car0,education}: yes (8/1)
## : : : purpose = car:
## : : : :...years_at_residence <= 3: yes (2)
## : : : years_at_residence > 3: no (3)
## : : employment_duration = < 1 year:
## : : :...years_at_residence > 3: yes (7)
## : : years_at_residence <= 3:
## : : :...checking_balance = 1 - 200 DM: no (7/1)
## : : checking_balance = < 0 DM: yes (6/2)
## : housing = rent:
## : :...other_credit = store: yes (0)
## : other_credit = bank: no (1)
## : other_credit = none:
## : :...percent_of_income > 2: yes (10/1)
## : percent_of_income <= 2:
## : :...years_at_residence <= 3: no (3)
## : years_at_residence > 3: yes (2)
## months_loan_duration <= 22:
## :...existing_loans_count > 1: no (75/13)
## existing_loans_count <= 1:
## :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (17/1)
## savings_balance in {< 100 DM,unknown,100 - 500 DM}:
## :...purpose in {renovations,business,car0}: no (14/2)
## purpose = education:
## :...savings_balance in {< 100 DM,100 - 500 DM}: yes (5)
## : savings_balance = unknown: no (2)
## purpose = car:
## :...other_credit = store: no (0)
## : other_credit = bank: yes (7/1)
## : other_credit = none:
## : :...housing = other: yes (4)
## : housing in {own,rent}:
## : :...amount <= 1372:
## : :...dependents <= 1: yes (13/2)
## : : dependents > 1: no (2)
## : amount > 1372:
## : :...amount <= 8133: no (23/2)
## : amount > 8133: yes (2)
## purpose = furniture/appliances:
## :...savings_balance = 100 - 500 DM: yes (3)
## savings_balance in {< 100 DM,unknown}:
## :...job = unskilled: no (19/2)
## job = unemployed: yes (1)
## job = management:
## :...amount <= 3195: no (4)
## : amount > 3195: yes (4)
## job = skilled:
## :...months_loan_duration <= 7: no (8)
## months_loan_duration > 7:
## :...percent_of_income <= 1: yes (4)
## percent_of_income > 1: [S1]
##
## SubTree [S1]
##
## employment_duration in {4 - 7 years,> 7 years}: no (15/1)
## employment_duration = unemployed: yes (1)
## employment_duration = 1 - 4 years:
## :...months_loan_duration <= 13: no (10/4)
## : months_loan_duration > 13: yes (6)
## employment_duration = < 1 year:
## :...years_at_residence <= 1: no (3)
## years_at_residence > 1: yes (4/1)
##
##
## Evaluation on training data (900 cases):
##
## Decision Tree
## ----------------
## Size Errors
##
## 59 121(13.4%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 604 29 (a): class no
## 92 175 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 53.44% credit_history
## 48.11% months_loan_duration
## 42.11% savings_balance
## 27.33% existing_loans_count
## 22.33% housing
## 22.22% purpose
## 12.00% employment_duration
## 8.78% job
## 8.00% percent_of_income
## 7.44% other_credit
## 6.00% amount
## 4.78% years_at_residence
## 1.67% dependents
## 0.67% age
##
##
## Time: 0.0 secs
#Predict and view CrossTable - Confussion Matrix
credit_pred <- predict(credit_model, credit_test)
library(gmodels)
## Warning: package 'gmodels' was built under R version 4.3.3
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 | 59 | 8 | 67 |
## | 0.590 | 0.080 | |
## ---------------|-----------|-----------|-----------|
## yes | 16 | 17 | 33 |
## | 0.160 | 0.170 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 75 | 25 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
##Boost and see impact
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: 46.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] Sun Mar 31 16:37:43 2024
## -------------------------------
##
## Class specified by attribute `outcome'
##
## Read 900 cases (17 attributes) from undefined.data
##
## ----- Trial 0: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}: no (419/59)
## checking_balance in {1 - 200 DM,< 0 DM}:
## :...credit_history in {perfect,very good}:
## :...housing in {other,rent}: yes (27/4)
## : housing = own:
## : :...savings_balance = < 100 DM: yes (17/5)
## : savings_balance in {500 - 1000 DM,> 1000 DM}: no (4)
## : savings_balance = unknown:
## : :...months_loan_duration <= 27: yes (2)
## : : months_loan_duration > 27: no (3)
## : savings_balance = 100 - 500 DM:
## : :...months_loan_duration <= 21: yes (3)
## : months_loan_duration > 21: no (2)
## credit_history in {good,poor,critical}:
## :...months_loan_duration > 22:
## :...savings_balance = 500 - 1000 DM: yes (4/1)
## : savings_balance = > 1000 DM: no (3)
## : savings_balance = unknown:
## : :...checking_balance = 1 - 200 DM: no (16/1)
## : : checking_balance = < 0 DM: yes (11/4)
## : savings_balance = 100 - 500 DM:
## : :...purpose = furniture/appliances: yes (13/3)
## : : purpose in {renovations,business,car0,education}: no (7/1)
## : : purpose = car:
## : : :...amount <= 6361: no (4)
## : : amount > 6361: yes (2)
## : savings_balance = < 100 DM:
## : :...months_loan_duration > 47: yes (18/2)
## : months_loan_duration <= 47:
## : :...housing = other:
## : :...percent_of_income <= 3: no (8)
## : : percent_of_income > 3:
## : : :...age <= 36: no (2)
## : : age > 36: yes (4)
## : housing = own:
## : :...employment_duration = 4 - 7 years: yes (11/2)
## : : employment_duration = > 7 years: no (12/5)
## : : employment_duration = unemployed:
## : : :...years_at_residence <= 2: yes (3)
## : : : years_at_residence > 2: no (3)
## : : employment_duration = 1 - 4 years:
## : : :...purpose in {furniture/appliances,
## : : : : renovations}: no (7)
## : : : purpose in {business,car0,education}: yes (8/1)
## : : : purpose = car:
## : : : :...years_at_residence <= 3: yes (2)
## : : : years_at_residence > 3: no (3)
## : : employment_duration = < 1 year:
## : : :...years_at_residence > 3: yes (7)
## : : years_at_residence <= 3:
## : : :...checking_balance = 1 - 200 DM: no (7/1)
## : : checking_balance = < 0 DM: yes (6/2)
## : housing = rent:
## : :...other_credit = store: yes (0)
## : other_credit = bank: no (1)
## : other_credit = none:
## : :...percent_of_income > 2: yes (10/1)
## : percent_of_income <= 2:
## : :...years_at_residence <= 3: no (3)
## : years_at_residence > 3: yes (2)
## months_loan_duration <= 22:
## :...existing_loans_count > 1: no (75/13)
## existing_loans_count <= 1:
## :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (17/1)
## savings_balance in {< 100 DM,unknown,100 - 500 DM}:
## :...purpose in {renovations,business,car0}: no (14/2)
## purpose = education:
## :...savings_balance in {< 100 DM,100 - 500 DM}: yes (5)
## : savings_balance = unknown: no (2)
## purpose = car:
## :...other_credit = store: no (0)
## : other_credit = bank: yes (7/1)
## : other_credit = none:
## : :...housing = other: yes (4)
## : housing in {own,rent}:
## : :...amount <= 1372:
## : :...dependents <= 1: yes (13/2)
## : : dependents > 1: no (2)
## : amount > 1372:
## : :...amount <= 8133: no (23/2)
## : amount > 8133: yes (2)
## purpose = furniture/appliances:
## :...savings_balance = 100 - 500 DM: yes (3)
## savings_balance in {< 100 DM,unknown}:
## :...job = unskilled: no (19/2)
## job = unemployed: yes (1)
## job = management:
## :...amount <= 3195: no (4)
## : amount > 3195: yes (4)
## job = skilled:
## :...months_loan_duration <= 7: no (8)
## months_loan_duration > 7:
## :...percent_of_income <= 1: yes (4)
## percent_of_income > 1: [S1]
##
## SubTree [S1]
##
## employment_duration in {4 - 7 years,> 7 years}: no (15/1)
## employment_duration = unemployed: yes (1)
## employment_duration = 1 - 4 years:
## :...months_loan_duration <= 13: no (10/4)
## : months_loan_duration > 13: yes (6)
## employment_duration = < 1 year:
## :...years_at_residence <= 1: no (3)
## years_at_residence > 1: yes (4/1)
##
## ----- Trial 1: -----
##
## Decision tree:
##
## months_loan_duration <= 7:
## :...amount <= 4139: no (59.9/4.7)
## : amount > 4139: yes (5.5/1.6)
## months_loan_duration > 7:
## :...savings_balance in {unknown,> 1000 DM}:
## :...employment_duration in {4 - 7 years,> 7 years,< 1 year}: no (116.7/20.5)
## : employment_duration in {1 - 4 years,unemployed}:
## : :...age > 50: yes (11.8/1.6)
## : age <= 50:
## : :...savings_balance = > 1000 DM: no (8.7)
## : savings_balance = unknown:
## : :...job in {management,unemployed}: no (10.2)
## : job in {skilled,unskilled}:
## : :...other_credit in {bank,store}: yes (6.3/1.6)
## : other_credit = none:
## : :...amount <= 1597: yes (13.4/2.4)
## : amount > 1597: no (22.1/3.9)
## savings_balance in {< 100 DM,500 - 1000 DM,100 - 500 DM}:
## :...checking_balance = unknown:
## :...other_credit in {bank,store}:
## : :...age > 45: no (6.3)
## : : age <= 45:
## : : :...percent_of_income <= 1: no (3.2)
## : : percent_of_income > 1:
## : : :...purpose in {furniture/appliances,car0}: no (12.6/4.7)
## : : purpose in {renovations,car,business,
## : : education}: yes (32.3/1.6)
## : other_credit = none:
## : :...age > 31: no (80.4/7.1)
## : age <= 31:
## : :...employment_duration = unemployed: yes (4.7)
## : employment_duration in {1 - 4 years,4 - 7 years,> 7 years,
## : : < 1 year}:
## : :...credit_history in {perfect,critical,
## : : very good}: no (21.3/4.7)
## : credit_history = poor: yes (13.4/3.9)
## : credit_history = good:
## : :...phone = yes: no (16.6/2.4)
## : phone = no:
## : :...existing_loans_count > 1: yes (5.5/0.8)
## : existing_loans_count <= 1:
## : :...age <= 23: yes (9.4/2.4)
## : age > 23: no (16.6/4.7)
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...employment_duration in {4 - 7 years,unemployed}:
## :...age > 50: no (12.6)
## : age <= 50:
## : :...amount <= 951: yes (10.2/0.8)
## : amount > 951: no (74.9/25.2)
## employment_duration in {1 - 4 years,> 7 years,< 1 year}:
## :...months_loan_duration > 30: yes (56/13.4)
## months_loan_duration <= 30:
## :...housing = other: no (19.7/7.9)
## housing = rent: yes (58.3/20.5)
## housing = own:
## :...percent_of_income > 2:
## :...age <= 28:
## : :...job in {unskilled,management}: no (21.3/4.7)
## : : job = unemployed: yes (2.4)
## : : job = skilled:
## : : :...percent_of_income <= 3: yes (7.1/1.6)
## : : percent_of_income > 3: no (14.2/3.2)
## : age > 28:
## : :...years_at_residence <= 3: yes (56.7/13.4)
## : years_at_residence > 3:
## : :...percent_of_income <= 3: no (4.7)
## : percent_of_income > 3: yes (22.1/9.5)
## percent_of_income <= 2:
## :...savings_balance in {500 - 1000 DM,
## : 100 - 500 DM}: no (7.1)
## savings_balance = < 100 DM:
## :...credit_history in {perfect,poor}: no (12.6)
## credit_history in {good,critical,very good}:
## :...other_credit = store: no (3.9)
## other_credit in {none,bank}:
## :...phone = yes: yes (11.8/3.2)
## phone = no:
## :...existing_loans_count > 1: no (4.7)
## existing_loans_count <= 1: [S1]
##
## SubTree [S1]
##
## months_loan_duration <= 14: no (6.3/0.8)
## months_loan_duration > 14: yes (16.5/4.7)
##
## ----- Trial 2: -----
##
## Decision tree:
##
## credit_history = critical:
## :...other_credit in {bank,store}: yes (46.2/18.9)
## : other_credit = none:
## : :...amount <= 6887: no (180.9/34.1)
## : amount > 6887: yes (17/6.4)
## credit_history in {perfect,very good}:
## :...existing_loans_count > 1:
## : :...months_loan_duration <= 27: yes (22.6/0.6)
## : : months_loan_duration > 27: no (9.8/2.6)
## : existing_loans_count <= 1:
## : :...age <= 23: no (6.3)
## : age > 23:
## : :...credit_history = perfect: no (9.6/3.2)
## : credit_history = very good:
## : :...amount <= 8471: yes (33.5/9)
## : amount > 8471: no (3.8)
## credit_history in {good,poor}:
## :...checking_balance = < 0 DM:
## :...existing_loans_count > 1: yes (17.1/3.5)
## : existing_loans_count <= 1:
## : :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (4.1)
## : savings_balance = 100 - 500 DM: yes (7.3/3.2)
## : savings_balance = unknown:
## : :...other_credit in {none,store}: yes (18.2/6.4)
## : : other_credit = bank: no (3.4)
## : savings_balance = < 100 DM:
## : :...job in {unskilled,management}: no (48.1/18.5)
## : job = unemployed: yes (2.2)
## : job = skilled:
## : :...purpose in {renovations,business,car0,
## : : education}: yes (4.7)
## : purpose = car:
## : :...years_at_residence <= 2: yes (8.2)
## : : years_at_residence > 2: no (15.2/5.9)
## : purpose = furniture/appliances:
## : :...years_at_residence <= 1: no (6)
## : years_at_residence > 1:
## : :...percent_of_income <= 1: no (3.7/0.6)
## : percent_of_income > 1: yes (28.3/9.3)
## checking_balance in {1 - 200 DM,unknown,> 200 DM}:
## :...employment_duration = 4 - 7 years: no (58.7/11)
## employment_duration in {1 - 4 years,> 7 years,< 1 year,unemployed}:
## :...amount > 7966: yes (27.2/5.1)
## amount <= 7966:
## :...dependents > 1:
## :...phone = yes: no (10.5/0.6)
## : phone = no:
## : :...age <= 33: no (5.1)
## : age > 33: yes (25.2/2.6)
## dependents <= 1:
## :...employment_duration = > 7 years: no (57.2/10.4)
## employment_duration in {1 - 4 years,< 1 year,unemployed}:
## :...checking_balance = > 200 DM: no (26.8/5.7)
## checking_balance in {1 - 200 DM,unknown}:
## :...purpose in {renovations,education}: yes (18.3/6.3)
## purpose in {business,car0}: no (21.7/8.3)
## purpose = car:
## :...percent_of_income <= 1: no (8.2)
## : percent_of_income > 1:
## : :...age <= 27: yes (18.8/6)
## : age > 27: no (26/4.7)
## purpose = furniture/appliances:
## :...existing_loans_count > 1: yes (14.6/5.1)
## existing_loans_count <= 1: [S1]
##
## SubTree [S1]
##
## employment_duration = < 1 year: no (29.9/8.2)
## employment_duration = unemployed: yes (6.6/2.6)
## employment_duration = 1 - 4 years:
## :...checking_balance = 1 - 200 DM: yes (22.7/8.4)
## checking_balance = unknown:
## :...job in {skilled,unemployed}: no (14.8)
## job in {unskilled,management}: yes (11.2/1.9)
##
## ----- Trial 3: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...other_credit = store: no (16.3/6.3)
## : other_credit = bank:
## : :...years_at_residence <= 2: yes (28.4/7.6)
## : : years_at_residence > 2: no (27.4/8.9)
## : other_credit = none:
## : :...credit_history in {perfect,critical,very good}: no (80.8/8.8)
## : credit_history = good:
## : :...existing_loans_count <= 1: no (101.7/24.2)
## : : existing_loans_count > 1:
## : : :...percent_of_income <= 2: yes (12.2/0.5)
## : : percent_of_income > 2: no (9.4/1.6)
## : credit_history = poor:
## : :...percent_of_income <= 3: no (13.7/1.6)
## : percent_of_income > 3:
## : :...amount <= 1525: no (3.2)
## : amount > 1525: yes (18.2/3.9)
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...savings_balance in {unknown,> 1000 DM}: no (93.9/30.9)
## savings_balance = 500 - 1000 DM:
## :...percent_of_income <= 3: no (15.2/2.5)
## : percent_of_income > 3: yes (11.2/3.7)
## savings_balance = 100 - 500 DM:
## :...months_loan_duration > 27: yes (15/5.1)
## : months_loan_duration <= 27:
## : :...percent_of_income <= 1: yes (7.4/1.1)
## : percent_of_income > 1: no (30.8/7.8)
## savings_balance = < 100 DM:
## :...months_loan_duration > 47: yes (22.3/3.2)
## months_loan_duration <= 47:
## :...job = unemployed: yes (6.8/1.6)
## job = management:
## :...years_at_residence <= 1: no (6.8)
## : years_at_residence > 1:
## : :...existing_loans_count > 2: no (4.4)
## : existing_loans_count <= 2:
## : :...other_credit in {none,store}: yes (45.4/12.6)
## : other_credit = bank: no (10.5/3)
## job = unskilled:
## :...existing_loans_count > 1:
## : :...age <= 59: no (26.4/2.5)
## : : age > 59: yes (2.5)
## : existing_loans_count <= 1:
## : :...other_credit = store: no (3.7)
## : other_credit in {none,bank}:
## : :...dependents > 1: yes (11/3.9)
## : dependents <= 1:
## : :...years_at_residence <= 2: no (27.2/9.2)
## : years_at_residence > 2:
## : :...age <= 49: yes (21/5.3)
## : age > 49: no (3.6)
## job = skilled:
## :...other_credit = store: yes (7.1/2.3)
## other_credit = bank:
## :...years_at_residence <= 1: no (5.5/0.5)
## : years_at_residence > 1: yes (26.3/4.1)
## other_credit = none:
## :...checking_balance = > 200 DM: no (21.4/5)
## checking_balance in {1 - 200 DM,< 0 DM}:
## :...phone = yes:
## :...age <= 43: yes (42.3/12.8)
## : age > 43: no (4.3)
## phone = no:
## :...purpose = car0: no (0)
## purpose in {renovations,business,
## : education}: yes (12.9/3.7)
## purpose = car:
## :...percent_of_income <= 2: no (12.9/2.7)
## : percent_of_income > 2: yes (18.8/5.6)
## purpose = furniture/appliances:
## :...years_at_residence > 3: no (28.4/9.2)
## years_at_residence <= 3:
## :...months_loan_duration <= 8: no (5.7)
## months_loan_duration > 8:
## :...age <= 28: no (17.3/5)
## age > 28: yes (20.8/5.7)
##
## ----- Trial 4: -----
##
## Decision tree:
##
## age <= 25:
## :...other_credit = bank: yes (25/7.7)
## : other_credit = store: no (8/2.2)
## : other_credit = none:
## : :...employment_duration in {1 - 4 years,4 - 7 years,< 1 year,
## : : unemployed}: yes (144.7/60.5)
## : employment_duration = > 7 years: no (6.2)
## age > 25:
## :...months_loan_duration <= 8: no (60/10.6)
## months_loan_duration > 8:
## :...credit_history in {perfect,very good}:
## :...housing = rent: yes (8.6/0.4)
## : housing in {own,other}:
## : :...dependents > 1: yes (16.7/3.5)
## : dependents <= 1:
## : :...amount <= 1382: yes (6.4)
## : amount > 1382:
## : :...phone = no: no (17/4.1)
## : phone = yes: yes (19.6/8.8)
## credit_history in {good,poor,critical}:
## :...percent_of_income <= 2:
## :...job in {unskilled,management,unemployed}: no (68.8/17.2)
## : job = skilled:
## : :...percent_of_income <= 1:
## : :...years_at_residence <= 1: yes (6.4)
## : : years_at_residence > 1:
## : : :...housing in {own,rent}: no (19.9/2.8)
## : : housing = other: yes (7.9/1.5)
## : percent_of_income > 1:
## : :...phone = yes: no (25.7/3.5)
## : phone = no:
## : :...amount <= 1393: yes (7.7/0.4)
## : amount > 1393: no (48.2/13.9)
## percent_of_income > 2:
## :...housing = other:
## :...other_credit = store: yes (3.7)
## : other_credit in {none,bank}:
## : :...age > 58: no (3.8)
## : age <= 58:
## : :...years_at_residence <= 1: no (2.2)
## : years_at_residence > 1:
## : :...existing_loans_count > 1: yes (12.1/3.8)
## : existing_loans_count <= 1:
## : :...amount <= 7253: no (18.4/7.5)
## : amount > 7253: yes (9.4)
## housing = rent:
## :...months_loan_duration > 33: yes (7.4)
## : months_loan_duration <= 33:
## : :...amount <= 1175: yes (6.4)
## : amount > 1175:
## : :...checking_balance in {unknown,
## : : > 200 DM}: no (10.5)
## : checking_balance in {1 - 200 DM,< 0 DM}:
## : :...dependents > 1: no (2.6)
## : dependents <= 1:
## : :...age <= 45: yes (18.9/6.1)
## : age > 45: no (4.3)
## housing = own:
## :...years_at_residence > 3: no (94.3/24.6)
## years_at_residence <= 3:
## :...employment_duration = unemployed: yes (15.8/5.4)
## employment_duration = 4 - 7 years:
## :...checking_balance in {1 - 200 DM,< 0 DM,
## : : unknown}: no (29.1/4.3)
## : checking_balance = > 200 DM: yes (5.7/0.4)
## employment_duration = > 7 years:
## :...other_credit in {none,store}: no (29.2/9.1)
## : other_credit = bank: yes (11.9/4.4)
## employment_duration = < 1 year:
## :...checking_balance in {1 - 200 DM,unknown,
## : : > 200 DM}: no (23.1/4.9)
## : checking_balance = < 0 DM: yes (9.6/2.6)
## employment_duration = 1 - 4 years:
## :...existing_loans_count > 1:
## :...age <= 53: no (28.8/9)
## : age > 53: yes (2.2)
## existing_loans_count <= 1:
## :...phone = yes: yes (17/2.8)
## phone = no:
## :...percent_of_income <= 3: no (3.1)
## percent_of_income > 3:
## :...job in {skilled,management,
## : unemployed}: yes (18.2/3.2)
## job = unskilled: no (15.1/6.4)
##
## ----- Trial 5: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...other_credit = store: yes (15.1/6.9)
## : other_credit = bank:
## : :...age > 44: no (11.6/1.1)
## : : age <= 44:
## : : :...months_loan_duration <= 8: no (2.9)
## : : months_loan_duration > 8:
## : : :...age > 34: yes (13.8/1.3)
## : : age <= 34:
## : : :...housing in {own,other}: no (25.5/9.9)
## : : housing = rent: yes (5.7/0.4)
## : other_credit = none:
## : :...credit_history in {perfect,very good}: no (4)
## : credit_history = poor:
## : :...percent_of_income <= 3: no (11.5/1.9)
## : : percent_of_income > 3: yes (20.1/8.6)
## : credit_history = critical:
## : :...age > 30: no (39.7)
## : : age <= 30:
## : : :...purpose = car0: no (0)
## : : purpose = education: yes (4.8)
## : : purpose in {furniture/appliances,renovations,car,business}:
## : : :...amount <= 6458: no (15.5)
## : : amount > 6458: yes (6.9/1.5)
## : credit_history = good:
## : :...existing_loans_count > 1: yes (19.5/7)
## : existing_loans_count <= 1:
## : :...employment_duration = > 7 years: no (13.4)
## : employment_duration in {1 - 4 years,4 - 7 years,< 1 year,
## : : unemployed}:
## : :...housing in {other,rent}: no (30.2/6.4)
## : housing = own:
## : :...job in {skilled,unemployed}: no (37.3/10.8)
## : job in {unskilled,management}: yes (15.8/4)
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...savings_balance = > 1000 DM: no (14.8/3.4)
## savings_balance = 500 - 1000 DM:
## :...existing_loans_count <= 1: no (17.6/4.2)
## : existing_loans_count > 1: yes (7.5/2.7)
## savings_balance = 100 - 500 DM:
## :...purpose in {renovations,business}: no (13.4/0.9)
## : purpose in {furniture/appliances,car,car0,education}:
## : :...phone = yes: no (17.2/6.7)
## : phone = no:
## : :...dependents > 1: yes (4.3)
## : dependents <= 1:
## : :...credit_history in {good,perfect,poor,
## : : very good}: yes (20.5/4)
## : credit_history = critical: no (3.4)
## savings_balance = unknown:
## :...months_loan_duration > 36: no (7.4)
## : months_loan_duration <= 36:
## : :...credit_history in {perfect,poor}: no (5.7)
## : credit_history in {good,critical,very good}:
## : :...housing in {other,rent}: yes (21.8/7.5)
## : housing = own:
## : :...existing_loans_count > 1: no (10.6/4.3)
## : existing_loans_count <= 1:
## : :...employment_duration in {1 - 4 years,> 7 years,
## : : unemployed}: yes (27.2/8.9)
## : employment_duration in {4 - 7 years,
## : < 1 year}: no (8.4)
## savings_balance = < 100 DM:
## :...months_loan_duration > 42: yes (24/5.5)
## months_loan_duration <= 42:
## :...credit_history = perfect: yes (17.1/7.3)
## credit_history = poor:
## :...percent_of_income <= 2: no (10.1/2.4)
## : percent_of_income > 2: yes (15.7/2.3)
## credit_history = very good:
## :...age <= 23: no (4.8)
## : age > 23: yes (18.6/4.4)
## credit_history = good:
## :...amount > 8086: yes (14.5/1)
## : amount <= 8086:
## : :...job = management: no (26.7/6.1)
## : job = unemployed: yes (1.2)
## : job in {skilled,unskilled}:
## : :...purpose in {renovations,business,car0,
## : : education}: no (21.7/7)
## : purpose = furniture/appliances:
## : :...phone = no: no (101.8/38.7)
## : : phone = yes: yes (14.5/4.4)
## : purpose = car:
## : :...housing in {own,other}: yes (40/11.4)
## : housing = rent: no (9.3/2.5)
## credit_history = critical:
## :...housing = other: no (8.9)
## housing in {own,rent}:
## :...dependents > 1: no (12.7/1.9)
## dependents <= 1:
## :...purpose in {renovations,business,car0}: no (7.8/2.6)
## purpose = education: yes (7.3/0.4)
## purpose = furniture/appliances:
## :...amount <= 2039: no (13.7/0.9)
## : amount > 2039: yes (23.8/10.5)
## purpose = car:
## :...housing = rent: yes (5.6)
## housing = own:
## :...age <= 29: yes (6.4)
## age > 29: no (20.9/6.2)
##
## ----- Trial 6: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...other_credit = bank:
## : :...age <= 44: yes (46.5/18.8)
## : : age > 44: no (10.4/1.7)
## : other_credit in {none,store}:
## : :...employment_duration in {4 - 7 years,> 7 years}: no (84.1/12.7)
## : employment_duration in {1 - 4 years,< 1 year,unemployed}:
## : :...amount > 4530: yes (32.9/10.8)
## : amount <= 4530:
## : :...percent_of_income <= 1: no (10.7)
## : percent_of_income > 1:
## : :...credit_history = perfect: yes (1.8/0.3)
## : credit_history in {poor,very good}: no (17.6/2.9)
## : credit_history = critical:
## : :...purpose in {furniture/appliances,renovations,car,
## : : : car0}: no (14.7)
## : : purpose in {business,education}: yes (8.6/3.1)
## : credit_history = good:
## : :...savings_balance in {unknown,> 1000 DM,
## : : 100 - 500 DM}: no (19.3/2.2)
## : savings_balance = 500 - 1000 DM: yes (10.1/3.6)
## : savings_balance = < 100 DM:
## : :...age <= 23: yes (8.3)
## : age > 23:
## : :...months_loan_duration <= 30: no (20.4/3.1)
## : months_loan_duration > 30: yes (3.8)
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (39.7/14.6)
## savings_balance = 100 - 500 DM:
## :...employment_duration in {1 - 4 years,< 1 year,
## : : unemployed}: yes (32.1/9.7)
## : employment_duration in {4 - 7 years,> 7 years}: no (25.8/7.2)
## savings_balance = unknown:
## :...credit_history in {perfect,poor,critical}: no (20.3/5.5)
## : credit_history = very good: yes (6.4/2.9)
## : credit_history = good:
## : :...amount > 10366: yes (3)
## : amount <= 10366:
## : :...job in {unskilled,unemployed}: no (7.3)
## : job in {skilled,management}:
## : :...checking_balance in {1 - 200 DM,> 200 DM}: no (24.7/8)
## : checking_balance = < 0 DM:
## : :...other_credit in {none,store}: yes (18.4/5.9)
## : other_credit = bank: no (3.8)
## savings_balance = < 100 DM:
## :...years_at_residence <= 1:
## :...job = management: no (7.7)
## : job = unemployed: yes (2.2)
## : job in {skilled,unskilled}:
## : :...housing in {own,other}: no (53.1/16.9)
## : housing = rent: yes (9/1.3)
## years_at_residence > 1:
## :...job = unemployed: no (3.7/0.7)
## job = unskilled:
## :...months_loan_duration <= 22: no (56.3/17.1)
## : months_loan_duration > 22: yes (18/4.4)
## job = management:
## :...credit_history in {perfect,poor}: yes (12/0.8)
## : credit_history in {good,critical,very good}:
## : :...existing_loans_count > 2: no (3.1)
## : existing_loans_count <= 2:
## : :...employment_duration in {1 - 4 years,
## : : > 7 years}: yes (24.6/7.1)
## : employment_duration in {4 - 7 years,< 1 year,
## : unemployed}: no (26.9/7.6)
## job = skilled:
## :...checking_balance = > 200 DM: no (23.4/7.7)
## checking_balance in {1 - 200 DM,< 0 DM}:
## :...percent_of_income <= 1: no (21.3/7.2)
## percent_of_income > 1:
## :...other_credit in {bank,store}: yes (23.4/3.7)
## other_credit = none:
## :...credit_history in {perfect,poor,
## : very good}: yes (13.1/3.5)
## credit_history = critical:
## :...existing_loans_count <= 1: no (10.9/2.7)
## : existing_loans_count > 1:
## : :...dependents <= 1: yes (33.2/14.3)
## : dependents > 1: no (2.2)
## credit_history = good:
## :...age <= 23: yes (15)
## age > 23:
## :...months_loan_duration <= 10: no (10.9/2.4)
## months_loan_duration > 10:
## :...years_at_residence <= 2: yes (16.7/1.7)
## years_at_residence > 2:
## :...age <= 30: no (14.8/2.2)
## age > 30: yes (28/5.9)
##
## ----- Trial 7: -----
##
## Decision tree:
##
## checking_balance = unknown:
## :...employment_duration = 1 - 4 years: no (119/38.5)
## : employment_duration = unemployed: yes (16.1/8)
## : employment_duration = 4 - 7 years:
## : :...age <= 22: yes (8.3/2.4)
## : : age > 22: no (36.6/2)
## : employment_duration = > 7 years:
## : :...dependents <= 1: no (39.1/7.4)
## : : dependents > 1:
## : : :...months_loan_duration <= 24: yes (16.9/6.1)
## : : months_loan_duration > 24: no (4.9)
## : employment_duration = < 1 year:
## : :...purpose = car0: no (0)
## : purpose in {renovations,business}: yes (8.5)
## : purpose in {furniture/appliances,car,education}:
## : :...months_loan_duration <= 7: yes (3.5)
## : months_loan_duration > 7: no (33.8/7.5)
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...credit_history = critical: no (136.7/54.4)
## credit_history = perfect:
## :...housing = own: no (17.5/5.9)
## : housing in {other,rent}: yes (7.2)
## credit_history = poor:
## :...age > 55: yes (6.1)
## : age <= 55:
## : :...existing_loans_count <= 3: no (34.2/12.4)
## : existing_loans_count > 3: yes (2.2)
## credit_history = very good:
## :...existing_loans_count > 1: yes (7.5)
## : existing_loans_count <= 1:
## : :...months_loan_duration <= 16: yes (10.8/0.8)
## : months_loan_duration > 16: no (25.8/9.2)
## credit_history = good:
## :...amount > 8086: yes (24.6/3.9)
## amount <= 8086:
## :...age > 54:
## :...amount <= 776: yes (3)
## : amount > 776: no (19.4)
## age <= 54:
## :...percent_of_income <= 2:
## :...other_credit = bank: yes (12.7/4.8)
## : other_credit = store: no (3.7)
## : other_credit = none:
## : :...years_at_residence <= 1: yes (20.3/7.3)
## : years_at_residence > 1:
## : :...amount <= 1386: yes (19.5/7)
## : amount > 1386: no (60.2/14.3)
## percent_of_income > 2:
## :...years_at_residence <= 1:
## :...phone = yes: no (4.6)
## : phone = no:
## : :...other_credit in {bank,store}: no (2.7)
## : other_credit = none:
## : :...age <= 26: no (16.1/2.8)
## : age > 26: yes (14.6/3.2)
## years_at_residence > 1:
## :...other_credit = store: yes (5.7)
## other_credit in {none,bank}:
## :...housing = other: yes (15.1/4.2)
## housing in {own,rent}:
## :...job in {management,unemployed}: no (14/2.9)
## job in {skilled,unskilled}:
## :...age > 33: yes (33.7/12.1)
## age <= 33:
## :...dependents <= 1: yes (91.7/32)
## dependents > 1: no (3.6)
##
## ----- Trial 8: -----
##
## Decision tree:
##
## checking_balance in {1 - 200 DM,< 0 DM,> 200 DM}:
## :...savings_balance = > 1000 DM: no (15/5)
## : savings_balance = 500 - 1000 DM:
## : :...employment_duration in {1 - 4 years,4 - 7 years,
## : : : < 1 year}: yes (21/6.1)
## : : employment_duration in {> 7 years,unemployed}: no (6.1)
## : savings_balance = unknown:
## : :...employment_duration in {4 - 7 years,> 7 years,< 1 year,
## : : : unemployed}: no (49.2/15.2)
## : : employment_duration = 1 - 4 years:
## : : :...purpose in {furniture/appliances,renovations,car,
## : : : car0}: yes (20/6.2)
## : : purpose in {business,education}: no (7.5)
## : savings_balance = 100 - 500 DM:
## : :...purpose in {renovations,business}: no (13.9/1)
## : : purpose in {car0,education}: yes (4.8/1.8)
## : : purpose = furniture/appliances:
## : : :...employment_duration in {1 - 4 years,4 - 7 years,< 1 year,
## : : : : unemployed}: yes (17.3/3.9)
## : : : employment_duration = > 7 years: no (4.4)
## : : purpose = car:
## : : :...checking_balance in {1 - 200 DM,> 200 DM}: yes (18.6/7.7)
## : : checking_balance = < 0 DM: no (6)
## : savings_balance = < 100 DM:
## : :...months_loan_duration <= 15:
## : :...purpose in {furniture/appliances,business,car0}: no (92.5/30.3)
## : : purpose in {renovations,education}: yes (18.2/8.1)
## : : purpose = car:
## : : :...checking_balance = > 200 DM: no (4)
## : : checking_balance in {1 - 200 DM,< 0 DM}:
## : : :...years_at_residence <= 1: yes (4.9)
## : : years_at_residence > 1:
## : : :...dependents <= 1: yes (42.1/17.4)
## : : dependents > 1: no (9.9/2.3)
## : months_loan_duration > 15:
## : :...percent_of_income <= 3:
## : :...months_loan_duration > 47: yes (10.7)
## : : months_loan_duration <= 47:
## : : :...housing = other: no (15.9/1.7)
## : : housing in {own,rent}:
## : : :...employment_duration = > 7 years: yes (17.9/8.7)
## : : employment_duration = unemployed: no (7.3/3.3)
## : : employment_duration = 4 - 7 years:
## : : :...months_loan_duration <= 22: no (5.9)
## : : : months_loan_duration > 22: yes (17.6/2.8)
## : : employment_duration = < 1 year:
## : : :...months_loan_duration <= 40: yes (20.4/3.5)
## : : : months_loan_duration > 40: no (2.5)
## : : employment_duration = 1 - 4 years:
## : : :...months_loan_duration <= 18: yes (11.7/2)
## : : months_loan_duration > 18:
## : : :...amount <= 7721: no (32.8/5.3)
## : : amount > 7721: yes (4.4)
## : percent_of_income > 3:
## : :...credit_history in {perfect,poor,very good}: yes (18.9)
## : credit_history in {good,critical}:
## : :...existing_loans_count > 1:
## : :...housing in {other,rent}: yes (9.7)
## : : housing = own:
## : : :...months_loan_duration <= 22: no (5.1)
## : : months_loan_duration > 22: yes (16/2.6)
## : existing_loans_count <= 1:
## : :...age > 48: no (6.4/0.2)
## : age <= 48:
## : :...age > 32: yes (26.5/3.7)
## : age <= 32:
## : :...checking_balance = 1 - 200 DM: no (8.4/0.5)
## : checking_balance in {< 0 DM,
## : > 200 DM}: yes (30.8/14.6)
## checking_balance = unknown:
## :...purpose = renovations: yes (6.8/3.3)
## purpose in {car0,education}: no (22.4/5.7)
## purpose = business:
## :...existing_loans_count > 2: yes (2.3)
## : existing_loans_count <= 2:
## : :...employment_duration in {1 - 4 years,4 - 7 years,
## : : > 7 years}: no (23.1/6)
## : employment_duration in {< 1 year,unemployed}: yes (7.6)
## purpose = car:
## :...other_credit = bank:
## : :...months_loan_duration <= 12: no (2.9)
## : : months_loan_duration > 12: yes (19.3/5.2)
## : other_credit in {none,store}:
## : :...employment_duration in {4 - 7 years,< 1 year,
## : : unemployed}: no (18.5)
## : employment_duration in {1 - 4 years,> 7 years}:
## : :...savings_balance in {500 - 1000 DM,> 1000 DM,
## : : 100 - 500 DM}: no (12.9/3.2)
## : savings_balance = < 100 DM:
## : :...age <= 25: yes (4.9)
## : : age > 25: no (17.3/2.4)
## : savings_balance = unknown:
## : :...months_loan_duration <= 22: yes (12.4/3.3)
## : months_loan_duration > 22: no (9.1)
## purpose = furniture/appliances:
## :...housing in {other,rent}: no (27.9/10.3)
## housing = own:
## :...percent_of_income <= 1: yes (6.9/2.2)
## percent_of_income > 1:
## :...age > 35: no (18.8)
## age <= 35:
## :...job = unemployed: no (0)
## job = management: yes (9.2/3.1)
## job in {skilled,unskilled}:
## :...employment_duration in {1 - 4 years,< 1 year,
## : unemployed}: no (21.6)
## employment_duration in {4 - 7 years,> 7 years}:
## :...months_loan_duration > 26: no (4.9)
## months_loan_duration <= 26:
## :...age <= 23: yes (5)
## age > 23: no (19.1/7.9)
##
## ----- Trial 9: -----
##
## Decision tree:
##
## checking_balance in {unknown,> 200 DM}:
## :...purpose in {furniture/appliances,renovations,car,car0,
## : : education}: no (280.8/72.4)
## : purpose = business:
## : :...checking_balance = > 200 DM: yes (3/0.4)
## : checking_balance = unknown:
## : :...employment_duration in {1 - 4 years,< 1 year,
## : : unemployed}: yes (23.5/6.7)
## : employment_duration in {4 - 7 years,> 7 years}: no (7.6)
## checking_balance in {1 - 200 DM,< 0 DM}:
## :...credit_history in {perfect,very good}:
## :...age <= 23: no (5.7/0.2)
## : age > 23:
## : :...housing = rent: yes (14.9)
## : housing in {own,other}:
## : :...years_at_residence <= 2: no (21.8/8.1)
## : years_at_residence > 2: yes (28/4.7)
## credit_history in {good,poor,critical}:
## :...savings_balance in {500 - 1000 DM,> 1000 DM}: no (29.7/11.6)
## savings_balance = 100 - 500 DM:
## :...amount <= 836: yes (3.8)
## : amount > 836: no (46.9/12)
## savings_balance = unknown:
## :...existing_loans_count > 1: no (6.7)
## : existing_loans_count <= 1:
## : :...job = unskilled: no (5.6)
## : job in {skilled,management,unemployed}:
## : :...purpose in {renovations,business,car0,
## : : education}: no (4.8)
## : purpose in {furniture/appliances,car}:
## : :...amount > 10366: yes (2.7)
## : amount <= 10366:
## : :...months_loan_duration <= 10: no (3.7)
## : months_loan_duration > 10:
## : :...months_loan_duration <= 18: yes (19.1/4.3)
## : months_loan_duration > 18: no (21.3/7.9)
## savings_balance = < 100 DM:
## :...credit_history = poor:
## :...percent_of_income <= 1: no (4)
## : percent_of_income > 1: yes (23.5/6.1)
## credit_history = good:
## :...job = unemployed: yes (1.1)
## : job = management:
## : :...amount <= 7629: no (26.6/5.8)
## : : amount > 7629: yes (10.8/1.5)
## : job = unskilled:
## : :...dependents > 1: yes (10.4/2.9)
## : : dependents <= 1:
## : : :...months_loan_duration <= 27: no (40.2/11.1)
## : : months_loan_duration > 27: yes (6.7/2.1)
## : job = skilled:
## : :...dependents > 1: no (21.5/8.4)
## : dependents <= 1:
## : :...months_loan_duration > 39: yes (7.1)
## : months_loan_duration <= 39:
## : :...purpose in {renovations,car0,
## : : education}: yes (4.3/1)
## : purpose = business: no (2.2)
## : purpose = car:
## : :...checking_balance = 1 - 200 DM: no (9.4/2.4)
## : : checking_balance = < 0 DM: yes (19.2/8.3)
## : purpose = furniture/appliances:
## : :...phone = yes: yes (7.2/1.1)
## : phone = no: [S1]
## credit_history = critical:
## :...years_at_residence <= 1: no (6)
## years_at_residence > 1:
## :...amount <= 1185: no (17.4/3.1)
## amount > 1185:
## :...dependents > 1: no (9.1/1.5)
## dependents <= 1:
## :...age > 57: yes (8.1/1.8)
## age <= 57:
## :...amount > 5998: yes (7/1.3)
## amount <= 5998:
## :...housing = other: no (1.8)
## housing = rent: yes (15.5/5.1)
## housing = own:
## :...age <= 33: yes (22.4/8.2)
## age > 33: no (16.5/1.9)
##
## SubTree [S1]
##
## employment_duration in {4 - 7 years,> 7 years,< 1 year}: no (24/7.3)
## employment_duration = unemployed: yes (0.9)
## employment_duration = 1 - 4 years:
## :...months_loan_duration <= 21: yes (27.7/8)
## months_loan_duration > 21: no (4.9/0.9)
##
##
## Evaluation on training data (900 cases):
##
## Trial Decision Tree
## ----- ----------------
## Size Errors
##
## 0 59 121(13.4%)
## 1 41 183(20.3%)
## 2 40 202(22.4%)
## 3 42 188(20.9%)
## 4 43 220(24.4%)
## 5 55 195(21.7%)
## 6 47 180(20.0%)
## 7 37 219(24.3%)
## 8 58 184(20.4%)
## 9 46 175(19.4%)
## boost 43( 4.8%) <<
##
##
## (a) (b) <-classified as
## ---- ----
## 628 5 (a): class no
## 38 229 (b): class yes
##
##
## Attribute usage:
##
## 100.00% checking_balance
## 100.00% months_loan_duration
## 100.00% credit_history
## 100.00% age
## 98.44% employment_duration
## 96.89% savings_balance
## 94.89% other_credit
## 93.89% percent_of_income
## 92.44% amount
## 91.78% housing
## 89.33% purpose
## 81.11% existing_loans_count
## 79.33% years_at_residence
## 73.11% job
## 71.67% dependents
## 47.33% phone
##
##
## Time: 0.0 secs
#Predict with boosting and view CrossTable
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 | 59 | 8 | 67 |
## | 0.590 | 0.080 | |
## ---------------|-----------|-----------|-----------|
## yes | 14 | 19 | 33 |
## | 0.140 | 0.190 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 73 | 27 | 100 |
## ---------------|-----------|-----------|-----------|
##
##
#Build error cost maxtrix to serve as feeder
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
#run with the error cost , predict and view cost matrix
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 | 28 | 39 | 67 |
## | 0.280 | 0.390 | |
## ---------------|-----------|-----------|-----------|
## yes | 2 | 31 | 33 |
## | 0.020 | 0.310 | |
## ---------------|-----------|-----------|-----------|
## Column Total | 30 | 70 | 100 |
## ---------------|-----------|-----------|-----------|
##
##