Goal is to automate building and tuning a classification model to predict employee attrition, using the h2o::h2o.automl.
Import the cleaned data from Module 7.
library(h2o)
##
## ----------------------------------------------------------------------
##
## Your next step is to start H2O:
## > h2o.init()
##
## For H2O package documentation, ask for help:
## > ??h2o
##
## After starting H2O, you can use the Web UI at http://localhost:54321
## For more information visit https://docs.h2o.ai
##
## ----------------------------------------------------------------------
##
## Attaching package: 'h2o'
## The following objects are masked from 'package:stats':
##
## cor, sd, var
## The following objects are masked from 'package:base':
##
## &&, %*%, %in%, ||, apply, as.factor, as.numeric, colnames,
## colnames<-, ifelse, is.character, is.factor, is.numeric, log,
## log10, log1p, log2, round, signif, trunc
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() ──
## ✖ lubridate::day() masks h2o::day()
## ✖ dplyr::filter() masks stats::filter()
## ✖ lubridate::hour() masks h2o::hour()
## ✖ dplyr::lag() masks stats::lag()
## ✖ lubridate::month() masks h2o::month()
## ✖ lubridate::week() masks h2o::week()
## ✖ lubridate::year() masks h2o::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidymodels)
## ── Attaching packages ────────────────────────────────────── tidymodels 1.2.0 ──
## ✔ broom 1.0.8 ✔ rsample 1.2.1
## ✔ dials 1.3.0 ✔ tune 1.2.1
## ✔ infer 1.0.7 ✔ workflows 1.1.4
## ✔ modeldata 1.4.0 ✔ workflowsets 1.1.0
## ✔ parsnip 1.2.1 ✔ yardstick 1.3.2
## ✔ recipes 1.1.0
## ── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ──
## ✖ scales::discard() masks purrr::discard()
## ✖ dplyr::filter() masks stats::filter()
## ✖ recipes::fixed() masks stringr::fixed()
## ✖ dplyr::lag() masks stats::lag()
## ✖ yardstick::spec() masks readr::spec()
## ✖ recipes::step() masks stats::step()
## • Learn how to get started at https://www.tidymodels.org/start/
library(tidyquant)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## ── Attaching core tidyquant packages ──────────────────────── tidyquant 1.0.9 ──
## ✔ PerformanceAnalytics 2.0.4 ✔ TTR 0.24.4
## ✔ quantmod 0.4.26 ✔ xts 0.14.0── Conflicts ────────────────────────────────────────── tidyquant_conflicts() ──
## ✖ zoo::as.Date() masks base::as.Date()
## ✖ zoo::as.Date.numeric() masks base::as.Date.numeric()
## ✖ scales::col_factor() masks readr::col_factor()
## ✖ lubridate::day() masks h2o::day()
## ✖ scales::discard() masks purrr::discard()
## ✖ dplyr::filter() masks stats::filter()
## ✖ xts::first() masks dplyr::first()
## ✖ recipes::fixed() masks stringr::fixed()
## ✖ lubridate::hour() masks h2o::hour()
## ✖ dplyr::lag() masks stats::lag()
## ✖ xts::last() masks dplyr::last()
## ✖ PerformanceAnalytics::legend() masks graphics::legend()
## ✖ TTR::momentum() masks dials::momentum()
## ✖ lubridate::month() masks h2o::month()
## ✖ yardstick::spec() masks readr::spec()
## ✖ quantmod::summary() masks h2o::summary(), base::summary()
## ✖ lubridate::week() masks h2o::week()
## ✖ lubridate::year() masks h2o::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
data <- read_csv("../00_data/data_wrangled/data_clean.csv") %>%
# h2o requires all variables to be either numeric or factors
mutate(across(where(is.character), factor))
## Rows: 1470 Columns: 32
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): Attrition, BusinessTravel, Department, EducationField, Gender, Job...
## dbl (24): Age, DailyRate, DistanceFromHome, Education, EmployeeNumber, Envir...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
set.seed(1234)
data_split <- initial_split(data, strata = "Attrition")
train_tbl <- training(data_split)
test_tbl <- testing(data_split)
recipe_obj <- recipe(Attrition ~ ., data = train_tbl) %>%
# Remove zero variance variables
step_zv(all_predictors())
# Initialize h2o
h2o.init()
## Connection successful!
##
## R is connected to the H2O cluster:
## H2O cluster uptime: 1 days 8 hours
## H2O cluster timezone: America/New_York
## H2O data parsing timezone: UTC
## H2O cluster version: 3.44.0.3
## H2O cluster version age: 1 year, 4 months and 3 days
## H2O cluster name: H2O_started_from_R_katiegoy_fyb567
## H2O cluster total nodes: 1
## H2O cluster total memory: 1.34 GB
## H2O cluster total cores: 8
## H2O cluster allowed cores: 8
## H2O cluster healthy: TRUE
## H2O Connection ip: localhost
## H2O Connection port: 54321
## H2O Connection proxy: NA
## H2O Internal Security: FALSE
## R Version: R version 4.4.1 (2024-06-14)
## Warning in h2o.clusterInfo():
## Your H2O cluster version is (1 year, 4 months and 3 days) old. There may be a newer version available.
## Please download and install the latest version from: https://h2o-release.s3.amazonaws.com/h2o/latest_stable.html
split.h2o <- h2o.splitFrame(as.h2o(train_tbl), ratios = (0.85), seed = 2345)
## | | | 0% | |======================================================================| 100%
train_h2o <- split.h2o[[1]]
valid_h2o <- split.h2o[[2]]
test_h2o <- as.h2o(test_tbl)
## | | | 0% | |======================================================================| 100%
y <- "Attrition"
x <- setdiff(names(train_tbl), y)
models_h2o <- h2o.automl(
x = x,
y = y,
training_frame = train_h2o,
validation_frame = valid_h2o,
leaderboard_frame = test_h2o,
max_runtime_secs = 30,
nfolds = 5,
seed = 3456
)
## | | | 0% | |==== | 6%
## 20:10:14.482: User specified a validation frame with cross-validation still enabled. Please note that the models will still be validated using cross-validation only, the validation frame will be used to provide purely informative validation metrics on the trained models.
## 20:10:14.485: AutoML: XGBoost is not available; skipping it. | |=========== | 16% | |==================== | 28% | |===================== | 30% | |====================== | 32% | |============================= | 42% | |=============================== | 44% | |==================================== | 51% | |======================================== | 58% | |============================================= | 64% | |================================================== | 71% | |======================================================= | 78% | |=========================================================== | 85% | |================================================================ | 92% | |===================================================================== | 98% | |======================================================================| 100%
models_h2o %>% typeof()
## [1] "S4"
models_h2o %>% slotNames()
## [1] "project_name" "leader" "leaderboard" "event_log"
## [5] "modeling_steps" "training_info"
models_h2o@leaderboard
## model_id auc logloss
## 1 StackedEnsemble_BestOfFamily_4_AutoML_4_20250423_201014 0.8319849 0.3257733
## 2 StackedEnsemble_BestOfFamily_3_AutoML_4_20250423_201014 0.8286408 0.3244964
## 3 StackedEnsemble_BestOfFamily_2_AutoML_4_20250423_201014 0.8283172 0.3241037
## 4 GLM_1_AutoML_4_20250423_201014 0.8261597 0.3318676
## 5 StackedEnsemble_BestOfFamily_1_AutoML_4_20250423_201014 0.8258900 0.3346208
## 6 StackedEnsemble_AllModels_2_AutoML_4_20250423_201014 0.8236785 0.3286664
## aucpr mean_per_class_error rmse mse
## 1 0.9513913 0.2997573 0.3075189 0.09456785
## 2 0.9509546 0.2677994 0.3068511 0.09415761
## 3 0.9504244 0.2677994 0.3068317 0.09414572
## 4 0.9466326 0.2930421 0.3082111 0.09499409
## 5 0.9494447 0.2627023 0.3115649 0.09707267
## 6 0.9491895 0.3148058 0.3100281 0.09611743
##
## [43 rows x 7 columns]
models_h2o@leader
## Model Details:
## ==============
##
## H2OBinomialModel: stackedensemble
## Model ID: StackedEnsemble_BestOfFamily_4_AutoML_4_20250423_201014
## Model Summary for Stacked Ensemble:
## key value
## 1 Stacking strategy cross_validation
## 2 Number of base models (used / total) 4/5
## 3 # GBM base models (used / total) 1/1
## 4 # GLM base models (used / total) 1/1
## 5 # DeepLearning base models (used / total) 0/1
## 6 # DRF base models (used / total) 2/2
## 7 Metalearner algorithm GLM
## 8 Metalearner fold assignment scheme Random
## 9 Metalearner nfolds 5
## 10 Metalearner fold_column NA
## 11 Custom metalearner hyperparameters None
##
##
## H2OBinomialMetrics: stackedensemble
## ** Reported on training data. **
##
## MSE: 0.0652915
## RMSE: 0.255522
## LogLoss: 0.2318406
## Mean Per-Class Error: 0.1570675
## AUC: 0.9352929
## AUCPR: 0.9829444
## Gini: 0.8705858
##
## Confusion Matrix (vertical: actual; across: predicted) for F1-optimal threshold:
## Left No Error Rate
## Left 111 47 0.297468 =47/158
## No 13 767 0.016667 =13/780
## Totals 124 814 0.063966 =60/938
##
## Maximum Metrics: Maximum metrics at their respective thresholds
## metric threshold value idx
## 1 max f1 0.559398 0.962359 296
## 2 max f2 0.516864 0.976968 309
## 3 max f0point5 0.714107 0.951200 259
## 4 max accuracy 0.559398 0.936034 296
## 5 max precision 0.999279 1.000000 0
## 6 max recall 0.282750 1.000000 364
## 7 max specificity 0.999279 1.000000 0
## 8 max absolute_mcc 0.559398 0.757864 296
## 9 max min_per_class_accuracy 0.794072 0.864103 213
## 10 max mean_per_class_accuracy 0.827794 0.866675 197
## 11 max tns 0.999279 158.000000 0
## 12 max fns 0.999279 774.000000 0
## 13 max fps 0.031284 158.000000 399
## 14 max tps 0.282750 780.000000 364
## 15 max tnr 0.999279 1.000000 0
## 16 max fnr 0.999279 0.992308 0
## 17 max fpr 0.031284 1.000000 399
## 18 max tpr 0.282750 1.000000 364
##
## Gains/Lift Table: Extract with `h2o.gainsLift(<model>, <data>)` or `h2o.gainsLift(<model>, valid=<T/F>, xval=<T/F>)`
## H2OBinomialMetrics: stackedensemble
## ** Reported on validation data. **
##
## MSE: 0.08504426
## RMSE: 0.2916235
## LogLoss: 0.3092363
## Mean Per-Class Error: 0.3684211
## AUC: 0.7474415
## AUCPR: 0.9475314
## Gini: 0.494883
##
## Confusion Matrix (vertical: actual; across: predicted) for F1-optimal threshold:
## Left No Error Rate
## Left 5 14 0.736842 =14/19
## No 0 144 0.000000 =0/144
## Totals 5 158 0.085890 =14/163
##
## Maximum Metrics: Maximum metrics at their respective thresholds
## metric threshold value idx
## 1 max f1 0.282227 0.953642 157
## 2 max f2 0.282227 0.980926 157
## 3 max f0point5 0.564962 0.940860 149
## 4 max accuracy 0.564962 0.914110 149
## 5 max precision 0.999503 1.000000 0
## 6 max recall 0.282227 1.000000 157
## 7 max specificity 0.999503 1.000000 0
## 8 max absolute_mcc 0.564962 0.528183 149
## 9 max min_per_class_accuracy 0.876992 0.638889 97
## 10 max mean_per_class_accuracy 0.564962 0.722953 149
## 11 max tns 0.999503 19.000000 0
## 12 max fns 0.999503 143.000000 0
## 13 max fps 0.073249 19.000000 162
## 14 max tps 0.282227 144.000000 157
## 15 max tnr 0.999503 1.000000 0
## 16 max fnr 0.999503 0.993056 0
## 17 max fpr 0.073249 1.000000 162
## 18 max tpr 0.282227 1.000000 157
##
## Gains/Lift Table: Extract with `h2o.gainsLift(<model>, <data>)` or `h2o.gainsLift(<model>, valid=<T/F>, xval=<T/F>)`
## H2OBinomialMetrics: stackedensemble
## ** Reported on cross-validation data. **
## ** 5-fold cross-validation on training data (Metrics computed for combined holdout predictions) **
##
## MSE: 0.0954623
## RMSE: 0.3089697
## LogLoss: 0.3352035
## Mean Per-Class Error: 0.351347
## AUC: 0.8428595
## AUCPR: 0.9459445
## Gini: 0.6857189
##
## Confusion Matrix (vertical: actual; across: predicted) for F1-optimal threshold:
## Left No Error Rate
## Left 49 109 0.689873 =109/158
## No 10 770 0.012821 =10/780
## Totals 59 879 0.126866 =119/938
##
## Maximum Metrics: Maximum metrics at their respective thresholds
## metric threshold value idx
## 1 max f1 0.440213 0.928270 344
## 2 max f2 0.287690 0.966543 377
## 3 max f0point5 0.744858 0.923558 234
## 4 max accuracy 0.586330 0.876333 304
## 5 max precision 0.964186 0.964981 54
## 6 max recall 0.287690 1.000000 377
## 7 max specificity 0.999969 0.993671 0
## 8 max absolute_mcc 0.728388 0.524371 243
## 9 max min_per_class_accuracy 0.829570 0.765823 183
## 10 max mean_per_class_accuracy 0.744858 0.792851 234
## 11 max tns 0.999969 157.000000 0
## 12 max fns 0.999969 768.000000 0
## 13 max fps 0.066993 158.000000 399
## 14 max tps 0.287690 780.000000 377
## 15 max tnr 0.999969 0.993671 0
## 16 max fnr 0.999969 0.984615 0
## 17 max fpr 0.066993 1.000000 399
## 18 max tpr 0.287690 1.000000 377
##
## Gains/Lift Table: Extract with `h2o.gainsLift(<model>, <data>)` or `h2o.gainsLift(<model>, valid=<T/F>, xval=<T/F>)`
## Cross-Validation Metrics Summary:
## mean sd cv_1_valid cv_2_valid cv_3_valid cv_4_valid
## accuracy 0.891969 0.021824 0.895238 0.880829 0.865922 0.892857
## auc 0.839198 0.037756 0.799962 0.869767 0.888095 0.822830
## err 0.108031 0.021824 0.104762 0.119171 0.134078 0.107143
## err_count 20.400000 4.827007 22.000000 23.000000 24.000000 21.000000
## f0point5 0.916621 0.018093 0.923400 0.912596 0.890151 0.916955
## cv_5_valid
## accuracy 0.925000
## auc 0.815336
## err 0.075000
## err_count 12.000000
## f0point5 0.940000
##
## ---
## mean sd cv_1_valid cv_2_valid cv_3_valid
## precision 0.903557 0.020926 0.911917 0.904459 0.870370
## r2 0.298479 0.082610 0.233869 0.380535 0.352050
## recall 0.973325 0.016850 0.972376 0.946667 0.979167
## residual_deviance 124.732500 19.594534 135.183650 140.042500 124.069130
## rmse 0.307598 0.016599 0.301975 0.327515 0.319252
## specificity 0.467739 0.109148 0.413793 0.651163 0.400000
## cv_4_valid cv_5_valid
## precision 0.903409 0.927632
## r2 0.337128 0.188814
## recall 0.975460 0.992958
## residual_deviance 133.121260 91.245960
## rmse 0.304656 0.284591
## specificity 0.484849 0.388889
?h2o.getModel
?h2o.saveModel
?h2o.loadModel
model <- h2o.getModel("StackedEnsemble_BestOfFamily_2_AutoML_2_20250422_121303")
model_path <- h2o.saveModel(object = model, path = "h2o_models/", force = TRUE)
best_model <- h2o.loadModel(model_path)
predictions <- h2o.predict(best_model, newdata = test_h2o)
## | | | 0% | |======================================================================| 100%
predictions_tbl <- predictions %>%
as_tibble()
predictions_tbl %>%
bind_cols(test_tbl)
## # A tibble: 369 × 35
## predict Left No Age Attrition BusinessTravel DailyRate Department
## <fct> <dbl> <dbl> <dbl> <fct> <fct> <dbl> <fct>
## 1 No 0.510 0.490 41 Left Travel_Rarely 1102 Sales
## 2 No 0.0177 0.982 49 No Travel_Frequently 279 Research &…
## 3 No 0.359 0.641 33 No Travel_Frequently 1392 Research &…
## 4 No 0.204 0.796 59 No Travel_Rarely 1324 Research &…
## 5 No 0.0531 0.947 38 No Travel_Frequently 216 Research &…
## 6 No 0.318 0.682 29 No Travel_Rarely 153 Research &…
## 7 No 0.0349 0.965 34 No Travel_Rarely 1346 Research &…
## 8 Left 0.901 0.0990 28 Left Travel_Rarely 103 Research &…
## 9 No 0.337 0.663 22 No Non-Travel 1123 Research &…
## 10 No 0.0222 0.978 53 No Travel_Rarely 1219 Sales
## # ℹ 359 more rows
## # ℹ 27 more variables: DistanceFromHome <dbl>, Education <dbl>,
## # EducationField <fct>, EmployeeNumber <dbl>, EnvironmentSatisfaction <dbl>,
## # Gender <fct>, HourlyRate <dbl>, JobInvolvement <dbl>, JobLevel <dbl>,
## # JobRole <fct>, JobSatisfaction <dbl>, MaritalStatus <fct>,
## # MonthlyIncome <dbl>, MonthlyRate <dbl>, NumCompaniesWorked <dbl>,
## # OverTime <fct>, PercentSalaryHike <dbl>, PerformanceRating <dbl>, …
?h2o.performance
performance_h2o <- h2o.performance(best_model, newdata = test_h2o)
typeof(performance_h2o)
## [1] "S4"
slotNames(performance_h2o)
## [1] "algorithm" "on_train" "on_valid" "on_xval" "metrics"
performance_h2o@metrics
## $model
## $model$`__meta`
## $model$`__meta`$schema_version
## [1] 3
##
## $model$`__meta`$schema_name
## [1] "ModelKeyV3"
##
## $model$`__meta`$schema_type
## [1] "Key<Model>"
##
##
## $model$name
## [1] "StackedEnsemble_BestOfFamily_2_AutoML_2_20250422_121303"
##
## $model$type
## [1] "Key<Model>"
##
## $model$URL
## [1] "/3/Models/StackedEnsemble_BestOfFamily_2_AutoML_2_20250422_121303"
##
##
## $model_checksum
## [1] "2553004402731027456"
##
## $frame
## $frame$name
## [1] "test_tbl_sid_a921_3"
##
##
## $frame_checksum
## [1] "-54192601206779456"
##
## $description
## NULL
##
## $scoring_time
## [1] 1.745453e+12
##
## $predictions
## NULL
##
## $MSE
## [1] 0.09414572
##
## $RMSE
## [1] 0.3068317
##
## $nobs
## [1] 369
##
## $custom_metric_name
## NULL
##
## $custom_metric_value
## [1] 0
##
## $r2
## [1] 0.3085774
##
## $logloss
## [1] 0.3241037
##
## $AUC
## [1] 0.8283172
##
## $pr_auc
## [1] 0.9504244
##
## $Gini
## [1] 0.6566343
##
## $mean_per_class_error
## [1] 0.2677994
##
## $domain
## [1] "Left" "No"
##
## $cm
## $cm$`__meta`
## $cm$`__meta`$schema_version
## [1] 3
##
## $cm$`__meta`$schema_name
## [1] "ConfusionMatrixV3"
##
## $cm$`__meta`$schema_type
## [1] "ConfusionMatrix"
##
##
## $cm$table
## Confusion Matrix: Row labels: Actual class; Column labels: Predicted class
## Left No Error Rate
## Left 30 30 0.5000 = 30 / 60
## No 11 298 0.0356 = 11 / 309
## Totals 41 328 0.1111 = 41 / 369
##
##
## $thresholds_and_metric_scores
## Metrics for Thresholds: Binomial metrics as a function of classification thresholds
## threshold f1 f2 f0point5 accuracy precision recall specificity
## 1 0.996628 0.006452 0.004042 0.015974 0.165312 1.000000 0.003236 1.000000
## 2 0.996550 0.012862 0.008078 0.031546 0.168022 1.000000 0.006472 1.000000
## 3 0.996400 0.019231 0.012107 0.046729 0.170732 1.000000 0.009709 1.000000
## 4 0.995127 0.025559 0.016129 0.061538 0.173442 1.000000 0.012945 1.000000
## 5 0.994630 0.031847 0.020145 0.075988 0.176152 1.000000 0.016181 1.000000
## absolute_mcc min_per_class_accuracy mean_per_class_accuracy tns fns fps tps
## 1 0.022971 0.003236 0.501618 60 308 0 1
## 2 0.032530 0.006472 0.503236 60 307 0 2
## 3 0.039895 0.009709 0.504854 60 306 0 3
## 4 0.046130 0.012945 0.506472 60 305 0 4
## 5 0.051645 0.016181 0.508091 60 304 0 5
## tnr fnr fpr tpr idx
## 1 1.000000 0.996764 0.000000 0.003236 0
## 2 1.000000 0.993528 0.000000 0.006472 1
## 3 1.000000 0.990291 0.000000 0.009709 2
## 4 1.000000 0.987055 0.000000 0.012945 3
## 5 1.000000 0.983819 0.000000 0.016181 4
##
## ---
## threshold f1 f2 f0point5 accuracy precision recall
## 364 0.195339 0.918276 0.965625 0.875354 0.850949 0.848901 1.000000
## 365 0.192739 0.916914 0.965022 0.873375 0.848238 0.846575 1.000000
## 366 0.151425 0.915556 0.964419 0.871404 0.845528 0.844262 1.000000
## 367 0.099002 0.914201 0.963818 0.869443 0.842818 0.841962 1.000000
## 368 0.092206 0.912851 0.963217 0.867490 0.840108 0.839674 1.000000
## 369 0.046577 0.911504 0.962617 0.865546 0.837398 0.837398 1.000000
## specificity absolute_mcc min_per_class_accuracy mean_per_class_accuracy tns
## 364 0.083333 0.265973 0.083333 0.541667 5
## 365 0.066667 0.237568 0.066667 0.533333 4
## 366 0.050000 0.205458 0.050000 0.525000 3
## 367 0.033333 0.167527 0.033333 0.516667 2
## 368 0.016667 0.118299 0.016667 0.508333 1
## 369 0.000000 0.000000 0.000000 0.500000 0
## fns fps tps tnr fnr fpr tpr idx
## 364 0 55 309 0.083333 0.000000 0.916667 1.000000 363
## 365 0 56 309 0.066667 0.000000 0.933333 1.000000 364
## 366 0 57 309 0.050000 0.000000 0.950000 1.000000 365
## 367 0 58 309 0.033333 0.000000 0.966667 1.000000 366
## 368 0 59 309 0.016667 0.000000 0.983333 1.000000 367
## 369 0 60 309 0.000000 0.000000 1.000000 1.000000 368
##
## $max_criteria_and_metric_scores
## Maximum Metrics: Maximum metrics at their respective thresholds
## metric threshold value idx
## 1 max f1 0.558664 0.935636 327
## 2 max f2 0.272902 0.969260 357
## 3 max f0point5 0.579639 0.919826 324
## 4 max accuracy 0.558664 0.888889 327
## 5 max precision 0.996628 1.000000 0
## 6 max recall 0.272902 1.000000 357
## 7 max specificity 0.996628 1.000000 0
## 8 max absolute_mcc 0.558664 0.545280 327
## 9 max min_per_class_accuracy 0.835161 0.766667 250
## 10 max mean_per_class_accuracy 0.829362 0.770065 252
## 11 max tns 0.996628 60.000000 0
## 12 max fns 0.996628 308.000000 0
## 13 max fps 0.046577 60.000000 368
## 14 max tps 0.272902 309.000000 357
## 15 max tnr 0.996628 1.000000 0
## 16 max fnr 0.996628 0.996764 0
## 17 max fpr 0.046577 1.000000 368
## 18 max tpr 0.272902 1.000000 357
##
## $gains_lift_table
## Gains/Lift Table: Avg response rate: 83.74 %, avg score: 83.04 %
## group cumulative_data_fraction lower_threshold lift cumulative_lift
## 1 1 0.01084011 0.994789 1.194175 1.194175
## 2 2 0.02168022 0.993394 1.194175 1.194175
## 3 3 0.03252033 0.992820 1.194175 1.194175
## 4 4 0.04065041 0.991366 1.194175 1.194175
## 5 5 0.05149051 0.990624 1.194175 1.194175
## 6 6 0.10027100 0.985145 1.127832 1.161900
## 7 7 0.15176152 0.980467 1.131323 1.151526
## 8 8 0.20054201 0.975479 1.127832 1.145762
## 9 9 0.30081301 0.961188 1.129625 1.140383
## 10 10 0.40108401 0.941455 1.161900 1.145762
## 11 11 0.50135501 0.919741 1.129625 1.142535
## 12 12 0.59891599 0.876693 1.061489 1.129333
## 13 13 0.69918699 0.823749 1.065075 1.120117
## 14 14 0.79945799 0.717122 0.935975 1.097022
## 15 15 0.89972900 0.496993 0.903700 1.075477
## 16 16 1.00000000 0.046577 0.322750 1.000000
## response_rate score cumulative_response_rate cumulative_score
## 1 1.000000 0.996176 1.000000 0.996176
## 2 1.000000 0.994222 1.000000 0.995199
## 3 1.000000 0.993144 1.000000 0.994514
## 4 1.000000 0.991980 1.000000 0.994007
## 5 1.000000 0.990895 1.000000 0.993352
## 6 0.944444 0.988115 0.972973 0.990804
## 7 0.947368 0.983000 0.964286 0.988156
## 8 0.944444 0.978004 0.959459 0.985687
## 9 0.945946 0.968936 0.954955 0.980103
## 10 0.972973 0.951093 0.959459 0.972851
## 11 0.945946 0.932131 0.956757 0.964707
## 12 0.888889 0.897836 0.945701 0.953814
## 13 0.891892 0.851408 0.937984 0.939128
## 14 0.783784 0.777306 0.918644 0.918831
## 15 0.756757 0.636025 0.900602 0.887314
## 16 0.270270 0.319751 0.837398 0.830404
## capture_rate cumulative_capture_rate gain cumulative_gain
## 1 0.012945 0.012945 19.417476 19.417476
## 2 0.012945 0.025890 19.417476 19.417476
## 3 0.012945 0.038835 19.417476 19.417476
## 4 0.009709 0.048544 19.417476 19.417476
## 5 0.012945 0.061489 19.417476 19.417476
## 6 0.055016 0.116505 12.783172 16.189976
## 7 0.058252 0.174757 13.132345 15.152566
## 8 0.055016 0.229773 12.783172 14.576227
## 9 0.113269 0.343042 12.962477 14.038310
## 10 0.116505 0.459547 16.189976 14.576227
## 11 0.113269 0.572816 12.962477 14.253477
## 12 0.103560 0.676375 6.148867 12.933269
## 13 0.106796 0.783172 6.507478 12.011741
## 14 0.093851 0.877023 -6.402519 9.702156
## 15 0.090615 0.967638 -9.630018 7.547666
## 16 0.032362 1.000000 -67.725007 0.000000
## kolmogorov_smirnov
## 1 0.012945
## 2 0.025890
## 3 0.038835
## 4 0.048544
## 5 0.061489
## 6 0.099838
## 7 0.141424
## 8 0.179773
## 9 0.259709
## 10 0.359547
## 11 0.439482
## 12 0.476375
## 13 0.516505
## 14 0.477023
## 15 0.417638
## 16 0.000000
##
## $residual_deviance
## [1] 239.1885
##
## $null_deviance
## [1] 327.7324
##
## $AIC
## [1] 247.1885
##
## $loglikelihood
## [1] 0
##
## $null_degrees_of_freedom
## [1] 368
##
## $residual_degrees_of_freedom
## [1] 365
h2o.auc(performance_h2o)
## [1] 0.8283172
h2o.confusionMatrix(performance_h2o)
## Confusion Matrix (vertical: actual; across: predicted) for max f1 @ threshold = 0.558663852668478:
## Left No Error Rate
## Left 30 30 0.500000 =30/60
## No 11 298 0.035599 =11/309
## Totals 41 328 0.111111 =41/369