Untitled

# Load required libraries
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.0     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(caret)
Loading required package: lattice

Attaching package: 'caret'

The following object is masked from 'package:purrr':

    lift
library(e1071)
library(randomForest)
randomForest 4.7-1.1
Type rfNews() to see new features/changes/bug fixes.

Attaching package: 'randomForest'

The following object is masked from 'package:dplyr':

    combine

The following object is masked from 'package:ggplot2':

    margin
library(xgboost)

Attaching package: 'xgboost'

The following object is masked from 'package:dplyr':

    slice
library(lightgbm)
library(ROCR)
library(ggplot2)
library(data.table)

Attaching package: 'data.table'

The following objects are masked from 'package:lubridate':

    hour, isoweek, mday, minute, month, quarter, second, wday, week,
    yday, year

The following objects are masked from 'package:dplyr':

    between, first, last

The following object is masked from 'package:purrr':

    transpose
# Load the dataset
df_credit <- read.csv("C:/Users/pmasu/Downloads/german_credit_data.csv", row.names = 1)
# Convert the target variable to a factor
df_credit$Risk <- as.factor(df_credit$Risk)
# EDA: Summarize the dataset
summary(df_credit)
      Age            Sex                 Job          Housing         
 Min.   :19.00   Length:1000        Min.   :0.000   Length:1000       
 1st Qu.:27.00   Class :character   1st Qu.:2.000   Class :character  
 Median :33.00   Mode  :character   Median :2.000   Mode  :character  
 Mean   :35.55                      Mean   :1.904                     
 3rd Qu.:42.00                      3rd Qu.:2.000                     
 Max.   :75.00                      Max.   :3.000                     
 Saving.accounts    Checking.account   Credit.amount      Duration   
 Length:1000        Length:1000        Min.   :  250   Min.   : 4.0  
 Class :character   Class :character   1st Qu.: 1366   1st Qu.:12.0  
 Mode  :character   Mode  :character   Median : 2320   Median :18.0  
                                       Mean   : 3271   Mean   :20.9  
                                       3rd Qu.: 3972   3rd Qu.:24.0  
                                       Max.   :18424   Max.   :72.0  
   Purpose            Risk    
 Length:1000        bad :300  
 Class :character   good:700  
 Mode  :character             
                              
                              
                              
str(df_credit)
'data.frame':   1000 obs. of  10 variables:
 $ Age             : int  67 22 49 45 53 35 53 35 61 28 ...
 $ Sex             : chr  "male" "female" "male" "male" ...
 $ Job             : int  2 2 1 2 2 1 2 3 1 3 ...
 $ Housing         : chr  "own" "own" "own" "free" ...
 $ Saving.accounts : chr  NA "little" "little" "little" ...
 $ Checking.account: chr  "little" "moderate" NA "little" ...
 $ Credit.amount   : int  1169 5951 2096 7882 4870 9055 2835 6948 3059 5234 ...
 $ Duration        : int  6 48 12 42 24 36 24 36 12 30 ...
 $ Purpose         : chr  "radio/TV" "radio/TV" "education" "furniture/equipment" ...
 $ Risk            : Factor w/ 2 levels "bad","good": 2 1 2 2 1 2 2 2 2 1 ...
# EDA: Visualizations
ggplot(df_credit, aes(x = Age)) + geom_histogram(binwidth = 5) + facet_wrap(~Risk) + ggtitle("Age Distribution by Risk")

ggplot(df_credit, aes(x = Sex, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Sex Distribution by Risk")

ggplot(df_credit, aes(x = Job, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Job Distribution by Risk")

ggplot(df_credit, aes(x = Housing, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Housing Distribution by Risk")

ggplot(df_credit, aes(x = Saving.accounts, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Saving Accounts Distribution by Risk")

ggplot(df_credit, aes(x = Checking.account, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Checking Account Distribution by Risk")

ggplot(df_credit, aes(x = Credit.amount)) + geom_histogram(binwidth = 500) + facet_wrap(~Risk) + ggtitle("Credit Amount Distribution by Risk")

ggplot(df_credit, aes(x = Duration)) + geom_histogram(binwidth = 5) + facet_wrap(~Risk) + ggtitle("Duration Distribution by Risk")

ggplot(df_credit, aes(x = Purpose, fill = Risk)) + geom_bar(position = "dodge") + ggtitle("Purpose Distribution by Risk")

# Preprocessing: Handle missing values
df_credit <- df_credit %>%
  mutate(
    Saving.accounts = ifelse(is.na(Saving.accounts), "unknown", Saving.accounts),
    Checking.account = ifelse(is.na(Checking.account), "unknown", Checking.account)
  )
# Convert categorical variables to factors
df_credit <- df_credit %>%
  mutate(
    Sex = as.factor(Sex),
    Job = as.factor(Job),
    Housing = as.factor(Housing),
    Saving.accounts = as.factor(Saving.accounts),
    Checking.account = as.factor(Checking.account),
    Purpose = as.factor(Purpose)
  )
# Split the data into training and test sets
set.seed(123)
trainIndex <- createDataPartition(df_credit$Risk, p = .8, 
                                  list = FALSE, 
                                  times = 1)
df_train <- df_credit[trainIndex,]
df_test <- df_credit[-trainIndex,]
# Define the control function for training
train_control <- trainControl(method = "cv", number = 5, classProbs = TRUE, summaryFunction = twoClassSummary)
# Train a Logistic Regression model
set.seed(123)
model_glm <- train(Risk ~ ., data = df_train, method = "glm", family = "binomial", trControl = train_control, metric = "ROC")
# Train a Random Forest model
set.seed(123)
model_rf <- train(Risk ~ ., data = df_train, method = "rf", trControl = train_control, metric = "ROC", tuneLength = 5)
# Train a Support Vector Machine model
set.seed(123)
model_svm <- train(Risk ~ ., data = df_train, method = "svmRadial", trControl = train_control, metric = "ROC", tuneLength = 5)
# Train an XGBoost model
set.seed(123)
model_xgb <- train(Risk ~ ., data = df_train, method = "xgbTree", trControl = train_control, metric = "ROC", tuneLength = 5)
# Evaluate models on test data
models <- list(glm = model_glm, rf = model_rf, svm = model_svm, xgb = model_xgb)
results <- resamples(models)
summary(results)

Call:
summary.resamples(object = results)

Models: glm, rf, svm, xgb 
Number of resamples: 5 

ROC 
         Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
glm 0.6145833 0.7148438 0.7795759 0.7558036 0.8132440 0.8567708    0
rf  0.6433222 0.7472098 0.7650670 0.7521577 0.7936198 0.8115699    0
svm 0.6396949 0.7358631 0.7979911 0.7567336 0.8007812 0.8093378    0
xgb 0.6343006 0.7510231 0.7711124 0.7664807 0.8314732 0.8444940    0

Sens 
         Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
glm 0.3750000 0.3750000 0.4375000 0.4166667 0.4375000 0.4583333    0
rf  0.3541667 0.3750000 0.3958333 0.4250000 0.4791667 0.5208333    0
svm 0.2500000 0.3541667 0.3541667 0.3625000 0.3958333 0.4583333    0
xgb 0.2916667 0.2916667 0.3750000 0.3666667 0.4166667 0.4583333    0

Spec 
         Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
glm 0.8125000 0.8482143 0.8571429 0.8750000 0.9107143 0.9464286    0
rf  0.8035714 0.8392857 0.8750000 0.8678571 0.8839286 0.9375000    0
svm 0.8392857 0.8839286 0.8839286 0.9035714 0.9464286 0.9642857    0
xgb 0.8392857 0.8392857 0.8660714 0.8785714 0.8839286 0.9642857    0
# Predict and evaluate the best model
best_model <- models[[which.max(sapply(models, function(x) max(x$results$ROC)))]]
predictions <- predict(best_model, df_test)
probabilities <- predict(best_model, df_test, type = "prob")
best_model
eXtreme Gradient Boosting 

800 samples
  9 predictor
  2 classes: 'bad', 'good' 

No pre-processing
Resampling: Cross-Validated (5 fold) 
Summary of sample sizes: 640, 640, 640, 640, 640 
Resampling results across tuning parameters:

  eta  max_depth  colsample_bytree  subsample  nrounds  ROC        Sens     
  0.3  1          0.6               0.500       50      0.7566592  0.3541667
  0.3  1          0.6               0.500      100      0.7496466  0.4166667
  0.3  1          0.6               0.500      150      0.7435454  0.4041667
  0.3  1          0.6               0.500      200      0.7321615  0.4041667
  0.3  1          0.6               0.500      250      0.7286458  0.3958333
  0.3  1          0.6               0.625       50      0.7588542  0.3458333
  0.3  1          0.6               0.625      100      0.7446615  0.3708333
  0.3  1          0.6               0.625      150      0.7414249  0.4000000
  0.3  1          0.6               0.625      200      0.7358073  0.3958333
  0.3  1          0.6               0.625      250      0.7291481  0.3916667
  0.3  1          0.6               0.750       50      0.7607515  0.3458333
  0.3  1          0.6               0.750      100      0.7505208  0.4000000
  0.3  1          0.6               0.750      150      0.7491629  0.4000000
  0.3  1          0.6               0.750      200      0.7443266  0.4208333
  0.3  1          0.6               0.750      250      0.7421689  0.4416667
  0.3  1          0.6               0.875       50      0.7631510  0.3625000
  0.3  1          0.6               0.875      100      0.7561012  0.4083333
  0.3  1          0.6               0.875      150      0.7488281  0.3958333
  0.3  1          0.6               0.875      200      0.7441406  0.4125000
  0.3  1          0.6               0.875      250      0.7393415  0.4208333
  0.3  1          0.6               1.000       50      0.7644903  0.3416667
  0.3  1          0.6               1.000      100      0.7597098  0.3916667
  0.3  1          0.6               1.000      150      0.7558222  0.4041667
  0.3  1          0.6               1.000      200      0.7512463  0.3958333
  0.3  1          0.6               1.000      250      0.7493304  0.3875000
  0.3  1          0.8               0.500       50      0.7562128  0.3625000
  0.3  1          0.8               0.500      100      0.7481585  0.3875000
  0.3  1          0.8               0.500      150      0.7463356  0.4208333
  0.3  1          0.8               0.500      200      0.7412016  0.4041667
  0.3  1          0.8               0.500      250      0.7282180  0.4500000
  0.3  1          0.8               0.625       50      0.7664807  0.3666667
  0.3  1          0.8               0.625      100      0.7568266  0.4166667
  0.3  1          0.8               0.625      150      0.7448103  0.4208333
  0.3  1          0.8               0.625      200      0.7438244  0.4291667
  0.3  1          0.8               0.625      250      0.7467262  0.4416667
  0.3  1          0.8               0.750       50      0.7598586  0.3958333
  0.3  1          0.8               0.750      100      0.7536272  0.4166667
  0.3  1          0.8               0.750      150      0.7449963  0.4083333
  0.3  1          0.8               0.750      200      0.7373326  0.4208333
  0.3  1          0.8               0.750      250      0.7336868  0.4083333
  0.3  1          0.8               0.875       50      0.7635231  0.3791667
  0.3  1          0.8               0.875      100      0.7571243  0.4083333
  0.3  1          0.8               0.875      150      0.7519159  0.3791667
  0.3  1          0.8               0.875      200      0.7449591  0.3791667
  0.3  1          0.8               0.875      250      0.7428385  0.4041667
  0.3  1          0.8               1.000       50      0.7645089  0.3375000
  0.3  1          0.8               1.000      100      0.7587240  0.4000000
  0.3  1          0.8               1.000      150      0.7553571  0.3916667
  0.3  1          0.8               1.000      200      0.7518787  0.3875000
  0.3  1          0.8               1.000      250      0.7498326  0.3916667
  0.3  2          0.6               0.500       50      0.7405134  0.3958333
  0.3  2          0.6               0.500      100      0.7388765  0.4458333
  0.3  2          0.6               0.500      150      0.7301711  0.4500000
  0.3  2          0.6               0.500      200      0.7340774  0.4833333
  0.3  2          0.6               0.500      250      0.7250000  0.4708333
  0.3  2          0.6               0.625       50      0.7546317  0.4666667
  0.3  2          0.6               0.625      100      0.7465960  0.4916667
  0.3  2          0.6               0.625      150      0.7441592  0.4916667
  0.3  2          0.6               0.625      200      0.7378720  0.5041667
  0.3  2          0.6               0.625      250      0.7371280  0.5125000
  0.3  2          0.6               0.750       50      0.7463914  0.4208333
  0.3  2          0.6               0.750      100      0.7391927  0.4083333
  0.3  2          0.6               0.750      150      0.7281994  0.4375000
  0.3  2          0.6               0.750      200      0.7325893  0.4750000
  0.3  2          0.6               0.750      250      0.7305432  0.4666667
  0.3  2          0.6               0.875       50      0.7572359  0.4000000
  0.3  2          0.6               0.875      100      0.7500558  0.4208333
  0.3  2          0.6               0.875      150      0.7381882  0.4333333
  0.3  2          0.6               0.875      200      0.7292783  0.4416667
  0.3  2          0.6               0.875      250      0.7289062  0.4708333
  0.3  2          0.6               1.000       50      0.7605097  0.4000000
  0.3  2          0.6               1.000      100      0.7469494  0.4125000
  0.3  2          0.6               1.000      150      0.7398251  0.4500000
  0.3  2          0.6               1.000      200      0.7353609  0.4583333
  0.3  2          0.6               1.000      250      0.7330171  0.4458333
  0.3  2          0.8               0.500       50      0.7358817  0.4041667
  0.3  2          0.8               0.500      100      0.7390067  0.4666667
  0.3  2          0.8               0.500      150      0.7327567  0.4750000
  0.3  2          0.8               0.500      200      0.7286644  0.4416667
  0.3  2          0.8               0.500      250      0.7280878  0.4750000
  0.3  2          0.8               0.625       50      0.7516555  0.4166667
  0.3  2          0.8               0.625      100      0.7488653  0.4291667
  0.3  2          0.8               0.625      150      0.7390439  0.4875000
  0.3  2          0.8               0.625      200      0.7458333  0.5125000
  0.3  2          0.8               0.625      250      0.7379836  0.5208333
  0.3  2          0.8               0.750       50      0.7503906  0.4166667
  0.3  2          0.8               0.750      100      0.7390625  0.4291667
  0.3  2          0.8               0.750      150      0.7404390  0.4458333
  0.3  2          0.8               0.750      200      0.7389509  0.4333333
  0.3  2          0.8               0.750      250      0.7289062  0.4625000
  0.3  2          0.8               0.875       50      0.7558408  0.4125000
  0.3  2          0.8               0.875      100      0.7414807  0.4333333
  0.3  2          0.8               0.875      150      0.7331473  0.4625000
  0.3  2          0.8               0.875      200      0.7308036  0.4583333
  0.3  2          0.8               0.875      250      0.7285714  0.4500000
  0.3  2          0.8               1.000       50      0.7544271  0.4041667
  0.3  2          0.8               1.000      100      0.7487909  0.4541667
  0.3  2          0.8               1.000      150      0.7425409  0.4500000
  0.3  2          0.8               1.000      200      0.7346540  0.4625000
  0.3  2          0.8               1.000      250      0.7292969  0.4708333
  0.3  3          0.6               0.500       50      0.7420945  0.4583333
  0.3  3          0.6               0.500      100      0.7274926  0.4708333
  0.3  3          0.6               0.500      150      0.7235491  0.4666667
  0.3  3          0.6               0.500      200      0.7276042  0.4583333
  0.3  3          0.6               0.500      250      0.7243676  0.4791667
  0.3  3          0.6               0.625       50      0.7435082  0.4000000
  0.3  3          0.6               0.625      100      0.7329241  0.4250000
  0.3  3          0.6               0.625      150      0.7235863  0.4375000
  0.3  3          0.6               0.625      200      0.7219494  0.4458333
  0.3  3          0.6               0.625      250      0.7220238  0.4541667
  0.3  3          0.6               0.750       50      0.7518973  0.4166667
  0.3  3          0.6               0.750      100      0.7314360  0.4375000
  0.3  3          0.6               0.750      150      0.7304688  0.4541667
  0.3  3          0.6               0.750      200      0.7258929  0.4625000
  0.3  3          0.6               0.750      250      0.7239955  0.4708333
  0.3  3          0.6               0.875       50      0.7473400  0.4625000
  0.3  3          0.6               0.875      100      0.7351749  0.4708333
  0.3  3          0.6               0.875      150      0.7295759  0.4875000
  0.3  3          0.6               0.875      200      0.7261905  0.4791667
  0.3  3          0.6               0.875      250      0.7237723  0.4916667
  0.3  3          0.6               1.000       50      0.7510975  0.4583333
  0.3  3          0.6               1.000      100      0.7400484  0.4875000
  0.3  3          0.6               1.000      150      0.7323103  0.4833333
  0.3  3          0.6               1.000      200      0.7282924  0.4916667
  0.3  3          0.6               1.000      250      0.7292411  0.4833333
  0.3  3          0.8               0.500       50      0.7363467  0.4708333
  0.3  3          0.8               0.500      100      0.7296503  0.4833333
  0.3  3          0.8               0.500      150      0.7261161  0.5125000
  0.3  3          0.8               0.500      200      0.7232887  0.4916667
  0.3  3          0.8               0.500      250      0.7224330  0.5083333
  0.3  3          0.8               0.625       50      0.7326637  0.4625000
  0.3  3          0.8               0.625      100      0.7335193  0.4625000
  0.3  3          0.8               0.625      150      0.7320685  0.4791667
  0.3  3          0.8               0.625      200      0.7288690  0.4875000
  0.3  3          0.8               0.625      250      0.7313988  0.4708333
  0.3  3          0.8               0.750       50      0.7511347  0.4291667
  0.3  3          0.8               0.750      100      0.7409412  0.4750000
  0.3  3          0.8               0.750      150      0.7389509  0.4875000
  0.3  3          0.8               0.750      200      0.7380208  0.4916667
  0.3  3          0.8               0.750      250      0.7333333  0.4958333
  0.3  3          0.8               0.875       50      0.7394159  0.4500000
  0.3  3          0.8               0.875      100      0.7311384  0.4625000
  0.3  3          0.8               0.875      150      0.7265997  0.4791667
  0.3  3          0.8               0.875      200      0.7231771  0.4833333
  0.3  3          0.8               0.875      250      0.7216518  0.4666667
  0.3  3          0.8               1.000       50      0.7534412  0.4500000
  0.3  3          0.8               1.000      100      0.7414993  0.4375000
  0.3  3          0.8               1.000      150      0.7378162  0.4541667
  0.3  3          0.8               1.000      200      0.7321243  0.4708333
  0.3  3          0.8               1.000      250      0.7308408  0.4791667
  0.3  4          0.6               0.500       50      0.7137649  0.3708333
  0.3  4          0.6               0.500      100      0.7085193  0.4291667
  0.3  4          0.6               0.500      150      0.7192336  0.4666667
  0.3  4          0.6               0.500      200      0.7202753  0.4875000
  0.3  4          0.6               0.500      250      0.7147321  0.4791667
  0.3  4          0.6               0.625       50      0.7350074  0.4666667
  0.3  4          0.6               0.625      100      0.7295759  0.4833333
  0.3  4          0.6               0.625      150      0.7163318  0.4833333
  0.3  4          0.6               0.625      200      0.7173735  0.5041667
  0.3  4          0.6               0.625      250      0.7183408  0.4958333
  0.3  4          0.6               0.750       50      0.7372954  0.4291667
  0.3  4          0.6               0.750      100      0.7336682  0.4583333
  0.3  4          0.6               0.750      150      0.7209449  0.4291667
  0.3  4          0.6               0.750      200      0.7141741  0.4416667
  0.3  4          0.6               0.750      250      0.7113467  0.4583333
  0.3  4          0.6               0.875       50      0.7439174  0.4583333
  0.3  4          0.6               0.875      100      0.7343936  0.4750000
  0.3  4          0.6               0.875      150      0.7295759  0.4583333
  0.3  4          0.6               0.875      200      0.7279018  0.4541667
  0.3  4          0.6               0.875      250      0.7263021  0.4500000
  0.3  4          0.6               1.000       50      0.7400856  0.4375000
  0.3  4          0.6               1.000      100      0.7305246  0.4708333
  0.3  4          0.6               1.000      150      0.7319382  0.4666667
  0.3  4          0.6               1.000      200      0.7312314  0.4666667
  0.3  4          0.6               1.000      250      0.7254278  0.4625000
  0.3  4          0.8               0.500       50      0.7468378  0.4916667
  0.3  4          0.8               0.500      100      0.7383557  0.4916667
  0.3  4          0.8               0.500      150      0.7280506  0.4750000
  0.3  4          0.8               0.500      200      0.7309896  0.4666667
  0.3  4          0.8               0.500      250      0.7242560  0.4875000
  0.3  4          0.8               0.625       50      0.7326079  0.4583333
  0.3  4          0.8               0.625      100      0.7246652  0.4750000
  0.3  4          0.8               0.625      150      0.7244792  0.4708333
  0.3  4          0.8               0.625      200      0.7202753  0.4625000
  0.3  4          0.8               0.625      250      0.7200521  0.4541667
  0.3  4          0.8               0.750       50      0.7432106  0.4583333
  0.3  4          0.8               0.750      100      0.7322917  0.4708333
  0.3  4          0.8               0.750      150      0.7376116  0.4875000
  0.3  4          0.8               0.750      200      0.7338914  0.4875000
  0.3  4          0.8               0.750      250      0.7334449  0.4833333
  0.3  4          0.8               0.875       50      0.7401042  0.4583333
  0.3  4          0.8               0.875      100      0.7338542  0.4708333
  0.3  4          0.8               0.875      150      0.7271949  0.4750000
  0.3  4          0.8               0.875      200      0.7241443  0.4666667
  0.3  4          0.8               0.875      250      0.7245908  0.4791667
  0.3  4          0.8               1.000       50      0.7307106  0.4291667
  0.3  4          0.8               1.000      100      0.7298549  0.4416667
  0.3  4          0.8               1.000      150      0.7255952  0.4625000
  0.3  4          0.8               1.000      200      0.7254092  0.4833333
  0.3  4          0.8               1.000      250      0.7231399  0.4791667
  0.3  5          0.6               0.500       50      0.7229167  0.4625000
  0.3  5          0.6               0.500      100      0.7160714  0.4458333
  0.3  5          0.6               0.500      150      0.7168527  0.4458333
  0.3  5          0.6               0.500      200      0.7195685  0.4666667
  0.3  5          0.6               0.500      250      0.7187500  0.4791667
  0.3  5          0.6               0.625       50      0.7325707  0.4541667
  0.3  5          0.6               0.625      100      0.7255580  0.4666667
  0.3  5          0.6               0.625      150      0.7240699  0.4458333
  0.3  5          0.6               0.625      200      0.7251116  0.4625000
  0.3  5          0.6               0.625      250      0.7245536  0.4583333
  0.3  5          0.6               0.750       50      0.7391741  0.4541667
  0.3  5          0.6               0.750      100      0.7300223  0.4541667
  0.3  5          0.6               0.750      150      0.7234747  0.4583333
  0.3  5          0.6               0.750      200      0.7170759  0.4583333
  0.3  5          0.6               0.750      250      0.7165923  0.4708333
  0.3  5          0.6               0.875       50      0.7409412  0.4000000
  0.3  5          0.6               0.875      100      0.7330729  0.4416667
  0.3  5          0.6               0.875      150      0.7305432  0.4708333
  0.3  5          0.6               0.875      200      0.7313616  0.4666667
  0.3  5          0.6               0.875      250      0.7269717  0.4541667
  0.3  5          0.6               1.000       50      0.7553199  0.4875000
  0.3  5          0.6               1.000      100      0.7425223  0.4875000
  0.3  5          0.6               1.000      150      0.7370536  0.5166667
  0.3  5          0.6               1.000      200      0.7366071  0.5083333
  0.3  5          0.6               1.000      250      0.7345610  0.4916667
  0.3  5          0.8               0.500       50      0.7314360  0.4583333
  0.3  5          0.8               0.500      100      0.7135045  0.4500000
  0.3  5          0.8               0.500      150      0.7157366  0.4458333
  0.3  5          0.8               0.500      200      0.7082961  0.4708333
  0.3  5          0.8               0.500      250      0.7168899  0.4750000
  0.3  5          0.8               0.625       50      0.7347656  0.4541667
  0.3  5          0.8               0.625      100      0.7288690  0.4625000
  0.3  5          0.8               0.625      150      0.7231771  0.4625000
  0.3  5          0.8               0.625      200      0.7206845  0.4583333
  0.3  5          0.8               0.625      250      0.7219866  0.4750000
  0.3  5          0.8               0.750       50      0.7382440  0.4625000
  0.3  5          0.8               0.750      100      0.7245908  0.4500000
  0.3  5          0.8               0.750      150      0.7232515  0.4541667
  0.3  5          0.8               0.750      200      0.7236607  0.4666667
  0.3  5          0.8               0.750      250      0.7205357  0.4500000
  0.3  5          0.8               0.875       50      0.7264323  0.4416667
  0.3  5          0.8               0.875      100      0.7282738  0.4416667
  0.3  5          0.8               0.875      150      0.7254464  0.4625000
  0.3  5          0.8               0.875      200      0.7260789  0.4666667
  0.3  5          0.8               0.875      250      0.7243304  0.4708333
  0.3  5          0.8               1.000       50      0.7390811  0.4500000
  0.3  5          0.8               1.000      100      0.7410342  0.4750000
  0.3  5          0.8               1.000      150      0.7327381  0.4791667
  0.3  5          0.8               1.000      200      0.7343006  0.4791667
  0.3  5          0.8               1.000      250      0.7317336  0.4791667
  0.4  1          0.6               0.500       50      0.7546317  0.3958333
  0.4  1          0.6               0.500      100      0.7518787  0.4000000
  0.4  1          0.6               0.500      150      0.7532180  0.4416667
  0.4  1          0.6               0.500      200      0.7335379  0.4125000
  0.4  1          0.6               0.500      250      0.7287574  0.4208333
  0.4  1          0.6               0.625       50      0.7512091  0.3708333
  0.4  1          0.6               0.625      100      0.7451823  0.4041667
  0.4  1          0.6               0.625      150      0.7391555  0.4458333
  0.4  1          0.6               0.625      200      0.7435826  0.4416667
  0.4  1          0.6               0.625      250      0.7319010  0.4333333
  0.4  1          0.6               0.750       50      0.7594680  0.3833333
  0.4  1          0.6               0.750      100      0.7459077  0.3958333
  0.4  1          0.6               0.750      150      0.7421875  0.4333333
  0.4  1          0.6               0.750      200      0.7332589  0.4291667
  0.4  1          0.6               0.750      250      0.7361607  0.4250000
  0.4  1          0.6               0.875       50      0.7604167  0.4000000
  0.4  1          0.6               0.875      100      0.7526972  0.4000000
  0.4  1          0.6               0.875      150      0.7492001  0.3916667
  0.4  1          0.6               0.875      200      0.7413876  0.4208333
  0.4  1          0.6               0.875      250      0.7403088  0.4208333
  0.4  1          0.6               1.000       50      0.7647693  0.3583333
  0.4  1          0.6               1.000      100      0.7579241  0.3833333
  0.4  1          0.6               1.000      150      0.7512463  0.3916667
  0.4  1          0.6               1.000      200      0.7482329  0.3958333
  0.4  1          0.6               1.000      250      0.7448103  0.3791667
  0.4  1          0.8               0.500       50      0.7636719  0.4166667
  0.4  1          0.8               0.500      100      0.7521763  0.4458333
  0.4  1          0.8               0.500      150      0.7349888  0.4166667
  0.4  1          0.8               0.500      200      0.7339100  0.4250000
  0.4  1          0.8               0.500      250      0.7245722  0.4291667
  0.4  1          0.8               0.625       50      0.7545945  0.4083333
  0.4  1          0.8               0.625      100      0.7442522  0.4500000
  0.4  1          0.8               0.625      150      0.7406436  0.4375000
  0.4  1          0.8               0.625      200      0.7396391  0.4125000
  0.4  1          0.8               0.625      250      0.7292225  0.4166667
  0.4  1          0.8               0.750       50      0.7609561  0.3916667
  0.4  1          0.8               0.750      100      0.7512091  0.4250000
  0.4  1          0.8               0.750      150      0.7454055  0.4333333
  0.4  1          0.8               0.750      200      0.7380394  0.4125000
  0.4  1          0.8               0.750      250      0.7294829  0.4291667
  0.4  1          0.8               0.875       50      0.7654204  0.4041667
  0.4  1          0.8               0.875      100      0.7440848  0.4083333
  0.4  1          0.8               0.875      150      0.7380022  0.4083333
  0.4  1          0.8               0.875      200      0.7381510  0.4333333
  0.4  1          0.8               0.875      250      0.7327195  0.4333333
  0.4  1          0.8               1.000       50      0.7645833  0.3708333
  0.4  1          0.8               1.000      100      0.7566964  0.3875000
  0.4  1          0.8               1.000      150      0.7510417  0.3958333
  0.4  1          0.8               1.000      200      0.7481771  0.3916667
  0.4  1          0.8               1.000      250      0.7463356  0.3958333
  0.4  2          0.6               0.500       50      0.7327753  0.3875000
  0.4  2          0.6               0.500      100      0.7310268  0.4583333
  0.4  2          0.6               0.500      150      0.7314360  0.4750000
  0.4  2          0.6               0.500      200      0.7335193  0.4916667
  0.4  2          0.6               0.500      250      0.7286830  0.4875000
  0.4  2          0.6               0.625       50      0.7463728  0.3833333
  0.4  2          0.6               0.625      100      0.7393973  0.4541667
  0.4  2          0.6               0.625      150      0.7320685  0.4583333
  0.4  2          0.6               0.625      200      0.7340030  0.4791667
  0.4  2          0.6               0.625      250      0.7265625  0.4583333
  0.4  2          0.6               0.750       50      0.7539249  0.4166667
  0.4  2          0.6               0.750      100      0.7401600  0.4750000
  0.4  2          0.6               0.750      150      0.7308966  0.4458333
  0.4  2          0.6               0.750      200      0.7296689  0.4416667
  0.4  2          0.6               0.750      250      0.7310082  0.4583333
  0.4  2          0.6               0.875       50      0.7427269  0.4458333
  0.4  2          0.6               0.875      100      0.7322359  0.4416667
  0.4  2          0.6               0.875      150      0.7246466  0.4458333
  0.4  2          0.6               0.875      200      0.7234561  0.4583333
  0.4  2          0.6               0.875      250      0.7164621  0.4416667
  0.4  2          0.6               1.000       50      0.7537946  0.4583333
  0.4  2          0.6               1.000      100      0.7431362  0.4541667
  0.4  2          0.6               1.000      150      0.7305618  0.4625000
  0.4  2          0.6               1.000      200      0.7266555  0.4541667
  0.4  2          0.6               1.000      250      0.7245164  0.4666667
  0.4  2          0.8               0.500       50      0.7401600  0.4666667
  0.4  2          0.8               0.500      100      0.7283482  0.4541667
  0.4  2          0.8               0.500      150      0.7387649  0.4791667
  0.4  2          0.8               0.500      200      0.7336682  0.4958333
  0.4  2          0.8               0.500      250      0.7318824  0.4791667
  0.4  2          0.8               0.625       50      0.7426153  0.4125000
  0.4  2          0.8               0.625      100      0.7387463  0.4750000
  0.4  2          0.8               0.625      150      0.7440662  0.4791667
  0.4  2          0.8               0.625      200      0.7313616  0.4833333
  0.4  2          0.8               0.625      250      0.7260789  0.4750000
  0.4  2          0.8               0.750       50      0.7411644  0.4291667
  0.4  2          0.8               0.750      100      0.7267299  0.4416667
  0.4  2          0.8               0.750      150      0.7283110  0.4708333
  0.4  2          0.8               0.750      200      0.7251860  0.4541667
  0.4  2          0.8               0.750      250      0.7179688  0.4750000
  0.4  2          0.8               0.875       50      0.7513579  0.4458333
  0.4  2          0.8               0.875      100      0.7382626  0.4833333
  0.4  2          0.8               0.875      150      0.7339472  0.4875000
  0.4  2          0.8               0.875      200      0.7331287  0.4875000
  0.4  2          0.8               0.875      250      0.7286086  0.4833333
  0.4  2          0.8               1.000       50      0.7550781  0.4291667
  0.4  2          0.8               1.000      100      0.7429874  0.4541667
  0.4  2          0.8               1.000      150      0.7363653  0.4833333
  0.4  2          0.8               1.000      200      0.7281064  0.4750000
  0.4  2          0.8               1.000      250      0.7245722  0.4750000
  0.4  3          0.6               0.500       50      0.7287202  0.4333333
  0.4  3          0.6               0.500      100      0.7102307  0.4333333
  0.4  3          0.6               0.500      150      0.7181548  0.4458333
  0.4  3          0.6               0.500      200      0.7153274  0.4500000
  0.4  3          0.6               0.500      250      0.7120164  0.4625000
  0.4  3          0.6               0.625       50      0.7247396  0.4708333
  0.4  3          0.6               0.625      100      0.7126116  0.4333333
  0.4  3          0.6               0.625      150      0.7204241  0.5041667
  0.4  3          0.6               0.625      200      0.7255208  0.4916667
  0.4  3          0.6               0.625      250      0.7252976  0.4958333
  0.4  3          0.6               0.750       50      0.7323475  0.4416667
  0.4  3          0.6               0.750      100      0.7305432  0.4583333
  0.4  3          0.6               0.750      150      0.7260789  0.4708333
  0.4  3          0.6               0.750      200      0.7233259  0.4750000
  0.4  3          0.6               0.750      250      0.7241071  0.4875000
  0.4  3          0.6               0.875       50      0.7337612  0.4208333
  0.4  3          0.6               0.875      100      0.7301897  0.4625000
  0.4  3          0.6               0.875      150      0.7297991  0.4583333
  0.4  3          0.6               0.875      200      0.7258929  0.4708333
  0.4  3          0.6               0.875      250      0.7220610  0.4708333
  0.4  3          0.6               1.000       50      0.7469308  0.4583333
  0.4  3          0.6               1.000      100      0.7322731  0.4500000
  0.4  3          0.6               1.000      150      0.7281808  0.4500000
  0.4  3          0.6               1.000      200      0.7253906  0.4666667
  0.4  3          0.6               1.000      250      0.7226004  0.4750000
  0.4  3          0.8               0.500       50      0.7198289  0.4375000
  0.4  3          0.8               0.500      100      0.7162202  0.4375000
  0.4  3          0.8               0.500      150      0.7203125  0.4416667
  0.4  3          0.8               0.500      200      0.7216518  0.4583333
  0.4  3          0.8               0.500      250      0.7094494  0.4625000
  0.4  3          0.8               0.625       50      0.7443266  0.4291667
  0.4  3          0.8               0.625      100      0.7337426  0.4541667
  0.4  3          0.8               0.625      150      0.7216518  0.4833333
  0.4  3          0.8               0.625      200      0.7292783  0.4916667
  0.4  3          0.8               0.625      250      0.7279762  0.4875000
  0.4  3          0.8               0.750       50      0.7394903  0.4458333
  0.4  3          0.8               0.750      100      0.7288318  0.4625000
  0.4  3          0.8               0.750      150      0.7168899  0.4750000
  0.4  3          0.8               0.750      200      0.7131696  0.4541667
  0.4  3          0.8               0.750      250      0.7000000  0.4583333
  0.4  3          0.8               0.875       50      0.7295015  0.4375000
  0.4  3          0.8               0.875      100      0.7240699  0.4541667
  0.4  3          0.8               0.875      150      0.7241071  0.4791667
  0.4  3          0.8               0.875      200      0.7164435  0.4625000
  0.4  3          0.8               0.875      250      0.7188988  0.4625000
  0.4  3          0.8               1.000       50      0.7472284  0.4083333
  0.4  3          0.8               1.000      100      0.7444010  0.4583333
  0.4  3          0.8               1.000      150      0.7425037  0.4625000
  0.4  3          0.8               1.000      200      0.7382812  0.4666667
  0.4  3          0.8               1.000      250      0.7362351  0.4541667
  0.4  4          0.6               0.500       50      0.7236235  0.4583333
  0.4  4          0.6               0.500      100      0.6984375  0.4541667
  0.4  4          0.6               0.500      150      0.7053199  0.4666667
  0.4  4          0.6               0.500      200      0.7072173  0.4791667
  0.4  4          0.6               0.500      250      0.7084821  0.4750000
  0.4  4          0.6               0.625       50      0.7243118  0.4583333
  0.4  4          0.6               0.625      100      0.7210193  0.4583333
  0.4  4          0.6               0.625      150      0.7148810  0.4833333
  0.4  4          0.6               0.625      200      0.7163318  0.4875000
  0.4  4          0.6               0.625      250      0.7148065  0.4708333
  0.4  4          0.6               0.750       50      0.7278832  0.4583333
  0.4  4          0.6               0.750      100      0.7088542  0.4125000
  0.4  4          0.6               0.750      150      0.7058780  0.4541667
  0.4  4          0.6               0.750      200      0.7056548  0.4458333
  0.4  4          0.6               0.750      250      0.7077381  0.4333333
  0.4  4          0.6               0.875       50      0.7198847  0.4625000
  0.4  4          0.6               0.875      100      0.7135045  0.4541667
  0.4  4          0.6               0.875      150      0.7129092  0.4625000
  0.4  4          0.6               0.875      200      0.7154018  0.4625000
  0.4  4          0.6               0.875      250      0.7152902  0.4291667
  0.4  4          0.6               1.000       50      0.7328311  0.4458333
  0.4  4          0.6               1.000      100      0.7254650  0.4750000
  0.4  4          0.6               1.000      150      0.7282180  0.4916667
  0.4  4          0.6               1.000      200      0.7266183  0.4875000
  0.4  4          0.6               1.000      250      0.7262835  0.4791667
  0.4  4          0.8               0.500       50      0.7206101  0.4333333
  0.4  4          0.8               0.500      100      0.7171503  0.4875000
  0.4  4          0.8               0.500      150      0.7134673  0.4750000
  0.4  4          0.8               0.500      200      0.7129464  0.4875000
  0.4  4          0.8               0.500      250      0.7118304  0.4791667
  0.4  4          0.8               0.625       50      0.7321429  0.5083333
  0.4  4          0.8               0.625      100      0.7262649  0.4916667
  0.4  4          0.8               0.625      150      0.7191592  0.4916667
  0.4  4          0.8               0.625      200      0.7139881  0.4708333
  0.4  4          0.8               0.625      250      0.7151042  0.4541667
  0.4  4          0.8               0.750       50      0.7237723  0.4333333
  0.4  4          0.8               0.750      100      0.7261161  0.4750000
  0.4  4          0.8               0.750      150      0.7225446  0.4583333
  0.4  4          0.8               0.750      200      0.7211682  0.4625000
  0.4  4          0.8               0.750      250      0.7211310  0.4625000
  0.4  4          0.8               0.875       50      0.7270461  0.4583333
  0.4  4          0.8               0.875      100      0.7218378  0.4500000
  0.4  4          0.8               0.875      150      0.7241071  0.4750000
  0.4  4          0.8               0.875      200      0.7223958  0.4708333
  0.4  4          0.8               0.875      250      0.7197917  0.4750000
  0.4  4          0.8               1.000       50      0.7287760  0.4583333
  0.4  4          0.8               1.000      100      0.7270833  0.4791667
  0.4  4          0.8               1.000      150      0.7270833  0.5041667
  0.4  4          0.8               1.000      200      0.7257068  0.5083333
  0.4  4          0.8               1.000      250      0.7257440  0.5041667
  0.4  5          0.6               0.500       50      0.7086682  0.4416667
  0.4  5          0.6               0.500      100      0.6997396  0.4291667
  0.4  5          0.6               0.500      150      0.7037202  0.4375000
  0.4  5          0.6               0.500      200      0.6991815  0.4458333
  0.4  5          0.6               0.500      250      0.6989211  0.4166667
  0.4  5          0.6               0.625       50      0.7282738  0.4666667
  0.4  5          0.6               0.625      100      0.7253348  0.4833333
  0.4  5          0.6               0.625      150      0.7245908  0.4708333
  0.4  5          0.6               0.625      200      0.7255952  0.4833333
  0.4  5          0.6               0.625      250      0.7209449  0.5041667
  0.4  5          0.6               0.750       50      0.7320685  0.4958333
  0.4  5          0.6               0.750      100      0.7220610  0.4916667
  0.4  5          0.6               0.750      150      0.7166295  0.4666667
  0.4  5          0.6               0.750      200      0.7168899  0.4666667
  0.4  5          0.6               0.750      250      0.7141741  0.4708333
  0.4  5          0.6               0.875       50      0.7274368  0.4375000
  0.4  5          0.6               0.875      100      0.7222470  0.4583333
  0.4  5          0.6               0.875      150      0.7214286  0.4708333
  0.4  5          0.6               0.875      200      0.7202753  0.4625000
  0.4  5          0.6               0.875      250      0.7192708  0.4541667
  0.4  5          0.6               1.000       50      0.7298921  0.4333333
  0.4  5          0.6               1.000      100      0.7278646  0.4625000
  0.4  5          0.6               1.000      150      0.7239955  0.4625000
  0.4  5          0.6               1.000      200      0.7236979  0.4541667
  0.4  5          0.6               1.000      250      0.7234003  0.4583333
  0.4  5          0.8               0.500       50      0.7212426  0.4458333
  0.4  5          0.8               0.500      100      0.7082217  0.4666667
  0.4  5          0.8               0.500      150      0.7041295  0.4375000
  0.4  5          0.8               0.500      200      0.7047619  0.4750000
  0.4  5          0.8               0.500      250      0.7065476  0.4666667
  0.4  5          0.8               0.625       50      0.7198847  0.4416667
  0.4  5          0.8               0.625      100      0.7123140  0.4583333
  0.4  5          0.8               0.625      150      0.7119420  0.4500000
  0.4  5          0.8               0.625      200      0.7146577  0.4583333
  0.4  5          0.8               0.625      250      0.7125372  0.4666667
  0.4  5          0.8               0.750       50      0.7307850  0.4625000
  0.4  5          0.8               0.750      100      0.7195871  0.4666667
  0.4  5          0.8               0.750      150      0.7241071  0.4791667
  0.4  5          0.8               0.750      200      0.7222470  0.4875000
  0.4  5          0.8               0.750      250      0.7225818  0.4875000
  0.4  5          0.8               0.875       50      0.7197359  0.4666667
  0.4  5          0.8               0.875      100      0.7158482  0.4583333
  0.4  5          0.8               0.875      150      0.7162574  0.4500000
  0.4  5          0.8               0.875      200      0.7143601  0.4625000
  0.4  5          0.8               0.875      250      0.7143601  0.4583333
  0.4  5          0.8               1.000       50      0.7309338  0.4833333
  0.4  5          0.8               1.000      100      0.7257813  0.4583333
  0.4  5          0.8               1.000      150      0.7207217  0.4791667
  0.4  5          0.8               1.000      200      0.7185268  0.4666667
  0.4  5          0.8               1.000      250      0.7183408  0.4625000
  Spec     
  0.8821429
  0.8607143
  0.8553571
  0.8517857
  0.8571429
  0.8803571
  0.8625000
  0.8589286
  0.8428571
  0.8446429
  0.8875000
  0.8678571
  0.8625000
  0.8464286
  0.8446429
  0.8910714
  0.8767857
  0.8678571
  0.8660714
  0.8607143
  0.9000000
  0.8875000
  0.8785714
  0.8696429
  0.8678571
  0.8964286
  0.8767857
  0.8589286
  0.8500000
  0.8392857
  0.8785714
  0.8571429
  0.8517857
  0.8517857
  0.8482143
  0.8857143
  0.8660714
  0.8553571
  0.8482143
  0.8500000
  0.8875000
  0.8785714
  0.8750000
  0.8589286
  0.8571429
  0.9000000
  0.8803571
  0.8767857
  0.8696429
  0.8678571
  0.8660714
  0.8446429
  0.8285714
  0.8339286
  0.8357143
  0.8571429
  0.8375000
  0.8410714
  0.8214286
  0.8142857
  0.8767857
  0.8517857
  0.8410714
  0.8339286
  0.8232143
  0.8767857
  0.8714286
  0.8428571
  0.8321429
  0.8285714
  0.8875000
  0.8607143
  0.8571429
  0.8482143
  0.8392857
  0.8642857
  0.8303571
  0.8375000
  0.8250000
  0.8196429
  0.8839286
  0.8625000
  0.8500000
  0.8500000
  0.8339286
  0.8696429
  0.8660714
  0.8589286
  0.8553571
  0.8375000
  0.8750000
  0.8589286
  0.8392857
  0.8410714
  0.8410714
  0.8750000
  0.8696429
  0.8607143
  0.8535714
  0.8482143
  0.8571429
  0.8410714
  0.8285714
  0.8214286
  0.8303571
  0.8607143
  0.8500000
  0.8339286
  0.8303571
  0.8303571
  0.8696429
  0.8357143
  0.8428571
  0.8250000
  0.8232143
  0.8553571
  0.8410714
  0.8339286
  0.8303571
  0.8285714
  0.8678571
  0.8464286
  0.8392857
  0.8303571
  0.8267857
  0.8482143
  0.8357143
  0.8178571
  0.8160714
  0.8107143
  0.8589286
  0.8339286
  0.8321429
  0.8321429
  0.8303571
  0.8660714
  0.8500000
  0.8303571
  0.8428571
  0.8375000
  0.8571429
  0.8321429
  0.8303571
  0.8214286
  0.8232143
  0.8625000
  0.8517857
  0.8446429
  0.8375000
  0.8285714
  0.8482143
  0.8214286
  0.8196429
  0.8089286
  0.8125000
  0.8500000
  0.8267857
  0.8125000
  0.8142857
  0.8053571
  0.8517857
  0.8500000
  0.8428571
  0.8321429
  0.8303571
  0.8428571
  0.8339286
  0.8285714
  0.8410714
  0.8303571
  0.8625000
  0.8357143
  0.8375000
  0.8303571
  0.8339286
  0.8375000
  0.8303571
  0.8107143
  0.8285714
  0.8125000
  0.8482143
  0.8250000
  0.8160714
  0.8160714
  0.8107143
  0.8517857
  0.8357143
  0.8267857
  0.8267857
  0.8267857
  0.8464286
  0.8410714
  0.8267857
  0.8196429
  0.8285714
  0.8607143
  0.8500000
  0.8357143
  0.8392857
  0.8339286
  0.8375000
  0.8232143
  0.8214286
  0.8267857
  0.8250000
  0.8589286
  0.8553571
  0.8339286
  0.8357143
  0.8357143
  0.8446429
  0.8428571
  0.8214286
  0.8267857
  0.8250000
  0.8500000
  0.8464286
  0.8375000
  0.8357143
  0.8321429
  0.8625000
  0.8410714
  0.8392857
  0.8464286
  0.8357143
  0.8160714
  0.8267857
  0.8142857
  0.8196429
  0.8250000
  0.8607143
  0.8535714
  0.8321429
  0.8267857
  0.8214286
  0.8357143
  0.8321429
  0.8357143
  0.8267857
  0.8303571
  0.8500000
  0.8428571
  0.8375000
  0.8375000
  0.8339286
  0.8446429
  0.8500000
  0.8446429
  0.8446429
  0.8375000
  0.8642857
  0.8589286
  0.8517857
  0.8571429
  0.8446429
  0.8732143
  0.8571429
  0.8589286
  0.8589286
  0.8392857
  0.8803571
  0.8589286
  0.8553571
  0.8482143
  0.8482143
  0.8803571
  0.8625000
  0.8553571
  0.8642857
  0.8482143
  0.8910714
  0.8821429
  0.8750000
  0.8642857
  0.8607143
  0.8714286
  0.8428571
  0.8500000
  0.8571429
  0.8482143
  0.8714286
  0.8589286
  0.8464286
  0.8517857
  0.8500000
  0.8910714
  0.8732143
  0.8714286
  0.8571429
  0.8392857
  0.8767857
  0.8767857
  0.8535714
  0.8517857
  0.8392857
  0.8910714
  0.8821429
  0.8696429
  0.8678571
  0.8678571
  0.8553571
  0.8214286
  0.8267857
  0.8232143
  0.8250000
  0.8642857
  0.8535714
  0.8339286
  0.8267857
  0.8160714
  0.8625000
  0.8482143
  0.8375000
  0.8410714
  0.8410714
  0.8571429
  0.8464286
  0.8357143
  0.8357143
  0.8250000
  0.8714286
  0.8625000
  0.8500000
  0.8392857
  0.8303571
  0.8517857
  0.8357143
  0.8428571
  0.8142857
  0.8196429
  0.8625000
  0.8428571
  0.8232143
  0.8232143
  0.8303571
  0.8446429
  0.8392857
  0.8357143
  0.8339286
  0.8392857
  0.8625000
  0.8428571
  0.8357143
  0.8339286
  0.8214286
  0.8589286
  0.8500000
  0.8285714
  0.8232143
  0.8196429
  0.8321429
  0.8285714
  0.8339286
  0.8125000
  0.8250000
  0.8392857
  0.8142857
  0.8125000
  0.8107143
  0.8107143
  0.8428571
  0.8392857
  0.8553571
  0.8339286
  0.8392857
  0.8500000
  0.8464286
  0.8410714
  0.8267857
  0.8339286
  0.8607143
  0.8410714
  0.8321429
  0.8196429
  0.8250000
  0.8339286
  0.8285714
  0.8303571
  0.8303571
  0.8071429
  0.8446429
  0.8375000
  0.8142857
  0.8232143
  0.8178571
  0.8500000
  0.8303571
  0.8214286
  0.8178571
  0.8035714
  0.8535714
  0.8357143
  0.8339286
  0.8303571
  0.8339286
  0.8625000
  0.8535714
  0.8464286
  0.8303571
  0.8250000
  0.8250000
  0.8160714
  0.8107143
  0.8125000
  0.8196429
  0.8428571
  0.8214286
  0.8125000
  0.8142857
  0.8142857
  0.8357143
  0.8285714
  0.8321429
  0.8267857
  0.8214286
  0.8446429
  0.8250000
  0.8250000
  0.8303571
  0.8267857
  0.8392857
  0.8285714
  0.8214286
  0.8232143
  0.8285714
  0.8303571
  0.8053571
  0.8000000
  0.8160714
  0.8196429
  0.8232143
  0.8178571
  0.8125000
  0.8017857
  0.8107143
  0.8321429
  0.8339286
  0.8303571
  0.8303571
  0.8250000
  0.8375000
  0.8339286
  0.8303571
  0.8160714
  0.8160714
  0.8464286
  0.8428571
  0.8303571
  0.8285714
  0.8250000
  0.8107143
  0.8107143
  0.8250000
  0.8178571
  0.8232143
  0.8375000
  0.8339286
  0.8375000
  0.8250000
  0.8142857
  0.8392857
  0.8196429
  0.8214286
  0.8160714
  0.8107143
  0.8375000
  0.8375000
  0.8250000
  0.8321429
  0.8339286
  0.8535714
  0.8392857
  0.8285714
  0.8303571
  0.8250000
  0.8321429
  0.8321429
  0.8125000
  0.8178571
  0.8214286
  0.8392857
  0.8232143
  0.8214286
  0.8250000
  0.8196429
  0.8428571
  0.8267857
  0.8214286
  0.8303571
  0.8303571
  0.8196429
  0.8267857
  0.8142857
  0.8214286
  0.8214286
  0.8571429
  0.8392857
  0.8410714
  0.8339286
  0.8410714

Tuning parameter 'gamma' was held constant at a value of 0
Tuning
 parameter 'min_child_weight' was held constant at a value of 1
ROC was used to select the optimal model using the largest value.
The final values used for the model were nrounds = 50, max_depth = 1, eta
 = 0.3, gamma = 0, colsample_bytree = 0.8, min_child_weight = 1 and subsample
 = 0.625.
# Confusion Matrix
confusionMatrix(predictions, df_test$Risk)
Confusion Matrix and Statistics

          Reference
Prediction bad good
      bad   21   18
      good  39  122
                                          
               Accuracy : 0.715           
                 95% CI : (0.6471, 0.7764)
    No Information Rate : 0.7             
    P-Value [Acc > NIR] : 0.353158        
                                          
                  Kappa : 0.246           
                                          
 Mcnemar's Test P-Value : 0.008071        
                                          
            Sensitivity : 0.3500          
            Specificity : 0.8714          
         Pos Pred Value : 0.5385          
         Neg Pred Value : 0.7578          
             Prevalence : 0.3000          
         Detection Rate : 0.1050          
   Detection Prevalence : 0.1950          
      Balanced Accuracy : 0.6107          
                                          
       'Positive' Class : bad             
                                          
# ROC Curve
pred <- prediction(probabilities[, 2], df_test$Risk)
perf <- performance(pred, "tpr", "fpr")
plot(perf, col = "blue", main = "ROC Curve")
abline(a = 0, b = 1, col = "red", lty = 2)

# AUC
auc <- performance(pred, "auc")
auc_value <- auc@y.values[[1]]
print(paste("AUC:", auc_value))
[1] "AUC: 0.724285714285715"
# Save the best model
saveRDS(best_model, "best_model.rds")