4  Machine learning pipeline

The Standard Machine Learning Pipeline using the Titanic Data set

Before we specialize on any tuning, it is important to understand that machine learning always consists of a pipeline of actions.

The typical machine learning workflow consist of:

Machine Learning pipeline

In the following example, we use tidyverse, a collection of R packages for data science / data manipulation mainly developed by Hadley Wickham.

The dplyr package is part of a framework called tidyverse. Unique features of the tidyverse are the pipe %>% operator and tibble objects.

  • The %>% operator:

    Applying several functions in sequence on an object often results in uncountable/confusing number of round brackets:

    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.1     ✔ 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
    max(mean(range(c(5, 3, 2, 1))))
    [1] 3

    The pipe operator simplifies that by saying “apply the next function on the result of the current function”:

    c(5, 3, 2, 1) %>% range %>% mean %>% max
    [1] 3

    Which is easier to write, read, and to understand!

  • tibble objects are just an extension of data.frames. In the course we will use mostly data.frames, so it is better to transform the tibbles back to data.frames:

    air_grouped = airquality %>% group_by(Month)
    
    class(air_grouped)
    [1] "grouped_df" "tbl_df"     "tbl"        "data.frame"
    air_grouped = as.data.frame(air_grouped)
    class(air_grouped)
    [1] "data.frame"

Another good reference is “R for data science” by Hadley Wickham: .

For this lecture you need the Titanic data set provided by us (via the EcoData package).

You can find it in GRIPS (datasets.RData in the data set and submission section) or at http://rhsbio7.uni-regensburg.de:8500 (VPN for University of Regensburg is required!).

Motivation - We need a model that can predict the survival probability of new passengers.

We have split the data set into training and an outer test/prediction data sets (the test/prediction split has one column less than the train split, as the response for the test/outer split is unknown).

The goal is to build a predictive model that can accurately predict the chances of survival for Titanic passengers!

The dataset:

library(tidyverse)
library(EcoData)
data(titanic_ml)
data = titanic_ml

The response variable:

unique(data$survived)
[1]  1  0 NA

0 = passenger died

1 = passenger survived

NA = we don’t have information about the passenger, at the end, we will make predictions for these passengers!

Important: Preprocessing of the data must be done for the training and testing data together!!

4.1 Data preparation

Load necessary libraries:

library(tidyverse)

Load data set:

library(EcoData)
data(titanic_ml)
data = titanic_ml

Standard summaries:

str(data)
'data.frame':   1309 obs. of  14 variables:
 $ pclass   : int  2 1 3 3 3 3 3 1 3 1 ...
 $ survived : int  1 1 0 0 0 0 0 1 0 1 ...
 $ name     : chr  "Sinkkonen, Miss. Anna" "Woolner, Mr. Hugh" "Sage, Mr. Douglas Bullen" "Palsson, Master. Paul Folke" ...
 $ sex      : Factor w/ 2 levels "female","male": 1 2 2 2 2 2 2 1 1 1 ...
 $ age      : num  30 NA NA 6 30.5 38.5 20 53 NA 42 ...
 $ sibsp    : int  0 0 8 3 0 0 0 0 0 0 ...
 $ parch    : int  0 0 2 1 0 0 0 0 0 0 ...
 $ ticket   : Factor w/ 929 levels "110152","110413",..: 221 123 779 542 589 873 472 823 588 834 ...
 $ fare     : num  13 35.5 69.55 21.07 8.05 ...
 $ cabin    : Factor w/ 187 levels "","A10","A11",..: 1 94 1 1 1 1 1 1 1 1 ...
 $ embarked : Factor w/ 4 levels "","C","Q","S": 4 4 4 4 4 4 4 2 4 2 ...
 $ boat     : Factor w/ 28 levels "","1","10","11",..: 3 28 1 1 1 1 1 19 1 15 ...
 $ body     : int  NA NA NA NA 50 32 NA NA NA NA ...
 $ home.dest: Factor w/ 370 levels "","?Havana, Cuba",..: 121 213 1 1 1 1 322 350 1 1 ...
summary(data)
     pclass         survived          name               sex     
 Min.   :1.000   Min.   :0.0000   Length:1309        female:466  
 1st Qu.:2.000   1st Qu.:0.0000   Class :character   male  :843  
 Median :3.000   Median :0.0000   Mode  :character               
 Mean   :2.295   Mean   :0.3853                                  
 3rd Qu.:3.000   3rd Qu.:1.0000                                  
 Max.   :3.000   Max.   :1.0000                                  
                 NA's   :655                                     
      age              sibsp            parch            ticket    
 Min.   : 0.1667   Min.   :0.0000   Min.   :0.000   CA. 2343:  11  
 1st Qu.:21.0000   1st Qu.:0.0000   1st Qu.:0.000   1601    :   8  
 Median :28.0000   Median :0.0000   Median :0.000   CA 2144 :   8  
 Mean   :29.8811   Mean   :0.4989   Mean   :0.385   3101295 :   7  
 3rd Qu.:39.0000   3rd Qu.:1.0000   3rd Qu.:0.000   347077  :   7  
 Max.   :80.0000   Max.   :8.0000   Max.   :9.000   347082  :   7  
 NA's   :263                                        (Other) :1261  
      fare                     cabin      embarked      boat    
 Min.   :  0.000                  :1014    :  2           :823  
 1st Qu.:  7.896   C23 C25 C27    :   6   C:270    13     : 39  
 Median : 14.454   B57 B59 B63 B66:   5   Q:123    C      : 38  
 Mean   : 33.295   G6             :   5   S:914    15     : 37  
 3rd Qu.: 31.275   B96 B98        :   4            14     : 33  
 Max.   :512.329   C22 C26        :   4            4      : 31  
 NA's   :1         (Other)        : 271            (Other):308  
      body                      home.dest  
 Min.   :  1.0                       :564  
 1st Qu.: 72.0   New York, NY        : 64  
 Median :155.0   London              : 14  
 Mean   :160.8   Montreal, PQ        : 10  
 3rd Qu.:256.0   Cornwall / Akron, OH:  9  
 Max.   :328.0   Paris, France       :  9  
 NA's   :1188    (Other)             :639  

The name variable consists of 1309 unique factors (there are 1309 observations…) and could be now transformed. If you are interested in how to do that, take a look at the following box.

length(unique(data$name))
[1] 1307

However, there is a title in each name. Let’s extract the titles:

  1. We will extract all names and split each name after each comma “,”.
  2. We will split the second split of the name after a point “.” and extract the titles.
first_split = sapply(data$name,
                     function(x) stringr::str_split(x, pattern = ",")[[1]][2])
titles = sapply(first_split,
                function(x) strsplit(x, ".",fixed = TRUE)[[1]][1])

We get 18 unique titles:

table(titles)
titles
         Capt           Col           Don          Dona            Dr 
            1             4             1             1             8 
     Jonkheer          Lady         Major        Master          Miss 
            1             1             2            61           260 
         Mlle           Mme            Mr           Mrs            Ms 
            2             1           757           197             2 
          Rev           Sir  the Countess 
            8             1             1 

A few titles have a very low occurrence rate:

titles = stringr::str_trim((titles))
titles %>%
 fct_count()
# A tibble: 18 × 2
   f                n
   <fct>        <int>
 1 Capt             1
 2 Col              4
 3 Don              1
 4 Dona             1
 5 Dr               8
 6 Jonkheer         1
 7 Lady             1
 8 Major            2
 9 Master          61
10 Miss           260
11 Mlle             2
12 Mme              1
13 Mr             757
14 Mrs            197
15 Ms               2
16 Rev              8
17 Sir              1
18 the Countess     1

We will combine titles with low occurrences into one title, which we can easily do with the forcats package.

titles2 =
  forcats::fct_collapse(titles,
                        officer = c("Capt", "Col", "Major", "Dr", "Rev"),
                        royal = c("Jonkheer", "Don", "Sir",
                                  "the Countess", "Dona", "Lady"),
                        miss = c("Miss", "Mlle"),
                        mrs = c("Mrs", "Mme", "Ms")
                        )

We can count titles again to see the new number of titles:

titles2 %>%  
   fct_count()
# A tibble: 6 × 2
  f           n
  <fct>   <int>
1 officer    23
2 royal       6
3 Master     61
4 miss      262
5 mrs       200
6 Mr        757

Add new title variable to data set:

data =
  data %>%
    mutate(title = titles2)

4.1.1 Imputation

NAs are a common problem in ML and most ML algorithms cannot handle NAs. For example, the age variable has 20% NAs:

summary(data$age)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
 0.1667 21.0000 28.0000 29.8811 39.0000 80.0000     263 
sum(is.na(data$age)) / nrow(data)
[1] 0.2009167

There are few options how to handle NAs:

  • Drop observations with NAs, however, we may lose many observations (not what we want!)

  • Imputation, fill the missing values

We impute (fill) the missing values, for example with the median age. However, age itself might depend on other variables such as sex, class and title. Thus, instead of filling the NAs with the overall median of the passengers, we want to fill the NAs with the median age of these groups so that the associations with the other groups are preserved (or in other words, that the new values are hopefully closer to the unknown true values).

In tidyverse we can “group” the data, i.e. we will nest the observations within categorical variables for which we assume that there may be an association with age (here: group_by after sex, pclass and title). After grouping, all operations (such as our median(age....)) will be done within the specified groups (to get better estimates of these missing NAs).

data =
  data %>%
    select(survived, sex, age, fare, pclass) %>% 
    group_by(sex, pclass) %>%
    mutate(age2 = ifelse(is.na(age), median(age, na.rm = TRUE), age)) %>%
    mutate(fare2 = ifelse(is.na(fare), median(fare, na.rm = TRUE), fare)) %>%
    ungroup()

4.1.2 Preprocessing and Feature Selection

Later (tomorrow), we want to use Keras in our example, but it cannot handle factors and requires the data to be scaled.

Normally, one would do this for all predictors, but as we only show the pipeline here, we have sub-selected a bunch of predictors and do this only for them. We first scale the numeric predictors and change the factors with only two groups/levels into integers (this can be handled by Keras).

data_sub =
  data %>%
    select(survived, sex, age2, fare2, pclass) %>%
    mutate(age2 = scales::rescale(age2, c(0, 1)),
           fare2 = scales::rescale(fare2, c(0, 1))) %>%
    mutate(sex = as.integer(sex) - 1L,
           pclass = as.integer(pclass - 1L))

Factors with more than two levels should be one hot encoded (Make columns for every different factor level and write 1 in the respective column for every taken feature value and 0 else. For example: \(\{red, green, green, blue, red\} \rightarrow \{(0,0,1), (0,1,0), (0,1,0), (1,0,0), (0,0,1)\}\)):

one_title = model.matrix(~0+as.factor(title), data = data)
colnames(one_title) = levels(data$title)

one_sex = model.matrix(~0+as.factor(sex), data = data)
colnames(one_sex) = levels(data$sex)

one_pclass = model.matrix(~0+as.factor(pclass), data = data)
colnames(one_pclass) = paste0("pclass", 1:length(unique(data$pclass)))

And we have to add the dummy encoded variables to the data set:

data = cbind(data.frame(survived= data$survived),
                 one_title, one_sex, age = data$age2,
                 fare = data$fare2, one_pclass)
head(data)

4.2 Modelling

4.2.1 Split data for final predictions

To tune our hyperparameters and evaluate our models, we split the data into the training and testing data. The testing data are the observations where the response is NA:

summary(data_sub$survived)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
 0.0000  0.0000  0.0000  0.3853  1.0000  1.0000     655 

655 observations have NAs in our response variable, these are the observations for which we want to make predictions at the end of our pipeline.

data_new = data_sub[is.na(data_sub$survived),]
data_obs = data_sub[!is.na(data_sub$survived),]

4.2.2 Hyperparameter optimization

We want to tune our hyperparameters (\(\lambda\) and \(\alpha\)). Normally, we should do a nested CV on our training data (data_obs), however, we assume that the test data on the submission server is our outer split, so we can tune our hyperparameters using a n-fold Cross-Validation which serves as our inner CV.

Again, why is it important to tune hyperparameters? Hyperparameters (configuration parameters of our ML algorithms that (mostly) control their complexity) are usually tuned (optimized) in an automatic / systematic way. A common procedure, called random search, is to sample random configuration combinations from the set of hyperparameters and test for each combination the prediction error.

We implement manually a CV to tune the learning rate. We start with a 3xCV and 10x different learning rates:

library(cito)
set.seed(42)
model = dnn(survived~.,
            data = data_obs, 
            loss = "binomial",
            lr = tune(0.001, 0.1),
            tuning = config_tuning(CV = 3, steps = 10)
            )
Starting hyperparameter tuning...
Fitting final model...
model$tuning
# A tibble: 10 × 5
   steps  test train models      lr
   <int> <dbl> <dbl> <lgl>    <dbl>
 1     1  315.     0 NA     0.0394 
 2     2  314.     0 NA     0.0623 
 3     3  329.     0 NA     0.0627 
 4     4  315.     0 NA     0.0804 
 5     5  315.     0 NA     0.0658 
 6     6  316.     0 NA     0.0683 
 7     7  320.     0 NA     0.0417 
 8     8  321.     0 NA     0.0667 
 9     9  355.     0 NA     0.00368
10    10  326.     0 NA     0.0818 

4.3 Predictions and Submission

When we are satisfied with the performance of our model, we will create predictions for the new observations on the submission server. cito directly returns the best model so we do not have to fit the final model.

We submit our predictions to the submission server at http://rhsbio7.uni-regensburg.de:8500.

For the submission it is critical to change the predictions into a data.frame, select the second column (the probability to survive), and save it with the write.csv function:

data_new = data_sub[is.na(data_sub$survived),]
predictions = predict(model, data_new, type = "response")[,1] 
write.csv(data.frame(y = predictions), file = "Max_1.csv")

4.4 Exercises

Question: Hyperparameter tuning dnn - Titanic dataset

Tune architecture

  • Tune training parameters (learning rate, batch size) and regularization

Hints

cito has a feature to automatically tune hyperparameters under Cross Validation!

  • passing tune(...) to a hyperparameter will tell cito to tune this specific hyperparameter
  • the tuning = config_tuning(...) let you specify the cross-validation strategy and the number of hyperparameters that should be tested (steps = number of hyperparameter combinations that should be tried)
  • after tuning, cito will fit automatically a model with the best hyperparameters on the full data and will return this model

Minimal example with the iris dataset:

library(cito)
df = iris
df[,1:4] = scale(df[,1:4])

model_tuned = dnn(Species~., 
                  loss = "softmax",
                  data = iris,
                  lambda = tune(lower = 0.0, upper = 0.2), # you can pass the "tune" function to a hyerparameter
                  tuning = config_tuning(CV = 3, steps = 20L)
                  )

# tuning results
model_tuned$tuning


# model_tuned is now already the best model!
library(EcoData)
library(dplyr)
library(missRanger)
data(titanic_ml)
data = titanic_ml
data = 
  data %>% select(survived, sex, age, fare, pclass)
data[,-1] = missRanger(data[,-1], verbose = 0)

data_sub =
  data %>%
    mutate(age = scales::rescale(age, c(0, 1)),
           fare = scales::rescale(fare, c(0, 1))) %>%
    mutate(sex = as.integer(sex) - 1L,
           pclass = as.integer(pclass - 1L))
data_new = data_sub[is.na(data_sub$survived),] # for which we want to make predictions at the end
data_obs = data_sub[!is.na(data_sub$survived),] # data with known response


model = dnn(survived~., 
          hidden = c(10L, 10L), # change
          activation = c("selu", "selu"), # change
          loss = "binomial", 
          lr = 0.05, #change
          validation = 0.2,
          lambda = 0.001, # change
          alpha = 0.1, # change
          lr_scheduler = config_lr_scheduler("reduce_on_plateau", patience = 10, factor = 0.9),
          data = data_obs, epochs = 40L, verbose = FALSE, plot= TRUE)

# Predictions:

predictions = predict(model, newdata = data_new, type = "response") # change prediction type to response so that cito predicts probabilities

write.csv(data.frame(y = predictions[,1]), file = "Max_titanic_dnn.csv")
Question: Hyperparameter tuning rf
Hyperparameter Explanation
mtry Subset of features randomly selected in each node (from which the algorithm can select the feature that will be used to split the data).
minimum node size Minimal number of observations allowed in a node (before the branching is canceled)
max depth Maximum number of tree depth

Combing back to the titanic dataset from the morning, we want to optimize min node size in our RF using a simple CV.

Prepare the data:

library(EcoData)
library(dplyr)
library(missRanger)
data(titanic_ml)
data = titanic_ml
data = 
  data %>% select(survived, sex, age, fare, pclass)
data[,-1] = missRanger(data[,-1], verbose = 0)

data_sub =
  data %>%
    mutate(age = scales::rescale(age, c(0, 1)),
           fare = scales::rescale(fare, c(0, 1))) %>%
    mutate(sex = as.integer(sex) - 1L,
           pclass = as.integer(pclass - 1L))
data_new = data_sub[is.na(data_sub$survived),] # for which we want to make predictions at the end
data_obs = data_sub[!is.na(data_sub$survived),] # data with known response
data_sub$survived = as.factor(data_sub$survived)
data_obs$survived = as.factor(data_obs$survived)

Hints:

  • adjust the ‘type’ argument in the predict(…) method (the default is to predict classes)
  • when predicting probabilities, the randomForest will return a matrix, a column for each class, we are interested in the probability of surviving (so the second column)

Bonus:

  • tune min node size (and mtry)
  • use more features
library(ranger)
data_obs = data_sub[!is.na(data_sub$survived),] 
set.seed(42)

cv = 3
hyper_minnodesize = ...

tuning_results =
    sapply(1:length(hyper_minnodesize), function(k) {
        auc_inner = NULL
        for(j in 1:cv) {
          inner_split = as.integer(cut(1:nrow(data_obs), breaks = cv))
          train_inner = data_obs[inner_split != j, ]
          test_inner = data_obs[inner_split == j, ]
          
          model = ranger(survived~.,data = train_inner, min.node.size = hyper_minnodesize[k], probability = TRUE)
          predictions = predict(model, test_inner)$predictions[,2]
          
          auc_inner[j]= Metrics::auc(test_inner$survived, predictions)
        }
      return(mean(auc_inner))
    })

results = data.frame(minnodesize = hyper_minnodesize, AUC = tuning_results)

print(results)
library(ranger)
data_obs = data_sub[!is.na(data_sub$survived),] 
set.seed(42)

cv = 3
hyper_minnodesize = sample(300, 20)

tuning_results =
    sapply(1:length(hyper_minnodesize), function(k) {
        auc_inner = NULL
        for(j in 1:cv) {
          inner_split = as.integer(cut(1:nrow(data_obs), breaks = cv))
          train_inner = data_obs[inner_split != j, ]
          test_inner = data_obs[inner_split == j, ]
          model = ranger(survived~.,data = train_inner, min.node.size = hyper_minnodesize[k], probability = TRUE)
          predictions = predict(model, test_inner)$predictions[,2]
          
          auc_inner[j]= Metrics::auc(test_inner$survived, predictions)
        }
      return(mean(auc_inner))
    })

results = data.frame(minnodesize = hyper_minnodesize, AUC = tuning_results)

print(results)
   minnodesize       AUC
1           49 0.8263693
2          153 0.8190603
3           74 0.8198697
4          228 0.8136903
5          146 0.8174991
6          122 0.8187347
7          300 0.8083590
8          128 0.8194997
9           24 0.8303831
10          89 0.8205758
11         165 0.8167958
12         110 0.8195956
13          20 0.8279990
14         291 0.8094130
15         283 0.8102618
16         109 0.8202722
17           5 0.8264255
18         212 0.8118643
19         259 0.8129997
20         292 0.8081752

Make predictions:

model = ranger(survived~.,data = data_obs, min.node.size = results[which.max(results$AUC),1], probability = TRUE)

write.csv(data.frame(y = predict(model, data_new)$predictions[,1]), file = "Max_titanic_rf.csv")
Question: Hyperparameter tuning BRT

Important hyperparameters:

Hyperparameter Explanation
eta learning rate (weighting of the sequential trees)
max depth maximal depth in the trees (small = low complexity, large = high complexity)
subsample subsample ratio of the data (bootstrap ratio)
lambda regularization strength of the individual trees
max tree maximal number of trees in the ensemble

Combing back to the titanic dataset from the morning, we want to optimize max depth and the eta parameter in xgboost.

Prepare the data:

library(EcoData)
library(dplyr)
library(missRanger)
data(titanic_ml)
data = titanic_ml
data = 
  data %>% select(survived, sex, age, fare, pclass)
data[,-1] = missRanger(data[,-1], verbose = 0)

data_sub =
  data %>%
    mutate(age = scales::rescale(age, c(0, 1)),
           fare = scales::rescale(fare, c(0, 1))) %>%
    mutate(sex = as.integer(sex) - 1L,
           pclass = as.integer(pclass - 1L))
data_new = data_sub[is.na(data_sub$survived),] # for which we want to make predictions at the end
data_obs = data_sub[!is.na(data_sub$survived),] # data with known response
library(xgboost)
set.seed(42)
data_obs = data_sub[!is.na(data_sub$survived),] 
cv = 3

outer_split = as.integer(cut(1:nrow(data_obs), breaks = cv))

# sample minnodesize values (must be integers)
hyper_depth = ...
hyper_eta = ...

tuning_results =
    sapply(1:length(hyper_eta), function(k) {
        auc_inner = NULL
        for(j in 1:cv) {
          inner_split = as.integer(cut(1:nrow(data_obs), breaks = cv))
          train_inner = data_obs[inner_split != j, ]
          test_inner = data_obs[inner_split == j, ]
          
          data_xg = xgb.DMatrix(data = as.matrix(train_inner[,-1]), label = train_inner$survived)
          
          model = xgboost(data_xg, nrounds = 16L, eta = hyper_eta[k], max_depth = hyper_depth[k], objective = "reg:logistic")
          predictions = predict(model, newdata = as.matrix(test_inner)[,-1])
          
          auc_inner[j]= Metrics::auc(test_inner$survived, predictions)
        }
      return(mean(auc_inner))
    })

results = data.frame(depth = hyper_depth, eta = hyper_eta, AUC = tuning_results)

print(results)
library(xgboost)

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

    slice
set.seed(42)
data_obs = data_sub[!is.na(data_sub$survived),] 
cv = 3

outer_split = as.integer(cut(1:nrow(data_obs), breaks = cv))

# sample minnodesize values (must be integers)
hyper_depth = sample(200, 20)
hyper_eta = runif(20, 0, 1)


tuning_results =
    sapply(1:length(hyper_eta), function(k) {
        auc_inner = NULL
        for(j in 1:cv) {
          inner_split = as.integer(cut(1:nrow(data_obs), breaks = cv))
          train_inner = data_obs[inner_split != j, ]
          test_inner = data_obs[inner_split == j, ]
          
          data_xg = xgb.DMatrix(data = as.matrix(train_inner[,-1]), label = train_inner$survived)
          
          model = xgboost(data_xg, nrounds = 16L, eta = hyper_eta[k], max_depth = hyper_depth[k], objective = "reg:logistic")
          predictions = predict(model, newdata = as.matrix(test_inner)[,-1])
          
          auc_inner[j]= Metrics::auc(test_inner$survived, predictions)
        }
      return(mean(auc_inner))
    })
[1] train-rmse:0.342302 
[2] train-rmse:0.299191 
[3] train-rmse:0.268716 
[4] train-rmse:0.242803 
[5] train-rmse:0.213241 
[6] train-rmse:0.192588 
[7] train-rmse:0.182530 
[8] train-rmse:0.174108 
[9] train-rmse:0.168385 
[10]    train-rmse:0.163249 
[11]    train-rmse:0.157466 
[12]    train-rmse:0.154353 
[13]    train-rmse:0.150252 
[14]    train-rmse:0.146819 
[15]    train-rmse:0.144884 
[16]    train-rmse:0.140921 
[1] train-rmse:0.355586 
[2] train-rmse:0.303011 
[3] train-rmse:0.279725 
[4] train-rmse:0.259973 
[5] train-rmse:0.244192 
[6] train-rmse:0.227948 
[7] train-rmse:0.213377 
[8] train-rmse:0.203723 
[9] train-rmse:0.195484 
[10]    train-rmse:0.189591 
[11]    train-rmse:0.185054 
[12]    train-rmse:0.180021 
[13]    train-rmse:0.173629 
[14]    train-rmse:0.168810 
[15]    train-rmse:0.164530 
[16]    train-rmse:0.162001 
[1] train-rmse:0.355397 
[2] train-rmse:0.312393 
[3] train-rmse:0.288034 
[4] train-rmse:0.262297 
[5] train-rmse:0.242050 
[6] train-rmse:0.231974 
[7] train-rmse:0.215598 
[8] train-rmse:0.206428 
[9] train-rmse:0.197788 
[10]    train-rmse:0.190170 
[11]    train-rmse:0.183465 
[12]    train-rmse:0.177776 
[13]    train-rmse:0.171649 
[14]    train-rmse:0.165496 
[15]    train-rmse:0.161950 
[16]    train-rmse:0.157418 
[1] train-rmse:0.344811 
[2] train-rmse:0.301841 
[3] train-rmse:0.269651 
[4] train-rmse:0.241837 
[5] train-rmse:0.223290 
[6] train-rmse:0.207494 
[7] train-rmse:0.195355 
[8] train-rmse:0.186628 
[9] train-rmse:0.174448 
[10]    train-rmse:0.168487 
[11]    train-rmse:0.159994 
[12]    train-rmse:0.156250 
[13]    train-rmse:0.151392 
[14]    train-rmse:0.146957 
[15]    train-rmse:0.143999 
[16]    train-rmse:0.141612 
[1] train-rmse:0.357827 
[2] train-rmse:0.304876 
[3] train-rmse:0.276290 
[4] train-rmse:0.257492 
[5] train-rmse:0.242544 
[6] train-rmse:0.229373 
[7] train-rmse:0.216883 
[8] train-rmse:0.207260 
[9] train-rmse:0.198043 
[10]    train-rmse:0.191355 
[11]    train-rmse:0.186312 
[12]    train-rmse:0.180745 
[13]    train-rmse:0.174197 
[14]    train-rmse:0.169893 
[15]    train-rmse:0.165370 
[16]    train-rmse:0.163342 
[1] train-rmse:0.357557 
[2] train-rmse:0.311745 
[3] train-rmse:0.286003 
[4] train-rmse:0.254900 
[5] train-rmse:0.241741 
[6] train-rmse:0.226210 
[7] train-rmse:0.214579 
[8] train-rmse:0.203467 
[9] train-rmse:0.197486 
[10]    train-rmse:0.189492 
[11]    train-rmse:0.183023 
[12]    train-rmse:0.177307 
[13]    train-rmse:0.172381 
[14]    train-rmse:0.167487 
[15]    train-rmse:0.163035 
[16]    train-rmse:0.160142 
[1] train-rmse:0.479481 
[2] train-rmse:0.461296 
[3] train-rmse:0.444457 
[4] train-rmse:0.429080 
[5] train-rmse:0.415456 
[6] train-rmse:0.402267 
[7] train-rmse:0.390538 
[8] train-rmse:0.379364 
[9] train-rmse:0.369656 
[10]    train-rmse:0.360619 
[11]    train-rmse:0.352002 
[12]    train-rmse:0.344516 
[13]    train-rmse:0.337348 
[14]    train-rmse:0.330759 
[15]    train-rmse:0.325420 
[16]    train-rmse:0.320087 
[1] train-rmse:0.480985 
[2] train-rmse:0.463953 
[3] train-rmse:0.447759 
[4] train-rmse:0.432252 
[5] train-rmse:0.418343 
[6] train-rmse:0.405816 
[7] train-rmse:0.394936 
[8] train-rmse:0.385023 
[9] train-rmse:0.376260 
[10]    train-rmse:0.368393 
[11]    train-rmse:0.361204 
[12]    train-rmse:0.353261 
[13]    train-rmse:0.346243 
[14]    train-rmse:0.339924 
[15]    train-rmse:0.334026 
[16]    train-rmse:0.329024 
[1] train-rmse:0.480786 
[2] train-rmse:0.463307 
[3] train-rmse:0.446951 
[4] train-rmse:0.432430 
[5] train-rmse:0.419509 
[6] train-rmse:0.407269 
[7] train-rmse:0.396934 
[8] train-rmse:0.386748 
[9] train-rmse:0.377648 
[10]    train-rmse:0.368996 
[11]    train-rmse:0.361208 
[12]    train-rmse:0.354212 
[13]    train-rmse:0.347979 
[14]    train-rmse:0.342421 
[15]    train-rmse:0.337069 
[16]    train-rmse:0.331923 
[1] train-rmse:0.391331 
[2] train-rmse:0.335947 
[3] train-rmse:0.305201 
[4] train-rmse:0.281717 
[5] train-rmse:0.265914 
[6] train-rmse:0.252585 
[7] train-rmse:0.237463 
[8] train-rmse:0.223741 
[9] train-rmse:0.214639 
[10]    train-rmse:0.207821 
[11]    train-rmse:0.199719 
[12]    train-rmse:0.193863 
[13]    train-rmse:0.186355 
[14]    train-rmse:0.182046 
[15]    train-rmse:0.177708 
[16]    train-rmse:0.173773 
[1] train-rmse:0.399989 
[2] train-rmse:0.347930 
[3] train-rmse:0.314260 
[4] train-rmse:0.293303 
[5] train-rmse:0.276249 
[6] train-rmse:0.264806 
[7] train-rmse:0.253870 
[8] train-rmse:0.244993 
[9] train-rmse:0.237339 
[10]    train-rmse:0.229343 
[11]    train-rmse:0.222446 
[12]    train-rmse:0.216332 
[13]    train-rmse:0.211237 
[14]    train-rmse:0.206756 
[15]    train-rmse:0.203657 
[16]    train-rmse:0.199263 
[1] train-rmse:0.399253 
[2] train-rmse:0.349250 
[3] train-rmse:0.323812 
[4] train-rmse:0.303647 
[5] train-rmse:0.291414 
[6] train-rmse:0.278053 
[7] train-rmse:0.269020 
[8] train-rmse:0.255987 
[9] train-rmse:0.247910 
[10]    train-rmse:0.239493 
[11]    train-rmse:0.229426 
[12]    train-rmse:0.221866 
[13]    train-rmse:0.216462 
[14]    train-rmse:0.211906 
[15]    train-rmse:0.206869 
[16]    train-rmse:0.203552 
[1] train-rmse:0.412613 
[2] train-rmse:0.356528 
[3] train-rmse:0.324341 
[4] train-rmse:0.302757 
[5] train-rmse:0.286213 
[6] train-rmse:0.272936 
[7] train-rmse:0.259950 
[8] train-rmse:0.251537 
[9] train-rmse:0.242169 
[10]    train-rmse:0.235786 
[11]    train-rmse:0.225925 
[12]    train-rmse:0.220411 
[13]    train-rmse:0.214880 
[14]    train-rmse:0.208503 
[15]    train-rmse:0.201849 
[16]    train-rmse:0.198086 
[1] train-rmse:0.419435 
[2] train-rmse:0.369414 
[3] train-rmse:0.334817 
[4] train-rmse:0.313577 
[5] train-rmse:0.296743 
[6] train-rmse:0.284304 
[7] train-rmse:0.273065 
[8] train-rmse:0.264564 
[9] train-rmse:0.252990 
[10]    train-rmse:0.246305 
[11]    train-rmse:0.239789 
[12]    train-rmse:0.233099 
[13]    train-rmse:0.229367 
[14]    train-rmse:0.224895 
[15]    train-rmse:0.220131 
[16]    train-rmse:0.216076 
[1] train-rmse:0.418746 
[2] train-rmse:0.369491 
[3] train-rmse:0.336421 
[4] train-rmse:0.316537 
[5] train-rmse:0.302093 
[6] train-rmse:0.289140 
[7] train-rmse:0.278160 
[8] train-rmse:0.268178 
[9] train-rmse:0.261453 
[10]    train-rmse:0.254947 
[11]    train-rmse:0.249780 
[12]    train-rmse:0.241135 
[13]    train-rmse:0.234711 
[14]    train-rmse:0.227473 
[15]    train-rmse:0.222749 
[16]    train-rmse:0.217501 
[1] train-rmse:0.347540 
[2] train-rmse:0.303745 
[3] train-rmse:0.273687 
[4] train-rmse:0.248077 
[5] train-rmse:0.223700 
[6] train-rmse:0.207197 
[7] train-rmse:0.193925 
[8] train-rmse:0.186242 
[9] train-rmse:0.178182 
[10]    train-rmse:0.173075 
[11]    train-rmse:0.166573 
[12]    train-rmse:0.162239 
[13]    train-rmse:0.158070 
[14]    train-rmse:0.149938 
[15]    train-rmse:0.144231 
[16]    train-rmse:0.142591 
[1] train-rmse:0.360274 
[2] train-rmse:0.309340 
[3] train-rmse:0.279982 
[4] train-rmse:0.257875 
[5] train-rmse:0.242942 
[6] train-rmse:0.224303 
[7] train-rmse:0.212563 
[8] train-rmse:0.206164 
[9] train-rmse:0.199549 
[10]    train-rmse:0.193388 
[11]    train-rmse:0.186543 
[12]    train-rmse:0.182867 
[13]    train-rmse:0.177301 
[14]    train-rmse:0.173397 
[15]    train-rmse:0.169897 
[16]    train-rmse:0.166461 
[1] train-rmse:0.359929 
[2] train-rmse:0.311848 
[3] train-rmse:0.286379 
[4] train-rmse:0.264875 
[5] train-rmse:0.247836 
[6] train-rmse:0.228336 
[7] train-rmse:0.218550 
[8] train-rmse:0.209393 
[9] train-rmse:0.199119 
[10]    train-rmse:0.191081 
[11]    train-rmse:0.183728 
[12]    train-rmse:0.179117 
[13]    train-rmse:0.172885 
[14]    train-rmse:0.168394 
[15]    train-rmse:0.164605 
[16]    train-rmse:0.160796 
[1] train-rmse:0.402424 
[2] train-rmse:0.344908 
[3] train-rmse:0.311936 
[4] train-rmse:0.293220 
[5] train-rmse:0.276182 
[6] train-rmse:0.263648 
[7] train-rmse:0.251038 
[8] train-rmse:0.241413 
[9] train-rmse:0.228978 
[10]    train-rmse:0.220899 
[11]    train-rmse:0.211078 
[12]    train-rmse:0.204254 
[13]    train-rmse:0.199894 
[14]    train-rmse:0.194752 
[15]    train-rmse:0.191196 
[16]    train-rmse:0.186992 
[1] train-rmse:0.410115 
[2] train-rmse:0.358492 
[3] train-rmse:0.326234 
[4] train-rmse:0.301400 
[5] train-rmse:0.286322 
[6] train-rmse:0.273809 
[7] train-rmse:0.262014 
[8] train-rmse:0.253343 
[9] train-rmse:0.245150 
[10]    train-rmse:0.235882 
[11]    train-rmse:0.231059 
[12]    train-rmse:0.224277 
[13]    train-rmse:0.217895 
[14]    train-rmse:0.212065 
[15]    train-rmse:0.208399 
[16]    train-rmse:0.204358 
[1] train-rmse:0.409393 
[2] train-rmse:0.360259 
[3] train-rmse:0.328650 
[4] train-rmse:0.307963 
[5] train-rmse:0.293266 
[6] train-rmse:0.282228 
[7] train-rmse:0.272837 
[8] train-rmse:0.265002 
[9] train-rmse:0.255129 
[10]    train-rmse:0.248240 
[11]    train-rmse:0.241525 
[12]    train-rmse:0.236144 
[13]    train-rmse:0.229078 
[14]    train-rmse:0.223361 
[15]    train-rmse:0.219269 
[16]    train-rmse:0.214754 
[1] train-rmse:0.352912 
[2] train-rmse:0.305237 
[3] train-rmse:0.276568 
[4] train-rmse:0.250577 
[5] train-rmse:0.231958 
[6] train-rmse:0.212720 
[7] train-rmse:0.203744 
[8] train-rmse:0.195451 
[9] train-rmse:0.184679 
[10]    train-rmse:0.175920 
[11]    train-rmse:0.170978 
[12]    train-rmse:0.164906 
[13]    train-rmse:0.161527 
[14]    train-rmse:0.159188 
[15]    train-rmse:0.155948 
[16]    train-rmse:0.151337 
[1] train-rmse:0.365109 
[2] train-rmse:0.309687 
[3] train-rmse:0.280797 
[4] train-rmse:0.261068 
[5] train-rmse:0.241774 
[6] train-rmse:0.227370 
[7] train-rmse:0.215068 
[8] train-rmse:0.207891 
[9] train-rmse:0.200634 
[10]    train-rmse:0.192557 
[11]    train-rmse:0.187296 
[12]    train-rmse:0.181621 
[13]    train-rmse:0.178007 
[14]    train-rmse:0.174441 
[15]    train-rmse:0.170647 
[16]    train-rmse:0.168465 
[1] train-rmse:0.364647 
[2] train-rmse:0.319787 
[3] train-rmse:0.295209 
[4] train-rmse:0.275162 
[5] train-rmse:0.259882 
[6] train-rmse:0.244643 
[7] train-rmse:0.227988 
[8] train-rmse:0.217011 
[9] train-rmse:0.209808 
[10]    train-rmse:0.200657 
[11]    train-rmse:0.194938 
[12]    train-rmse:0.187570 
[13]    train-rmse:0.183875 
[14]    train-rmse:0.179330 
[15]    train-rmse:0.173863 
[16]    train-rmse:0.169534 
[1] train-rmse:0.362176 
[2] train-rmse:0.311901 
[3] train-rmse:0.280702 
[4] train-rmse:0.260316 
[5] train-rmse:0.239976 
[6] train-rmse:0.224227 
[7] train-rmse:0.212696 
[8] train-rmse:0.204659 
[9] train-rmse:0.197053 
[10]    train-rmse:0.186446 
[11]    train-rmse:0.180915 
[12]    train-rmse:0.176416 
[13]    train-rmse:0.171562 
[14]    train-rmse:0.167962 
[15]    train-rmse:0.162565 
[16]    train-rmse:0.158046 
[1] train-rmse:0.373483 
[2] train-rmse:0.323919 
[3] train-rmse:0.297025 
[4] train-rmse:0.271697 
[5] train-rmse:0.258279 
[6] train-rmse:0.245115 
[7] train-rmse:0.232653 
[8] train-rmse:0.222997 
[9] train-rmse:0.214197 
[10]    train-rmse:0.205852 
[11]    train-rmse:0.201917 
[12]    train-rmse:0.194916 
[13]    train-rmse:0.189427 
[14]    train-rmse:0.186183 
[15]    train-rmse:0.182289 
[16]    train-rmse:0.177717 
[1] train-rmse:0.372885 
[2] train-rmse:0.325785 
[3] train-rmse:0.296763 
[4] train-rmse:0.279764 
[5] train-rmse:0.265770 
[6] train-rmse:0.253805 
[7] train-rmse:0.239162 
[8] train-rmse:0.228320 
[9] train-rmse:0.219802 
[10]    train-rmse:0.210701 
[11]    train-rmse:0.203631 
[12]    train-rmse:0.197762 
[13]    train-rmse:0.192693 
[14]    train-rmse:0.186841 
[15]    train-rmse:0.183264 
[16]    train-rmse:0.178558 
[1] train-rmse:0.355068 
[2] train-rmse:0.306965 
[3] train-rmse:0.278270 
[4] train-rmse:0.253591 
[5] train-rmse:0.230023 
[6] train-rmse:0.216835 
[7] train-rmse:0.206119 
[8] train-rmse:0.196151 
[9] train-rmse:0.188044 
[10]    train-rmse:0.182430 
[11]    train-rmse:0.174891 
[12]    train-rmse:0.166900 
[13]    train-rmse:0.164163 
[14]    train-rmse:0.160384 
[15]    train-rmse:0.156842 
[16]    train-rmse:0.154538 
[1] train-rmse:0.367055 
[2] train-rmse:0.312446 
[3] train-rmse:0.282541 
[4] train-rmse:0.263486 
[5] train-rmse:0.247370 
[6] train-rmse:0.229723 
[7] train-rmse:0.222708 
[8] train-rmse:0.212426 
[9] train-rmse:0.203696 
[10]    train-rmse:0.196197 
[11]    train-rmse:0.191197 
[12]    train-rmse:0.185815 
[13]    train-rmse:0.181837 
[14]    train-rmse:0.177194 
[15]    train-rmse:0.174400 
[16]    train-rmse:0.171251 
[1] train-rmse:0.366555 
[2] train-rmse:0.321138 
[3] train-rmse:0.297371 
[4] train-rmse:0.277279 
[5] train-rmse:0.257130 
[6] train-rmse:0.246154 
[7] train-rmse:0.230870 
[8] train-rmse:0.222219 
[9] train-rmse:0.214729 
[10]    train-rmse:0.203458 
[11]    train-rmse:0.195316 
[12]    train-rmse:0.190983 
[13]    train-rmse:0.184888 
[14]    train-rmse:0.177407 
[15]    train-rmse:0.173036 
[16]    train-rmse:0.169503 
[1] train-rmse:0.413003 
[2] train-rmse:0.356993 
[3] train-rmse:0.324332 
[4] train-rmse:0.302632 
[5] train-rmse:0.286470 
[6] train-rmse:0.273611 
[7] train-rmse:0.260870 
[8] train-rmse:0.253180 
[9] train-rmse:0.243336 
[10]    train-rmse:0.236671 
[11]    train-rmse:0.228742 
[12]    train-rmse:0.221460 
[13]    train-rmse:0.214504 
[14]    train-rmse:0.208995 
[15]    train-rmse:0.203657 
[16]    train-rmse:0.198992 
[1] train-rmse:0.419792 
[2] train-rmse:0.369830 
[3] train-rmse:0.335221 
[4] train-rmse:0.313943 
[5] train-rmse:0.297096 
[6] train-rmse:0.285331 
[7] train-rmse:0.274201 
[8] train-rmse:0.265720 
[9] train-rmse:0.257348 
[10]    train-rmse:0.249674 
[11]    train-rmse:0.242869 
[12]    train-rmse:0.237043 
[13]    train-rmse:0.230208 
[14]    train-rmse:0.226608 
[15]    train-rmse:0.223174 
[16]    train-rmse:0.217211 
[1] train-rmse:0.419104 
[2] train-rmse:0.369898 
[3] train-rmse:0.336688 
[4] train-rmse:0.316724 
[5] train-rmse:0.302290 
[6] train-rmse:0.289893 
[7] train-rmse:0.278490 
[8] train-rmse:0.270668 
[9] train-rmse:0.264460 
[10]    train-rmse:0.256828 
[11]    train-rmse:0.251322 
[12]    train-rmse:0.244360 
[13]    train-rmse:0.239434 
[14]    train-rmse:0.232481 
[15]    train-rmse:0.228628 
[16]    train-rmse:0.223731 
[1] train-rmse:0.367975 
[2] train-rmse:0.316612 
[3] train-rmse:0.285462 
[4] train-rmse:0.263922 
[5] train-rmse:0.245271 
[6] train-rmse:0.230708 
[7] train-rmse:0.221704 
[8] train-rmse:0.207412 
[9] train-rmse:0.198099 
[10]    train-rmse:0.191893 
[11]    train-rmse:0.187489 
[12]    train-rmse:0.178444 
[13]    train-rmse:0.173196 
[14]    train-rmse:0.165931 
[15]    train-rmse:0.164044 
[16]    train-rmse:0.160759 
[1] train-rmse:0.378739 
[2] train-rmse:0.319681 
[3] train-rmse:0.293201 
[4] train-rmse:0.270693 
[5] train-rmse:0.256631 
[6] train-rmse:0.240604 
[7] train-rmse:0.232202 
[8] train-rmse:0.224702 
[9] train-rmse:0.214182 
[10]    train-rmse:0.207344 
[11]    train-rmse:0.200937 
[12]    train-rmse:0.196956 
[13]    train-rmse:0.192187 
[14]    train-rmse:0.188495 
[15]    train-rmse:0.184100 
[16]    train-rmse:0.181208 
[1] train-rmse:0.378086 
[2] train-rmse:0.327091 
[3] train-rmse:0.297425 
[4] train-rmse:0.279148 
[5] train-rmse:0.265884 
[6] train-rmse:0.248846 
[7] train-rmse:0.240555 
[8] train-rmse:0.228152 
[9] train-rmse:0.220610 
[10]    train-rmse:0.213126 
[11]    train-rmse:0.204972 
[12]    train-rmse:0.201485 
[13]    train-rmse:0.194622 
[14]    train-rmse:0.188000 
[15]    train-rmse:0.182221 
[16]    train-rmse:0.178003 
[1] train-rmse:0.499000 
[2] train-rmse:0.498010 
[3] train-rmse:0.497026 
[4] train-rmse:0.496047 
[5] train-rmse:0.495073 
[6] train-rmse:0.494104 
[7] train-rmse:0.493140 
[8] train-rmse:0.492181 
[9] train-rmse:0.491226 
[10]    train-rmse:0.490275 
[11]    train-rmse:0.489330 
[12]    train-rmse:0.488389 
[13]    train-rmse:0.487453 
[14]    train-rmse:0.486522 
[15]    train-rmse:0.485596 
[16]    train-rmse:0.484675 
[1] train-rmse:0.499072 
[2] train-rmse:0.498161 
[3] train-rmse:0.497256 
[4] train-rmse:0.496356 
[5] train-rmse:0.495460 
[6] train-rmse:0.494569 
[7] train-rmse:0.493684 
[8] train-rmse:0.492802 
[9] train-rmse:0.491926 
[10]    train-rmse:0.491055 
[11]    train-rmse:0.490188 
[12]    train-rmse:0.489326 
[13]    train-rmse:0.488468 
[14]    train-rmse:0.487616 
[15]    train-rmse:0.486768 
[16]    train-rmse:0.485924 
[1] train-rmse:0.499062 
[2] train-rmse:0.498143 
[3] train-rmse:0.497230 
[4] train-rmse:0.496317 
[5] train-rmse:0.495408 
[6] train-rmse:0.494476 
[7] train-rmse:0.493582 
[8] train-rmse:0.492622 
[9] train-rmse:0.491667 
[10]    train-rmse:0.490716 
[11]    train-rmse:0.489771 
[12]    train-rmse:0.488830 
[13]    train-rmse:0.487895 
[14]    train-rmse:0.486964 
[15]    train-rmse:0.486038 
[16]    train-rmse:0.485116 
[1] train-rmse:0.353172 
[2] train-rmse:0.305445 
[3] train-rmse:0.276743 
[4] train-rmse:0.250790 
[5] train-rmse:0.232189 
[6] train-rmse:0.212974 
[7] train-rmse:0.204002 
[8] train-rmse:0.195040 
[9] train-rmse:0.183821 
[10]    train-rmse:0.175506 
[11]    train-rmse:0.172033 
[12]    train-rmse:0.165681 
[13]    train-rmse:0.159818 
[14]    train-rmse:0.156798 
[15]    train-rmse:0.153866 
[16]    train-rmse:0.150766 
[1] train-rmse:0.365344 
[2] train-rmse:0.309894 
[3] train-rmse:0.281018 
[4] train-rmse:0.261295 
[5] train-rmse:0.242028 
[6] train-rmse:0.227639 
[7] train-rmse:0.215355 
[8] train-rmse:0.208188 
[9] train-rmse:0.200927 
[10]    train-rmse:0.192864 
[11]    train-rmse:0.187600 
[12]    train-rmse:0.181933 
[13]    train-rmse:0.178311 
[14]    train-rmse:0.174738 
[15]    train-rmse:0.170801 
[16]    train-rmse:0.168272 
[1] train-rmse:0.364877 
[2] train-rmse:0.319963 
[3] train-rmse:0.295365 
[4] train-rmse:0.275363 
[5] train-rmse:0.260114 
[6] train-rmse:0.244910 
[7] train-rmse:0.228209 
[8] train-rmse:0.215883 
[9] train-rmse:0.209065 
[10]    train-rmse:0.201187 
[11]    train-rmse:0.192461 
[12]    train-rmse:0.185839 
[13]    train-rmse:0.178898 
[14]    train-rmse:0.173226 
[15]    train-rmse:0.167694 
[16]    train-rmse:0.163567 
[1] train-rmse:0.498143 
[2] train-rmse:0.496315 
[3] train-rmse:0.494504 
[4] train-rmse:0.492711 
[5] train-rmse:0.490936 
[6] train-rmse:0.489174 
[7] train-rmse:0.487429 
[8] train-rmse:0.485702 
[9] train-rmse:0.483991 
[10]    train-rmse:0.482297 
[11]    train-rmse:0.480619 
[12]    train-rmse:0.478958 
[13]    train-rmse:0.477314 
[14]    train-rmse:0.475685 
[15]    train-rmse:0.474073 
[16]    train-rmse:0.472476 
[1] train-rmse:0.498277 
[2] train-rmse:0.496595 
[3] train-rmse:0.494930 
[4] train-rmse:0.493283 
[5] train-rmse:0.491651 
[6] train-rmse:0.490036 
[7] train-rmse:0.488438 
[8] train-rmse:0.486855 
[9] train-rmse:0.485289 
[10]    train-rmse:0.483737 
[11]    train-rmse:0.482203 
[12]    train-rmse:0.480684 
[13]    train-rmse:0.479142 
[14]    train-rmse:0.477613 
[15]    train-rmse:0.476101 
[16]    train-rmse:0.474643 
[1] train-rmse:0.498258 
[2] train-rmse:0.496562 
[3] train-rmse:0.494873 
[4] train-rmse:0.493133 
[5] train-rmse:0.491486 
[6] train-rmse:0.489723 
[7] train-rmse:0.487977 
[8] train-rmse:0.486248 
[9] train-rmse:0.484536 
[10]    train-rmse:0.482840 
[11]    train-rmse:0.481160 
[12]    train-rmse:0.479496 
[13]    train-rmse:0.477849 
[14]    train-rmse:0.476217 
[15]    train-rmse:0.474602 
[16]    train-rmse:0.473010 
[1] train-rmse:0.450145 
[2] train-rmse:0.412699 
[3] train-rmse:0.382944 
[4] train-rmse:0.359949 
[5] train-rmse:0.341843 
[6] train-rmse:0.326485 
[7] train-rmse:0.314051 
[8] train-rmse:0.302660 
[9] train-rmse:0.292461 
[10]    train-rmse:0.284359 
[11]    train-rmse:0.277805 
[12]    train-rmse:0.271235 
[13]    train-rmse:0.265533 
[14]    train-rmse:0.260534 
[15]    train-rmse:0.255269 
[16]    train-rmse:0.250541 
[1] train-rmse:0.453901 
[2] train-rmse:0.420021 
[3] train-rmse:0.389930 
[4] train-rmse:0.367231 
[5] train-rmse:0.346715 
[6] train-rmse:0.331994 
[7] train-rmse:0.320548 
[8] train-rmse:0.311274 
[9] train-rmse:0.300817 
[10]    train-rmse:0.292880 
[11]    train-rmse:0.285697 
[12]    train-rmse:0.279500 
[13]    train-rmse:0.273323 
[14]    train-rmse:0.268322 
[15]    train-rmse:0.263914 
[16]    train-rmse:0.259803 
[1] train-rmse:0.453446 
[2] train-rmse:0.418830 
[3] train-rmse:0.391201 
[4] train-rmse:0.368218 
[5] train-rmse:0.351641 
[6] train-rmse:0.336232 
[7] train-rmse:0.323923 
[8] train-rmse:0.315101 
[9] train-rmse:0.306496 
[10]    train-rmse:0.300159 
[11]    train-rmse:0.294056 
[12]    train-rmse:0.288296 
[13]    train-rmse:0.284111 
[14]    train-rmse:0.278262 
[15]    train-rmse:0.273759 
[16]    train-rmse:0.268695 
[1] train-rmse:0.347479 
[2] train-rmse:0.303696 
[3] train-rmse:0.273634 
[4] train-rmse:0.248019 
[5] train-rmse:0.223632 
[6] train-rmse:0.207121 
[7] train-rmse:0.193844 
[8] train-rmse:0.186157 
[9] train-rmse:0.178096 
[10]    train-rmse:0.172990 
[11]    train-rmse:0.166492 
[12]    train-rmse:0.162156 
[13]    train-rmse:0.157989 
[14]    train-rmse:0.149858 
[15]    train-rmse:0.144153 
[16]    train-rmse:0.142515 
[1] train-rmse:0.360220 
[2] train-rmse:0.309292 
[3] train-rmse:0.279935 
[4] train-rmse:0.257812 
[5] train-rmse:0.242870 
[6] train-rmse:0.224231 
[7] train-rmse:0.212490 
[8] train-rmse:0.206091 
[9] train-rmse:0.199476 
[10]    train-rmse:0.193314 
[11]    train-rmse:0.186470 
[12]    train-rmse:0.182794 
[13]    train-rmse:0.177225 
[14]    train-rmse:0.173323 
[15]    train-rmse:0.169823 
[16]    train-rmse:0.166387 
[1] train-rmse:0.359876 
[2] train-rmse:0.311802 
[3] train-rmse:0.286337 
[4] train-rmse:0.264818 
[5] train-rmse:0.247766 
[6] train-rmse:0.228261 
[7] train-rmse:0.218473 
[8] train-rmse:0.209313 
[9] train-rmse:0.199035 
[10]    train-rmse:0.190997 
[11]    train-rmse:0.183643 
[12]    train-rmse:0.179042 
[13]    train-rmse:0.172667 
[14]    train-rmse:0.169350 
[15]    train-rmse:0.164097 
[16]    train-rmse:0.159964 
[1] train-rmse:0.377154 
[2] train-rmse:0.322996 
[3] train-rmse:0.288625 
[4] train-rmse:0.268110 
[5] train-rmse:0.249516 
[6] train-rmse:0.239117 
[7] train-rmse:0.224216 
[8] train-rmse:0.216819 
[9] train-rmse:0.204899 
[10]    train-rmse:0.199450 
[11]    train-rmse:0.192756 
[12]    train-rmse:0.186917 
[13]    train-rmse:0.178957 
[14]    train-rmse:0.175691 
[15]    train-rmse:0.171456 
[16]    train-rmse:0.163826 
[1] train-rmse:0.387078 
[2] train-rmse:0.328616 
[3] train-rmse:0.299080 
[4] train-rmse:0.282273 
[5] train-rmse:0.266443 
[6] train-rmse:0.254206 
[7] train-rmse:0.241954 
[8] train-rmse:0.230499 
[9] train-rmse:0.225849 
[10]    train-rmse:0.220852 
[11]    train-rmse:0.215028 
[12]    train-rmse:0.207753 
[13]    train-rmse:0.202053 
[14]    train-rmse:0.198234 
[15]    train-rmse:0.193598 
[16]    train-rmse:0.190045 
[1] train-rmse:0.386369 
[2] train-rmse:0.335963 
[3] train-rmse:0.313351 
[4] train-rmse:0.293987 
[5] train-rmse:0.278649 
[6] train-rmse:0.265678 
[7] train-rmse:0.255343 
[8] train-rmse:0.247244 
[9] train-rmse:0.232596 
[10]    train-rmse:0.225452 
[11]    train-rmse:0.218798 
[12]    train-rmse:0.210346 
[13]    train-rmse:0.204773 
[14]    train-rmse:0.197562 
[15]    train-rmse:0.192926 
[16]    train-rmse:0.188129 
[1] train-rmse:0.414606 
[2] train-rmse:0.358917 
[3] train-rmse:0.326077 
[4] train-rmse:0.303940 
[5] train-rmse:0.287606 
[6] train-rmse:0.274322 
[7] train-rmse:0.263745 
[8] train-rmse:0.254184 
[9] train-rmse:0.244747 
[10]    train-rmse:0.237209 
[11]    train-rmse:0.230712 
[12]    train-rmse:0.224574 
[13]    train-rmse:0.216699 
[14]    train-rmse:0.209627 
[15]    train-rmse:0.204999 
[16]    train-rmse:0.199288 
[1] train-rmse:0.421260 
[2] train-rmse:0.371556 
[3] train-rmse:0.337535 
[4] train-rmse:0.315164 
[5] train-rmse:0.297948 
[6] train-rmse:0.286094 
[7] train-rmse:0.273805 
[8] train-rmse:0.266394 
[9] train-rmse:0.259330 
[10]    train-rmse:0.249049 
[11]    train-rmse:0.242956 
[12]    train-rmse:0.236996 
[13]    train-rmse:0.233201 
[14]    train-rmse:0.229789 
[15]    train-rmse:0.224309 
[16]    train-rmse:0.220606 
[1] train-rmse:0.420579 
[2] train-rmse:0.371585 
[3] train-rmse:0.338361 
[4] train-rmse:0.318275 
[5] train-rmse:0.303723 
[6] train-rmse:0.291123 
[7] train-rmse:0.279848 
[8] train-rmse:0.272339 
[9] train-rmse:0.264819 
[10]    train-rmse:0.258476 
[11]    train-rmse:0.253214 
[12]    train-rmse:0.245536 
[13]    train-rmse:0.239850 
[14]    train-rmse:0.235902 
[15]    train-rmse:0.229998 
[16]    train-rmse:0.226427 
[1] train-rmse:0.404374 
[2] train-rmse:0.347051 
[3] train-rmse:0.313732 
[4] train-rmse:0.294703 
[5] train-rmse:0.276964 
[6] train-rmse:0.263043 
[7] train-rmse:0.251020 
[8] train-rmse:0.242893 
[9] train-rmse:0.234263 
[10]    train-rmse:0.226243 
[11]    train-rmse:0.217929 
[12]    train-rmse:0.211913 
[13]    train-rmse:0.204746 
[14]    train-rmse:0.199364 
[15]    train-rmse:0.194590 
[16]    train-rmse:0.189230 
[1] train-rmse:0.411898 
[2] train-rmse:0.360447 
[3] train-rmse:0.328007 
[4] train-rmse:0.302999 
[5] train-rmse:0.286952 
[6] train-rmse:0.274726 
[7] train-rmse:0.262966 
[8] train-rmse:0.255573 
[9] train-rmse:0.248647 
[10]    train-rmse:0.242319 
[11]    train-rmse:0.235167 
[12]    train-rmse:0.228224 
[13]    train-rmse:0.223082 
[14]    train-rmse:0.219313 
[15]    train-rmse:0.215510 
[16]    train-rmse:0.210092 
[1] train-rmse:0.411181 
[2] train-rmse:0.362094 
[3] train-rmse:0.330702 
[4] train-rmse:0.309895 
[5] train-rmse:0.297513 
[6] train-rmse:0.286619 
[7] train-rmse:0.274702 
[8] train-rmse:0.266107 
[9] train-rmse:0.256906 
[10]    train-rmse:0.249981 
[11]    train-rmse:0.240635 
[12]    train-rmse:0.232569 
[13]    train-rmse:0.227588 
[14]    train-rmse:0.221208 
[15]    train-rmse:0.215105 
[16]    train-rmse:0.210351 
results = data.frame(depth = hyper_depth, eta = hyper_eta, AUC = tuning_results)

print(results)
   depth         eta       AUC
1     49 0.988891729 0.8042100
2     65 0.946668233 0.7959009
3    153 0.082437558 0.8104643
4     74 0.514211784 0.8083882
5    146 0.390203467 0.8134649
6    122 0.905738131 0.7986125
7    200 0.446969628 0.8107391
8    128 0.836004260 0.8063349
9     47 0.737595618 0.8053308
10    24 0.811055141 0.8078353
11    71 0.388108283 0.8091617
12   100 0.685169729 0.8074317
13    89 0.003948339 0.7979312
14   165 0.832916080 0.8050775
15   110 0.007334147 0.7999174
16    20 0.207658973 0.8208386
17   154 0.906601408 0.7997587
18   114 0.611778643 0.8133862
19   111 0.379559241 0.8097394
20   131 0.435771585 0.8082372

Make predictions:

data_xg = xgb.DMatrix(data = as.matrix(data_obs[,-1]), label = data_obs$survived)

model = xgboost(data_xg, nrounds = 16L, eta = results[which.max(results$AUC), 2], max_depth = results[which.max(results$AUC), 1], objective = "reg:logistic")

predictions = predict(model, newdata = as.matrix(data_new)[,-1])

# Single predictions from the ensemble model:
write.csv(data.frame(y = predictions), file = "Max_titanic_xgboost.csv")