The lares package has multiple families of functions to help the analyst or data scientist achieve quality robust analysis without the need of much coding. One of the most complex but valuable functions we have is h2o_automl, which semi-automatically runs the whole pipeline of a Machine Learning model given a dataset and some customizable parameters. AutoML enables you to train high-quality models specific to your needs and accelerate the research and development process.

HELP: Before getting to the code, I recommend checking h2o_automl’s full documentation here or within your R session by running ?lares::h2o_automl. In it you’ll find a brief description of all the parameters you can set into the function to get exactly what you need and control how it behaves.

Pipeline

In short, these are some of the things that happen on its backend:

Mapping h2o_automl

  1. Input a dataframe df and choose which one is the independent variable (y) you’d like to predict. You may set/change the seed argument to guarantee reproducibility of your results.

  2. The function decides if it’s a classification (categorical) or regression (continuous) model looking at the independent variable’s (y) class and number of unique values, which can be control with the thresh parameter.

  3. The dataframe will be split in two: test and train datasets. The proportion of this split can be control with the split argument. This can be replicated with the msplit() function.

  4. You could also center and scale your numerical values before you continue, use the no_outliers to exclude some outliers, and/or impute missing values with MICE. If it’s a classification model, the function can balance (under-sample) your training data. You can control this behavior with the balance argument. Until here, you can replicate the whole process with the model_preprocess() function.

  5. Runs h2o::h2o.automl(...) to train multiple models and generate a leaderboard with the top (max_models or max_time) models trained, sorted by their performance. You can also customize some additional arguments such as nfolds for k-fold cross-validations, exclude_algos and include_algos to exclude or include some algorithms, and any other additional argument you wish to pass to the mother function.

  6. The best model given the default performance metric (which can be changed with stopping_metric parameter) evaluated with cross-validation (customize it with nfolds), will be selected to continue. You can also use the function h2o_selectmodel() to select another model and recalculate/plot everything again using this alternate model.

  7. Performance metrics and plots will be calculated and rendered given the test predictions and test actual values (which were NOT passed to the models as inputs to be trained with). That way, your model’s performance metrics shouldn’t be biased. You can replicate these calculations with the model_metrics() function.

  8. A list with all the inputs, leaderboard results, best selected model, performance metrics, and plots. You can either (play) see the results on console or export them using the export_results() function.

Load the library

Now, let’s (install and) load the library, the data, and dig in:

# install.packages("lares")
library(lares)

# The data we'll use is the Titanic dataset
data(dft)
df <- subset(dft, select = -c(Ticket, PassengerId, Cabin))

NOTE: I’ll randomly set some parameters on each example to give visibility on some of the arguments you can set to your models. Be sure to also check all the print, warnings, and messages shown throughout the process as they may have relevant information regarding your inputs and the backend operations.

Modeling examples

Let’s have a look at three specific examples: classification models (binary and multiple categories) and a regression model. Also, let’s see how we can export our models and put them to work on any environment.

Classification: Binary

Let’s begin with a binary (TRUE/FALSE) model to predict if each passenger Survived:

r <- h2o_automl(df, y = Survived, max_models = 1, impute = FALSE, target = "TRUE")
#> 2022-01-27 15:59:43 | Started process...
#> - INDEPENDENT VARIABLE: Survived
#> - MODEL TYPE: Classification
#> 
[38;5;246m# A tibble: 2 × 5
[39m
#>   tag       n     p order  pcum
#>   
[3m
[38;5;246m<lgl>
[39m
[23m 
[3m
[38;5;246m<int>
[39m
[23m 
[3m
[38;5;246m<dbl>
[39m
[23m 
[3m
[38;5;246m<int>
[39m
[23m 
[3m
[38;5;246m<dbl>
[39m
[23m
#> 
[38;5;250m1
[39m FALSE   549  61.6     1  61.6
#> 
[38;5;250m2
[39m TRUE    342  38.4     2 100
#> - MISSINGS: The following variables contain missing observations: Age (19.87%). Consider using the impute parameter.
#> - CATEGORICALS: There are 3 non-numerical features. Consider using ohse() or equivalent prior to encode categorical variables.
#> >>> Splitting data: train = 0.7 & test = 0.3
#> train_size  test_size 
#>        623        268
#> - REPEATED: There were 67 repeated rows which are being suppressed from the train dataset
#> - ALGORITHMS: excluded 'StackedEnsemble', 'DeepLearning'
#> - CACHE: Previous models are not being erased. You may use 'start_clean' [clear] or 'project_name' [join]
#> - UI: You may check results using H2O Flow's interactive platform: http://localhost:54321/flow/index.html
#> >>> Iterating until 1 models or 600 seconds...
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
#> 15:59:44.262: Project: AutoML_5_20220127_155944
#> 15:59:44.262: Setting stopping tolerance adaptively based on the training frame: 0.0400641540107502
#> 15:59:44.262: Build control seed: 0
#> 15:59:44.262: training frame: Frame key: AutoML_5_20220127_155944_training_train_sid_9cd1_1    cols: 8    rows: 623  chunks: 1    size: 9400  checksum: -7585673325397931124
#> 15:59:44.262: validation frame: NULL
#> 15:59:44.262: leaderboard frame: NULL
#> 15:59:44.262: blending frame: NULL
#> 15:59:44.262: response column: tag
#> 15:59:44.262: fold column: null
#> 15:59:44.262: weights column: null
#> 15:59:44.263: Loading execution steps: [{XGBoost : [def_2 (1g, 10w), def_1 (2g, 10w), def_3 (3g, 10w), grid_1 (4g, 90w), lr_search (6g, 30w)]}, {GLM : [def_1 (1g, 10w)]}, {DRF : [def_1 (2g, 10w), XRT (3g, 10w)]}, {GBM : [def_5 (1g, 10w), def_2 (2g, 10w), def_3 (2g, 10w), def_4 (2g, 10w), def_1 (3g, 10w), grid_1 (4g, 60w), lr_annealing (6g, 10w)]}, {DeepLearning : [def_1 (3g, 10w), grid_1 (4g, 30w), grid_2 (5g, 30w), grid_3 (5g, 30w)]}, {completion : [resume_best_grids (10g, 60w)]}, {StackedEnsemble : [best_of_family_1 (1g, 5w), best_of_family_2 (2g, 5w), best_of_family_3 (3g, 5w), best_of_family_4 (4g, 5w), best_of_family_5 (5g, 5w), all_2 (2g, 10w), all_3 (3g, 10w), all_4 (4g, 10w), all_5 (5g, 10w), monotonic (6g, 10w), best_of_family_xgboost (6g, 10w), best_of_family_gbm (6g, 10w), all_xgboost (7g, 10w), all_gbm (7g, 10w), best_of_family_xglm (8g, 10w), all_xglm (8g, 10w), best_of_family (10g, 10w), best_N (10g, 10w)]}]
#> 15:59:44.264: Disabling Algo: StackedEnsemble as requested by the user.
#> 15:59:44.264: Disabling Algo: DeepLearning as requested by the user.
#> 15:59:44.264: Defined work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}]
#> 15:59:44.264: Actual work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}]
#> 15:59:44.264: AutoML job created: 2022.01.27 15:59:44.261
#> 15:59:44.274: AutoML build started: 2022.01.27 15:59:44.274
#> 15:59:44.275: Time assigned for XGBoost_1_AutoML_5_20220127_155944: 199.999671875s
#> 15:59:44.275: AutoML: starting XGBoost_1_AutoML_5_20220127_155944 model training
#> 15:59:44.305: XGBoost_1_AutoML_5_20220127_155944 [XGBoost def_2] started
#> 15:59:46.350: XGBoost_1_AutoML_5_20220127_155944 [XGBoost def_2] complete
#> 15:59:46.350: Adding model XGBoost_1_AutoML_5_20220127_155944 to leaderboard Leaderboard_AutoML_5_20220127_155944@@tag. Training time: model=0s, total=1s
#> 15:59:46.351: New leader: XGBoost_1_AutoML_5_20220127_155944, auc: 0.8457204301075268
#> 15:59:46.352: AutoML: hit the max_models limit; skipping GLM def_1
#> 15:59:46.352: AutoML: hit the max_models limit; skipping GBM def_5
#> 15:59:46.352: Skipping StackedEnsemble 'best_of_family_1' due to the exclude_algos option or it is already trained.
#> 15:59:46.352: AutoML: hit the max_models limit; skipping XGBoost def_1
#> 15:59:46.352: AutoML: hit the max_models limit; skipping DRF def_1
#> 15:59:46.352: AutoML: hit the max_models limit; skipping GBM def_2
#> 15:59:46.352: AutoML: hit the max_models limit; skipping GBM def_3
#> 15:59:46.352: AutoML: hit the max_models limit; skipping GBM def_4
#> 15:59:46.352: Skipping StackedEnsemble 'best_of_family_2' due to the exclude_algos option or it is already trained.
#> 15:59:46.353: Skipping StackedEnsemble 'all_2' due to the exclude_algos option or it is already trained.
#> 15:59:46.353: AutoML: hit the max_models limit; skipping XGBoost def_3
#> 15:59:46.353: AutoML: hit the max_models limit; skipping DRF XRT (Extremely Randomized Trees)
#> 15:59:46.353: AutoML: hit the max_models limit; skipping GBM def_1
#> 15:59:46.353: AutoML: hit the max_models limit; skipping DeepLearning def_1
#> 15:59:46.353: Skipping StackedEnsemble 'best_of_family_3' due to the exclude_algos option or it is already trained.
#> 15:59:46.353: Skipping StackedEnsemble 'all_3' due to the exclude_algos option or it is already trained.
#> 15:59:46.353: AutoML: hit the max_models limit; skipping XGBoost grid_1
#> 15:59:46.353: AutoML: hit the max_models limit; skipping GBM grid_1
#> 15:59:46.353: AutoML: hit the max_models limit; skipping DeepLearning grid_1
#> 15:59:46.353: Skipping StackedEnsemble 'best_of_family_4' due to the exclude_algos option or it is already trained.
#> 15:59:46.354: Skipping StackedEnsemble 'all_4' due to the exclude_algos option or it is already trained.
#> 15:59:46.354: AutoML: hit the max_models limit; skipping DeepLearning grid_2
#> 15:59:46.354: AutoML: hit the max_models limit; skipping DeepLearning grid_3
#> 15:59:46.354: Skipping StackedEnsemble 'best_of_family_5' due to the exclude_algos option or it is already trained.
#> 15:59:46.354: Skipping StackedEnsemble 'all_5' due to the exclude_algos option or it is already trained.
#> 15:59:46.354: AutoML: hit the max_models limit; skipping XGBoost lr_search
#> 15:59:46.354: AutoML: hit the max_models limit; skipping GBM lr_annealing
#> 15:59:46.355: Skipping StackedEnsemble 'monotonic' due to the exclude_algos option or it is already trained.
#> 15:59:46.355: Skipping StackedEnsemble 'best_of_family_xgboost' due to the exclude_algos option or it is already trained.
#> 15:59:46.355: Skipping StackedEnsemble 'best_of_family_gbm' due to the exclude_algos option or it is already trained.
#> 15:59:46.355: Skipping StackedEnsemble 'all_xgboost' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: Skipping StackedEnsemble 'all_gbm' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: Skipping StackedEnsemble 'best_of_family_xglm' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: Skipping StackedEnsemble 'all_xglm' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: AutoML: hit the max_models limit; skipping completion resume_best_grids
#> 15:59:46.356: Skipping StackedEnsemble 'best_of_family' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: Skipping StackedEnsemble 'best_N' due to the exclude_algos option or it is already trained.
#> 15:59:46.356: Actual modeling steps: [{XGBoost : [def_2 (1g, 10w)]}]
#> 15:59:46.357: AutoML build stopped: 2022.01.27 15:59:46.356
#> 15:59:46.357: AutoML build done: built 1 models
#> 15:59:46.357: AutoML duration:  2.082 sec
#> 15:59:46.362: Verifying training frame immutability. . .
#> 15:59:46.362: Training frame was not mutated (as expected).
#> - EUREKA: Succesfully generated 1 models
#>                             model_id       auc   logloss     aucpr
#> 1 XGBoost_1_AutoML_5_20220127_155944 0.8457204 0.4524606 0.8371959
#>   mean_per_class_error      rmse       mse
#> 1            0.2150161 0.3782772 0.1430936
#> SELECTED MODEL: XGBoost_1_AutoML_5_20220127_155944
#> - NOTE: The following variables were the least important: Embarked.S, Parch, SibSp, Pclass.2
#> >>> Running predictions for Survived...
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> Target value: TRUE
#> >>> Generating plots...
#> Model (1/1): XGBoost_1_AutoML_5_20220127_155944
#> Independent Variable: Survived
#> Type: Classification (2 classes)
#> Algorithm: XGBOOST
#> Split: 70% training data (of 891 observations)
#> Seed: 0
#> 
#> Test metrics:
#>    AUC = 0.85941
#>    ACC = 0.20522
#>    PRC = 0.17838
#>    TPR = 0.35106
#>    TNR = 0.12644
#> 
#> Most important variables:
#>    Sex.female (37.5%)
#>    Pclass.3 (18.4%)
#>    Fare (14.8%)
#>    Age (14.7%)
#>    Sex.male (6.4%)
#> Process duration: 12.6s

Let’s take a look at the plots generated into a single dashboard:

plot(r)

We also have several calculations for our model’s performance that may come useful such as a confusion matrix, gain and lift by percentile, area under the curve (AUC), accuracy (ACC), recall or true positive rate (TPR), cross-validation metrics, exact thresholds to maximize each metric, and others:

r$metrics
#> $dictionary
#> [1] "AUC: Area Under the Curve"                                                             
#> [2] "ACC: Accuracy"                                                                         
#> [3] "PRC: Precision = Positive Predictive Value"                                            
#> [4] "TPR: Sensitivity = Recall = Hit rate = True Positive Rate"                             
#> [5] "TNR: Specificity = Selectivity = True Negative Rate"                                   
#> [6] "Logloss (Error): Logarithmic loss [Neutral classification: 0.69315]"                   
#> [7] "Gain: When best n deciles selected, what % of the real target observations are picked?"
#> [8] "Lift: When best n deciles selected, how much better than random is?"                   
#> 
#> $confusion_matrix
#>        Pred
#> Real    FALSE TRUE
#>   FALSE    22  152
#>   TRUE     61   33
#> 
#> $gain_lift
#> # A tibble: 10 × 10
#>    percentile value random target total  gain optimal   lift response score
#>    <fct>      <chr>  <dbl>  <int> <int> <dbl>   <dbl>  <dbl>    <dbl> <dbl>
#>  1 1          TRUE    10.1     25    27  26.6    28.7 164.      26.6  91.1 
#>  2 2          TRUE    20.1     21    27  48.9    57.4 143.      22.3  66.5 
#>  3 3          TRUE    30.2     15    27  64.9    86.2 115.      16.0  51.0 
#>  4 4          TRUE    39.9     14    26  79.8   100    99.8     14.9  38.6 
#>  5 5          TRUE    50        7    27  87.2   100    74.5      7.45 31.5 
#>  6 6          TRUE    60.1      3    27  90.4   100    50.5      3.19 19.0 
#>  7 7          TRUE    69.8      2    26  92.6   100    32.6      2.13 14.4 
#>  8 8          TRUE    79.9      2    27  94.7   100    18.6      2.13 10.8 
#>  9 9          TRUE    89.9      2    27  96.8   100     7.65     2.13  7.71
#> 10 10         TRUE   100        3    27 100     100     0        3.19  4.64
#> 
#> $metrics
#>       AUC     ACC     PRC     TPR     TNR
#> 1 0.85941 0.20522 0.17838 0.35106 0.12644
#> 
#> $cv_metrics
#> # A tibble: 20 × 8
#>    metric    mean      sd cv_1_valid cv_2_valid cv_3_valid cv_4_valid cv_5_valid
#>    <chr>    <dbl>   <dbl>      <dbl>      <dbl>      <dbl>      <dbl>      <dbl>
#>  1 accura…  0.812 0.0365       0.752      0.824      0.808      0.831      0.847
#>  2 auc      0.845 0.0173       0.855      0.844      0.826      0.870      0.833
#>  3 err      0.188 0.0365       0.248      0.176      0.192      0.169      0.153
#>  4 err_co… 23.4   4.62        31         22         24         21         19    
#>  5 f0poin…  0.774 0.0781       0.636      0.801      0.801      0.822      0.812
#>  6 f1       0.754 0.0545       0.705      0.694      0.774      0.826      0.771
#>  7 f2       0.743 0.0822       0.791      0.613      0.748      0.831      0.734
#>  8 lift_t…  2.35  0.785        2.91       2.84       2.23       1.03       2.76 
#>  9 logloss  0.452 0.0188       0.454      0.443      0.484      0.448      0.434
#> 10 max_pe…  0.293 0.0932       0.305      0.432      0.268      0.172      0.289
#> 11 mcc      0.614 0.0549       0.528      0.608      0.611      0.661      0.662
#> 12 mean_p…  0.799 0.0270       0.778      0.766      0.801      0.831      0.818
#> 13 mean_p…  0.201 0.0270       0.222      0.234      0.199      0.169      0.182
#> 14 mse      0.143 0.00687      0.149      0.145      0.149      0.141      0.132
#> 15 pr_auc   0.825 0.0330       0.779      0.807      0.865      0.838      0.836
#> 16 precis…  0.794 0.114        0.597      0.893      0.82       0.820      0.842
#> 17 r2       0.394 0.0411       0.342      0.363      0.399      0.437      0.428
#> 18 recall   0.741 0.116        0.860      0.568      0.732      0.833      0.711
#> 19 rmse     0.378 0.00916      0.385      0.381      0.385      0.375      0.364
#> 20 specif…  0.856 0.104        0.695      0.963      0.870      0.828      0.924
#> 
#> $max_metrics
#>                         metric  threshold       value idx
#> 1                       max f1 0.39136831   0.7414830 183
#> 2                       max f2 0.20582409   0.7950401 273
#> 3                 max f0point5 0.75243062   0.8092105  86
#> 4                 max accuracy 0.53408813   0.8041734 127
#> 5                max precision 0.97721308   1.0000000   0
#> 6                   max recall 0.03321872   1.0000000 399
#> 7              max specificity 0.97721308   1.0000000   0
#> 8             max absolute_mcc 0.65006059   0.5896115 102
#> 9   max min_per_class_accuracy 0.35001107   0.7706667 201
#> 10 max mean_per_class_accuracy 0.39136831   0.7849839 183
#> 11                     max tns 0.97721308 375.0000000   0
#> 12                     max fns 0.97721308 247.0000000   0
#> 13                     max fps 0.04101918 375.0000000 397
#> 14                     max tps 0.03321872 248.0000000 399
#> 15                     max tnr 0.97721308   1.0000000   0
#> 16                     max fnr 0.97721308   0.9959677   0
#> 17                     max fpr 0.04101918   1.0000000 397
#> 18                     max tpr 0.03321872   1.0000000 399

The same goes for the plots generated for these metrics. We have the gains and response plots on test data-set, confusion matrix, and ROC curves.

r$plots$metrics
#> $gains

#> 
#> $response

#> 
#> $conf_matrix

#> 
#> $ROC

For all models, regardless of their type (classification or regression), you can check the importance of each variable as well:

head(r$importance)
#>     variable relative_importance scaled_importance importance
#> 1 Sex.female           190.90228        1.00000000 0.37452343
#> 2   Pclass.3            93.93656        0.49206620 0.18429032
#> 3       Fare            75.43973        0.39517457 0.14800213
#> 4        Age            75.14226        0.39361634 0.14741854
#> 5   Sex.male            32.52708        0.17038602 0.06381356
#> 6   Pclass.1            18.38319        0.09629635 0.03606524

r$plots$importance

Classification: Multi-Categorical

Now, let’s run a multi-categorical (+2 labels) model to predict Pclass of each passenger:

r <- h2o_automl(df, Pclass, ignore = c("Fare", "Cabin"), max_time = 30, plots = FALSE)
#> 2022-01-27 16:00:00 | Started process...
#> - INDEPENDENT VARIABLE: Pclass
#> - MODEL TYPE: Classification
#> 
[38;5;246m# A tibble: 3 × 5
[39m
#>   tag       n     p order  pcum
#>   
[3m
[38;5;246m<fct>
[39m
[23m 
[3m
[38;5;246m<int>
[39m
[23m 
[3m
[38;5;246m<dbl>
[39m
[23m 
[3m
[38;5;246m<int>
[39m
[23m 
[3m
[38;5;246m<dbl>
[39m
[23m
#> 
[38;5;250m1
[39m n_3     491  55.1     1  55.1
#> 
[38;5;250m2
[39m n_1     216  24.2     2  79.4
#> 
[38;5;250m3
[39m n_2     184  20.6     3 100
#> - MISSINGS: The following variables contain missing observations: Age (19.87%). Consider using the impute parameter.
#> - CATEGORICALS: There are 3 non-numerical features. Consider using ohse() or equivalent prior to encode categorical variables.
#> >>> Splitting data: train = 0.7 & test = 0.3
#> train_size  test_size 
#>        623        268
#> - REPEATED: There were 65 repeated rows which are being suppressed from the train dataset
#> - ALGORITHMS: excluded 'StackedEnsemble', 'DeepLearning'
#> - CACHE: Previous models are not being erased. You may use 'start_clean' [clear] or 'project_name' [join]
#> - UI: You may check results using H2O Flow's interactive platform: http://localhost:54321/flow/index.html
#> >>> Iterating until 3 models or 30 seconds...
#> 
#> 16:00:01.107: Project: AutoML_6_20220127_160001
#> 16:00:01.107: Setting stopping tolerance adaptively based on the training frame: 0.0400641540107502
#> 16:00:01.107: Build control seed: 0
#> 16:00:01.107: training frame: Frame key: AutoML_6_20220127_160001_training_train_sid_90d2_82    cols: 8    rows: 623  chunks: 1    size: 9412  checksum: -6266075352297987636
#> 16:00:01.107: validation frame: NULL
#> 16:00:01.107: leaderboard frame: NULL
#> 16:00:01.107: blending frame: NULL
#> 16:00:01.107: response column: tag
#> 16:00:01.107: fold column: null
#> 16:00:01.107: weights column: null
#> 16:00:01.108: Loading execution steps: [{XGBoost : [def_2 (1g, 10w), def_1 (2g, 10w), def_3 (3g, 10w), grid_1 (4g, 90w), lr_search (6g, 30w)]}, {GLM : [def_1 (1g, 10w)]}, {DRF : [def_1 (2g, 10w), XRT (3g, 10w)]}, {GBM : [def_5 (1g, 10w), def_2 (2g, 10w), def_3 (2g, 10w), def_4 (2g, 10w), def_1 (3g, 10w), grid_1 (4g, 60w), lr_annealing (6g, 10w)]}, {DeepLearning : [def_1 (3g, 10w), grid_1 (4g, 30w), grid_2 (5g, 30w), grid_3 (5g, 30w)]}, {completion : [resume_best_grids (10g, 60w)]}, {StackedEnsemble : [best_of_family_1 (1g, 5w), best_of_family_2 (2g, 5w), best_of_family_3 (3g, 5w), best_of_family_4 (4g, 5w), best_of_family_5 (5g, 5w), all_2 (2g, 10w), all_3 (3g, 10w), all_4 (4g, 10w), all_5 (5g, 10w), monotonic (6g, 10w), best_of_family_xgboost (6g, 10w), best_of_family_gbm (6g, 10w), all_xgboost (7g, 10w), all_gbm (7g, 10w), best_of_family_xglm (8g, 10w), all_xglm (8g, 10w), best_of_family (10g, 10w), best_N (10g, 10w)]}]
#> 16:00:01.108: Disabling Algo: StackedEnsemble as requested by the user.
#> 16:00:01.108: Disabling Algo: DeepLearning as requested by the user.
#> 16:00:01.108: Defined work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}]
#> 16:00:01.108: Actual work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}]
#> 16:00:01.109: AutoML job created: 2022.01.27 16:00:01.106
#> 16:00:01.119: AutoML build started: 2022.01.27 16:00:01.119
#> 16:00:01.119: Time assigned for XGBoost_1_AutoML_6_20220127_160001: 10.0s
#> 16:00:01.119: AutoML: starting XGBoost_1_AutoML_6_20220127_160001 model training
#> 16:00:01.150: XGBoost_1_AutoML_6_20220127_160001 [XGBoost def_2] started
#> 16:00:03.214: XGBoost_1_AutoML_6_20220127_160001 [XGBoost def_2] complete
#> 16:00:03.214: Adding model XGBoost_1_AutoML_6_20220127_160001 to leaderboard Leaderboard_AutoML_6_20220127_160001@@tag. Training time: model=0s, total=2s
#> 16:00:03.216: New leader: XGBoost_1_AutoML_6_20220127_160001, mean_per_class_error: 0.4946035431716546
#> 16:00:03.216: Time assigned for GLM_1_AutoML_6_20220127_160001: 13.9515s
#> 16:00:03.216: AutoML: starting GLM_1_AutoML_6_20220127_160001 model training
#> 16:00:03.220: GLM_1_AutoML_6_20220127_160001 [GLM def_1] started
#> 16:00:10.748: GLM_1_AutoML_6_20220127_160001 [GLM def_1] complete
#> 16:00:10.748: Adding model GLM_1_AutoML_6_20220127_160001 to leaderboard Leaderboard_AutoML_6_20220127_160001@@tag. Training time: model=2s, total=6s
#> 16:00:10.749: New leader: GLM_1_AutoML_6_20220127_160001, mean_per_class_error: 0.47423245614035087
#> 16:00:10.749: Time assigned for GBM_1_AutoML_6_20220127_160001: 20.37s
#> 16:00:10.750: AutoML: starting GBM_1_AutoML_6_20220127_160001 model training
#> 16:00:10.769: GBM_1_AutoML_6_20220127_160001 [GBM def_5] started
#> 16:00:12.919: GBM_1_AutoML_6_20220127_160001 [GBM def_5] complete
#> 16:00:12.920: Adding model GBM_1_AutoML_6_20220127_160001 to leaderboard Leaderboard_AutoML_6_20220127_160001@@tag. Training time: model=0s, total=1s
#> 16:00:12.925: Skipping StackedEnsemble 'best_of_family_1' due to the exclude_algos option or it is already trained.
#> 16:00:12.925: AutoML: hit the max_models limit; skipping XGBoost def_1
#> 16:00:12.925: AutoML: hit the max_models limit; skipping DRF def_1
#> 16:00:12.925: AutoML: hit the max_models limit; skipping GBM def_2
#> 16:00:12.925: AutoML: hit the max_models limit; skipping GBM def_3
#> 16:00:12.925: AutoML: hit the max_models limit; skipping GBM def_4
#> 16:00:12.925: Skipping StackedEnsemble 'best_of_family_2' due to the exclude_algos option or it is already trained.
#> 16:00:12.925: Skipping StackedEnsemble 'all_2' due to the exclude_algos option or it is already trained.
#> 16:00:12.926: AutoML: hit the max_models limit; skipping XGBoost def_3
#> 16:00:12.926: AutoML: hit the max_models limit; skipping DRF XRT (Extremely Randomized Trees)
#> 16:00:12.926: AutoML: hit the max_models limit; skipping GBM def_1
#> 16:00:12.926: AutoML: hit the max_models limit; skipping DeepLearning def_1
#> 16:00:12.926: Skipping StackedEnsemble 'best_of_family_3' due to the exclude_algos option or it is already trained.
#> 16:00:12.926: Skipping StackedEnsemble 'all_3' due to the exclude_algos option or it is already trained.
#> 16:00:12.926: AutoML: hit the max_models limit; skipping XGBoost grid_1
#> 16:00:12.926: AutoML: hit the max_models limit; skipping GBM grid_1
#> 16:00:12.926: AutoML: hit the max_models limit; skipping DeepLearning grid_1
#> 16:00:12.926: Skipping StackedEnsemble 'best_of_family_4' due to the exclude_algos option or it is already trained.
#> 16:00:12.926: Skipping StackedEnsemble 'all_4' due to the exclude_algos option or it is already trained.
#> 16:00:12.926: AutoML: hit the max_models limit; skipping DeepLearning grid_2
#> 16:00:12.926: AutoML: hit the max_models limit; skipping DeepLearning grid_3
#> 16:00:12.927: Skipping StackedEnsemble 'best_of_family_5' due to the exclude_algos option or it is already trained.
#> 16:00:12.927: Skipping StackedEnsemble 'all_5' due to the exclude_algos option or it is already trained.
#> 16:00:12.927: AutoML: hit the max_models limit; skipping XGBoost lr_search
#> 16:00:12.927: AutoML: hit the max_models limit; skipping GBM lr_annealing
#> 16:00:12.927: Skipping StackedEnsemble 'monotonic' due to the exclude_algos option or it is already trained.
#> 16:00:12.927: Skipping StackedEnsemble 'best_of_family_xgboost' due to the exclude_algos option or it is already trained.
#> 16:00:12.928: Skipping StackedEnsemble 'best_of_family_gbm' due to the exclude_algos option or it is already trained.
#> 16:00:12.928: Skipping StackedEnsemble 'all_xgboost' due to the exclude_algos option or it is already trained.
#> 16:00:12.928: Skipping StackedEnsemble 'all_gbm' due to the exclude_algos option or it is already trained.
#> 16:00:12.928: Skipping StackedEnsemble 'best_of_family_xglm' due to the exclude_algos option or it is already trained.
#> 16:00:12.928: Skipping StackedEnsemble 'all_xglm' due to the exclude_algos option or it is already trained.
#> 16:00:12.929: AutoML: hit the max_models limit; skipping completion resume_best_grids
#> 16:00:12.929: Skipping StackedEnsemble 'best_of_family' due to the exclude_algos option or it is already trained.
#> 16:00:12.929: Skipping StackedEnsemble 'best_N' due to the exclude_algos option or it is already trained.
#> 16:00:12.929: Actual modeling steps: [{XGBoost : [def_2 (1g, 10w)]}, {GLM : [def_1 (1g, 10w)]}, {GBM : [def_5 (1g, 10w)]}]
#> 16:00:12.929: AutoML build stopped: 2022.01.27 16:00:12.929
#> 16:00:12.929: AutoML build done: built 3 models
#> 16:00:12.929: AutoML duration: 11.810 sec
#> 16:00:12.935: Verifying training frame immutability. . .
#> 16:00:12.935: Training frame was not mutated (as expected).
#> - EUREKA: Succesfully generated 3 models
#>                             model_id mean_per_class_error   logloss      rmse
#> 1     GLM_1_AutoML_6_20220127_160001            0.4742325 0.8170807 0.5409388
#> 2 XGBoost_1_AutoML_6_20220127_160001            0.4946035 0.8255072 0.5392879
#> 3     GBM_1_AutoML_6_20220127_160001            0.5037168 0.8620436 0.5616772
#>         mse
#> 1 0.2926147
#> 2 0.2908315
#> 3 0.3154812
#> SELECTED MODEL: GLM_1_AutoML_6_20220127_160001
#> - NOTE: The following variables were the least important: Sex.male, Sex.female, Parch
#> >>> Running predictions for Pclass...
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> Model (1/3): GLM_1_AutoML_6_20220127_160001
#> Independent Variable: Pclass
#> Type: Classification (3 classes)
#> Algorithm: GLM
#> Split: 70% training data (of 891 observations)
#> Seed: 0
#> 
#> Test metrics:
#>    AUC = 0.76337
#>    ACC = 0.64179
#> 
#> Most important variables:
#>    Embarked.Q (25.3%)
#>    Embarked.C (13.5%)
#>    Embarked.S (13.3%)
#>    Age (11.9%)
#>    Survived.FALSE (10.6%)
#> Process duration: 20.9s

Let’s take a look at the plots generated into a single dashboard:

plot(r)

Regression

Finally, a regression model with continuous values to predict Fare payed by passenger:

r <- h2o_automl(df, y = "Fare", ignore = "Pclass", exclude_algos = NULL, quiet = TRUE)
#> 
#> 16:00:24.162: Project: AutoML_7_20220127_160024
#> 16:00:24.162: Setting stopping tolerance adaptively based on the training frame: 0.04052204492365539
#> 16:00:24.162: Build control seed: 0
#> 16:00:24.163: training frame: Frame key: AutoML_7_20220127_160024_training_train_sid_8b6e_174    cols: 8    rows: 609  chunks: 1    size: 9258  checksum: 6553451394746990112
#> 16:00:24.163: validation frame: NULL
#> 16:00:24.163: leaderboard frame: NULL
#> 16:00:24.163: blending frame: NULL
#> 16:00:24.163: response column: tag
#> 16:00:24.163: fold column: null
#> 16:00:24.163: weights column: null
#> 16:00:24.163: Loading execution steps: [{XGBoost : [def_2 (1g, 10w), def_1 (2g, 10w), def_3 (3g, 10w), grid_1 (4g, 90w), lr_search (6g, 30w)]}, {GLM : [def_1 (1g, 10w)]}, {DRF : [def_1 (2g, 10w), XRT (3g, 10w)]}, {GBM : [def_5 (1g, 10w), def_2 (2g, 10w), def_3 (2g, 10w), def_4 (2g, 10w), def_1 (3g, 10w), grid_1 (4g, 60w), lr_annealing (6g, 10w)]}, {DeepLearning : [def_1 (3g, 10w), grid_1 (4g, 30w), grid_2 (5g, 30w), grid_3 (5g, 30w)]}, {completion : [resume_best_grids (10g, 60w)]}, {StackedEnsemble : [best_of_family_1 (1g, 5w), best_of_family_2 (2g, 5w), best_of_family_3 (3g, 5w), best_of_family_4 (4g, 5w), best_of_family_5 (5g, 5w), all_2 (2g, 10w), all_3 (3g, 10w), all_4 (4g, 10w), all_5 (5g, 10w), monotonic (6g, 10w), best_of_family_xgboost (6g, 10w), best_of_family_gbm (6g, 10w), all_xgboost (7g, 10w), all_gbm (7g, 10w), best_of_family_xglm (8g, 10w), all_xglm (8g, 10w), best_of_family (10g, 10w), best_N (10g, 10w)]}]
#> 16:00:24.164: Defined work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{best_of_family_1, StackedEnsemble, ModelBuild, group=1, weight=5}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{best_of_family_2, StackedEnsemble, ModelBuild, group=2, weight=5}, Work{all_2, StackedEnsemble, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{def_1, DeepLearning, ModelBuild, group=3, weight=10}, Work{best_of_family_3, StackedEnsemble, ModelBuild, group=3, weight=5}, Work{all_3, StackedEnsemble, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{grid_1, DeepLearning, HyperparamSearch, group=4, weight=30}, Work{best_of_family_4, StackedEnsemble, ModelBuild, group=4, weight=5}, Work{all_4, StackedEnsemble, ModelBuild, group=4, weight=10}, Work{grid_2, DeepLearning, HyperparamSearch, group=5, weight=30}, Work{grid_3, DeepLearning, HyperparamSearch, group=5, weight=30}, Work{best_of_family_5, StackedEnsemble, ModelBuild, group=5, weight=5}, Work{all_5, StackedEnsemble, ModelBuild, group=5, weight=10}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{monotonic, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{best_of_family_xgboost, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{best_of_family_gbm, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{all_xgboost, StackedEnsemble, ModelBuild, group=7, weight=10}, Work{all_gbm, StackedEnsemble, ModelBuild, group=7, weight=10}, Work{best_of_family_xglm, StackedEnsemble, ModelBuild, group=8, weight=10}, Work{all_xglm, StackedEnsemble, ModelBuild, group=8, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}, Work{best_of_family, StackedEnsemble, ModelBuild, group=10, weight=10}, Work{best_N, StackedEnsemble, ModelBuild, group=10, weight=10}]
#> 16:00:24.164: Actual work allocations: [Work{def_2, XGBoost, ModelBuild, group=1, weight=10}, Work{def_1, GLM, ModelBuild, group=1, weight=10}, Work{def_5, GBM, ModelBuild, group=1, weight=10}, Work{best_of_family_1, StackedEnsemble, ModelBuild, group=1, weight=5}, Work{def_1, XGBoost, ModelBuild, group=2, weight=10}, Work{def_1, DRF, ModelBuild, group=2, weight=10}, Work{def_2, GBM, ModelBuild, group=2, weight=10}, Work{def_3, GBM, ModelBuild, group=2, weight=10}, Work{def_4, GBM, ModelBuild, group=2, weight=10}, Work{best_of_family_2, StackedEnsemble, ModelBuild, group=2, weight=5}, Work{all_2, StackedEnsemble, ModelBuild, group=2, weight=10}, Work{def_3, XGBoost, ModelBuild, group=3, weight=10}, Work{XRT, DRF, ModelBuild, group=3, weight=10}, Work{def_1, GBM, ModelBuild, group=3, weight=10}, Work{def_1, DeepLearning, ModelBuild, group=3, weight=10}, Work{best_of_family_3, StackedEnsemble, ModelBuild, group=3, weight=5}, Work{all_3, StackedEnsemble, ModelBuild, group=3, weight=10}, Work{grid_1, XGBoost, HyperparamSearch, group=4, weight=90}, Work{grid_1, GBM, HyperparamSearch, group=4, weight=60}, Work{grid_1, DeepLearning, HyperparamSearch, group=4, weight=30}, Work{best_of_family_4, StackedEnsemble, ModelBuild, group=4, weight=5}, Work{all_4, StackedEnsemble, ModelBuild, group=4, weight=10}, Work{grid_2, DeepLearning, HyperparamSearch, group=5, weight=30}, Work{grid_3, DeepLearning, HyperparamSearch, group=5, weight=30}, Work{best_of_family_5, StackedEnsemble, ModelBuild, group=5, weight=5}, Work{all_5, StackedEnsemble, ModelBuild, group=5, weight=10}, Work{lr_search, XGBoost, Selection, group=6, weight=30}, Work{lr_annealing, GBM, Selection, group=6, weight=10}, Work{monotonic, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{best_of_family_xgboost, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{best_of_family_gbm, StackedEnsemble, ModelBuild, group=6, weight=10}, Work{all_xgboost, StackedEnsemble, ModelBuild, group=7, weight=10}, Work{all_gbm, StackedEnsemble, ModelBuild, group=7, weight=10}, Work{best_of_family_xglm, StackedEnsemble, ModelBuild, group=8, weight=10}, Work{all_xglm, StackedEnsemble, ModelBuild, group=8, weight=10}, Work{resume_best_grids, virtual, Dynamic, group=10, weight=60}, Work{best_of_family, StackedEnsemble, ModelBuild, group=10, weight=10}, Work{best_N, StackedEnsemble, ModelBuild, group=10, weight=10}]
#> 16:00:24.164: AutoML job created: 2022.01.27 16:00:24.162
#> 16:00:24.175: AutoML build started: 2022.01.27 16:00:24.175
#> 16:00:24.175: Time assigned for XGBoost_1_AutoML_7_20220127_160024: 171.428578125s
#> 16:00:24.175: AutoML: starting XGBoost_1_AutoML_7_20220127_160024 model training
#> 16:00:24.195: XGBoost_1_AutoML_7_20220127_160024 [XGBoost def_2] started
#> 16:00:26.361: XGBoost_1_AutoML_7_20220127_160024 [XGBoost def_2] complete
#> 16:00:26.362: Adding model XGBoost_1_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=0s, total=1s
#> 16:00:26.362: New leader: XGBoost_1_AutoML_7_20220127_160024, mean_residual_deviance: 830.4367206836267
#> 16:00:26.363: Time assigned for GLM_1_AutoML_7_20220127_160024: 239.124796875s
#> 16:00:26.363: AutoML: starting GLM_1_AutoML_7_20220127_160024 model training
#> 16:00:26.363: GLM_1_AutoML_7_20220127_160024 [GLM def_1] started
#> 16:00:27.484: GLM_1_AutoML_7_20220127_160024 [GLM def_1] complete
#> 16:00:27.484: Adding model GLM_1_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=0s, total=0s
#> 16:00:27.485: New leader: GLM_1_AutoML_7_20220127_160024, mean_residual_deviance: 739.2163401351919
#> 16:00:27.486: Time assigned for GBM_1_AutoML_7_20220127_160024: 397.7926875s
#> 16:00:27.486: AutoML: starting GBM_1_AutoML_7_20220127_160024 model training
#> 16:00:27.506: GBM_1_AutoML_7_20220127_160024 [GBM def_5] started
#> 16:00:28.610: GBM_1_AutoML_7_20220127_160024 [GBM def_5] complete
#> 16:00:28.610: Adding model GBM_1_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=0s, total=0s
#> 16:00:28.612: Time assigned for StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024: 595.563s
#> 16:00:28.612: AutoML: starting StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024 model training
#> 16:00:28.614: StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_1 (built with AUTO metalearner, using top model from each algorithm type)] started
#> 16:00:29.614: StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_1 (built with AUTO metalearner, using top model from each algorithm type)] complete
#> 16:00:29.615: Adding model StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=0s, total=0s
#> 16:00:29.616: New leader: StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024, mean_residual_deviance: 730.9754634709968
#> 16:00:29.616: AutoML: hit the max_models limit; skipping XGBoost def_1
#> 16:00:29.616: AutoML: hit the max_models limit; skipping DRF def_1
#> 16:00:29.616: AutoML: hit the max_models limit; skipping GBM def_2
#> 16:00:29.616: AutoML: hit the max_models limit; skipping GBM def_3
#> 16:00:29.616: AutoML: hit the max_models limit; skipping GBM def_4
#> 16:00:29.616: AutoML: hit the max_models limit; skipping XGBoost def_3
#> 16:00:29.616: AutoML: hit the max_models limit; skipping DRF XRT (Extremely Randomized Trees)
#> 16:00:29.616: AutoML: hit the max_models limit; skipping GBM def_1
#> 16:00:29.616: AutoML: hit the max_models limit; skipping DeepLearning def_1
#> 16:00:29.617: AutoML: hit the max_models limit; skipping XGBoost grid_1
#> 16:00:29.617: AutoML: hit the max_models limit; skipping GBM grid_1
#> 16:00:29.617: AutoML: hit the max_models limit; skipping DeepLearning grid_1
#> 16:00:29.617: AutoML: hit the max_models limit; skipping DeepLearning grid_2
#> 16:00:29.617: AutoML: hit the max_models limit; skipping DeepLearning grid_3
#> 16:00:29.617: AutoML: hit the max_models limit; skipping XGBoost lr_search
#> 16:00:29.617: AutoML: hit the max_models limit; skipping GBM lr_annealing
#> 16:00:29.618: No base models, due to timeouts or the exclude_algos option. Skipping StackedEnsemble 'monotonic'.
#> 16:00:29.618: Time assigned for StackedEnsemble_BestOfFamily_2_AutoML_7_20220127_160024: 99.0928359375s
#> 16:00:29.618: AutoML: starting StackedEnsemble_BestOfFamily_2_AutoML_7_20220127_160024 model training
#> 16:00:29.639: StackedEnsemble_BestOfFamily_2_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_xgboost (built with xgboost metalearner, using top model from each algorithm type)] started
#> 16:00:33.867: StackedEnsemble_BestOfFamily_2_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_xgboost (built with xgboost metalearner, using top model from each algorithm type)] complete
#> 16:00:33.867: Adding model StackedEnsemble_BestOfFamily_2_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=3s, total=3s
#> 16:00:33.868: Time assigned for StackedEnsemble_BestOfFamily_3_AutoML_7_20220127_160024: 118.0613984375s
#> 16:00:33.868: AutoML: starting StackedEnsemble_BestOfFamily_3_AutoML_7_20220127_160024 model training
#> 16:00:33.872: StackedEnsemble_BestOfFamily_3_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_gbm (built with gbm metalearner, using top model from each algorithm type)] started
#> 16:00:34.889: StackedEnsemble_BestOfFamily_3_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_gbm (built with gbm metalearner, using top model from each algorithm type)] complete
#> 16:00:34.889: Adding model StackedEnsemble_BestOfFamily_3_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=1s, total=1s
#> 16:00:34.892: Time assigned for StackedEnsemble_BestOfFamily_4_AutoML_7_20220127_160024: 294.6415s
#> 16:00:34.892: AutoML: starting StackedEnsemble_BestOfFamily_4_AutoML_7_20220127_160024 model training
#> 16:00:34.893: StackedEnsemble_BestOfFamily_4_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_xglm (built with AUTO metalearner, using top model from each algorithm type)] started
#> 16:00:35.974: StackedEnsemble_BestOfFamily_4_AutoML_7_20220127_160024 [StackedEnsemble best_of_family_xglm (built with AUTO metalearner, using top model from each algorithm type)] complete
#> 16:00:35.974: Adding model StackedEnsemble_BestOfFamily_4_AutoML_7_20220127_160024 to leaderboard Leaderboard_AutoML_7_20220127_160024@@tag. Training time: model=0s, total=0s
#> 16:00:35.977: AutoML: hit the max_models limit; skipping completion resume_best_grids
#> 16:00:35.979: Actual modeling steps: [{XGBoost : [def_2 (1g, 10w)]}, {GLM : [def_1 (1g, 10w)]}, {GBM : [def_5 (1g, 10w)]}, {StackedEnsemble : [best_of_family_1 (1g, 5w), best_of_family_xgboost (6g, 10w), best_of_family_gbm (6g, 10w), best_of_family_xglm (8g, 10w)]}]
#> 16:00:35.979: AutoML build stopped: 2022.01.27 16:00:35.979
#> 16:00:35.979: AutoML build done: built 3 models
#> 16:00:35.979: AutoML duration: 11.804 sec
#> 16:00:35.986: Verifying training frame immutability. . .
#> 16:00:35.986: Training frame was not mutated (as expected).
print(r)
#> Model (1/7): StackedEnsemble_BestOfFamily_1_AutoML_7_20220127_160024
#> Independent Variable: Fare
#> Type: Regression
#> Algorithm: STACKEDENSEMBLE
#> Split: 70% training data (of 871 observations)
#> Seed: 0
#> 
#> Test metrics:
#>    rmse = 20.17
#>    mae = 14.079
#>    mape = 0.068862
#>    mse = 406.82
#>    rsq = 0.367
#>    rsqa = 0.3645

Let’s take a look at the plots generated into a single dashboard:

plot(r)

Export models and results

Once you have you model trained and picked, you can export the model and it’s results, so you can put it to work in a production environment (doesn’t have to be R). There is a function that does all that for you: export_results(). Simply pass your h2o_automl list object into this function and that’s it! You can select which formats will be exported using the which argument. Currently we support: txt, csv, rds, binary, mojo [best format for production], and plots. There are also 2 quick options (dev and production) to export some or all the files. Lastly, you can set a custom subdir to gather everything into a new sub-directory; I’d recommend using the model’s name or any other convention that helps you know which one’s which.

Import and use your models

If you’d like to re-use your exported models to predict new datasets, you have several options:

  • h2o_predict_MOJO() [recommended]: This function lets the user predict using h2o’s .zip file containing the MOJO files. These files are also the ones used when putting the model into production on any other environment. Also, MOJO let’s you change h2o’s versions without issues
  • h2o_predict_binary(): This function lets the user predict using the h2o binary file. The h2o version/build must match for it to work.
  • h2o_predict_model(): This function lets the user run predictions from a H2O Model Object same as you’d use the predict base function. Will probably only work in your current session as you must have the actual trained object to use it.