Classification H2O Deep Learning Learner
Source:R/learner_h2o_classif_deeplearning.R
mlr_learners_classif.h2o.deeplearning.RdClassification feed-forward multilayer artificial neural network learner.
Class h2o::h2o.deeplearning() from package h2o.
Meta Information
Task type: “classif”
Predict Types: “response”, “prob”
Feature Types: “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3extralearners, h2o
Parameters
| Id | Type | Default | Levels | Range |
| activation | character | Rectifier | Rectifier, Tanh, TanhWithDropout, RectifierWithDropout, Maxout, MaxoutWithDropout | - |
| adaptive_rate | logical | TRUE | TRUE, FALSE | - |
| auc_type | character | AUTO | AUTO, NONE, MACRO_OVR, WEIGHTED_OVR, MACRO_OVO, WEIGHTED_OVO | - |
| autoencoder | logical | FALSE | TRUE, FALSE | - |
| average_activation | numeric | 0 | \((-\infty, \infty)\) | |
| balance_classes | logical | FALSE | TRUE, FALSE | - |
| categorical_encoding | character | AUTO | AUTO, Enum, OneHotInternal, OneHotExplicit, Binary, Eigen, LabelEncoder, SortByResponse, EnumLimited | - |
| checkpoint | untyped | NULL | - | |
| class_sampling_factors | untyped | NULL | - | |
| classification_stop | numeric | 0 | \([-1, \infty)\) | |
| diagnostics | logical | TRUE | TRUE, FALSE | - |
| distribution | character | AUTO | AUTO, bernoulli, multinomial | - |
| elastic_averaging | logical | FALSE | TRUE, FALSE | - |
| elastic_averaging_moving_rate | numeric | 0.9 | \((-\infty, \infty)\) | |
| elastic_averaging_regularization | numeric | 0.001 | \((-\infty, \infty)\) | |
| epochs | numeric | 10 | \([1, \infty)\) | |
| epsilon | numeric | 1e-08 | \([1e-10, 1e-04]\) | |
| export_checkpoints_dir | untyped | NULL | - | |
| export_weights_and_biases | logical | FALSE | TRUE, FALSE | - |
| fast_mode | logical | TRUE | TRUE, FALSE | - |
| force_load_balance | logical | TRUE | TRUE, FALSE | - |
| gainslift_bins | integer | -1 | \([-1, \infty)\) | |
| hidden | untyped | c(200L, 200L) | - | |
| hidden_dropout_ratios | numeric | 0.5 | \((-\infty, \infty)\) | |
| ignore_const_cols | logical | TRUE | TRUE, FALSE | - |
| initial_weight_distribution | character | UniformAdaptive | UniformAdaptive, Uniform, Normal | - |
| initial_weight_scale | numeric | 1 | \((-\infty, \infty)\) | |
| input_dropout_ratio | numeric | 0 | \((-\infty, \infty)\) | |
| l1 | numeric | 0 | \((-\infty, \infty)\) | |
| l2 | numeric | 0 | \((-\infty, \infty)\) | |
| loss | character | Automatic | Automatic, CrossEntropy, Quadratic | - |
| max_after_balance_size | numeric | 5 | \((-\infty, \infty)\) | |
| max_categorical_features | integer | NULL | \((-\infty, \infty)\) | |
| max_runtime_secs | numeric | 0 | \([0, \infty)\) | |
| max_w2 | numeric | 3.402823e+38 | \((-\infty, \infty)\) | |
| mini_batch_size | integer | 1 | \((-\infty, \infty)\) | |
| missing_values_handling | character | MeanImputation | MeanImputation, Skip | - |
| momentum_ramp | numeric | 1e+06 | \((-\infty, \infty)\) | |
| momentum_stable | numeric | 0 | \((-\infty, \infty)\) | |
| momentum_start | numeric | 0 | \((-\infty, \infty)\) | |
| nesterov_accelerated_gradient | logical | TRUE | TRUE, FALSE | - |
| overwrite_with_best_model | logical | TRUE | TRUE, FALSE | - |
| pretrained_autoencoder | untyped | NULL | - | |
| quiet_mode | logical | TRUE | TRUE, FALSE | - |
| rate | numeric | 0.005 | \([0, 1]\) | |
| rate_annealing | numeric | 1e-06 | \([0, \infty)\) | |
| rate_decay | numeric | 1 | \([0, \infty)\) | |
| replicate_training_data | logical | TRUE | TRUE, FALSE | - |
| reproducible | logical | FALSE | TRUE, FALSE | - |
| rho | numeric | 0.99 | \([0, \infty)\) | |
| score_duty_cycle | numeric | 0.1 | \((-\infty, \infty)\) | |
| score_each_iteration | logical | FALSE | TRUE, FALSE | - |
| score_interval | numeric | 5 | \((-\infty, \infty)\) | |
| score_training_samples | integer | 10000 | \((-\infty, \infty)\) | |
| score_validation_samples | integer | 0 | \((-\infty, \infty)\) | |
| score_validation_sampling | character | Uniform | Uniform, Stratified | - |
| seed | integer | -1 | \((-\infty, \infty)\) | |
| shuffle_training_data | logical | FALSE | TRUE, FALSE | - |
| single_node_mode | logical | FALSE | TRUE, FALSE | - |
| sparse | logical | FALSE | TRUE, FALSE | - |
| sparsity_beta | numeric | 0 | \((-\infty, \infty)\) | |
| standardize | logical | TRUE | TRUE, FALSE | - |
| stopping_metric | character | AUTO | AUTO, logloss, AUC, lift_top_group, misclassification, AUCPR, mean_per_class_error | - |
| stopping_rounds | integer | 5 | \([0, \infty)\) | |
| stopping_tolerance | numeric | 0 | \([0, \infty)\) | |
| target_ratio_comm_to_comp | numeric | 0.05 | \((-\infty, \infty)\) | |
| train_samples_per_iteration | integer | -2 | \([-2, \infty)\) | |
| verbose | logical | FALSE | TRUE, FALSE | - |
References
Fryda T, LeDell E, Gill N, Aiello S, Fu A, Candel A, Click C, Kraljevic T, Nykodym T, Aboyoun P, Kurka M, Malohlava M, Poirier S, Wong W (2025). h2o: R Interface for the 'H2O' Scalable Machine Learning Platform. R package version 3.46.0.9, https://github.com/h2oai/h2o-3.
See also
as.data.table(mlr_learners)for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifH2ODeeplearning
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerClassif$predict_newdata_fast()
Examples
# Define the Learner
learner = lrn("classif.h2o.deeplearning", epochs = 1)
print(learner)
#>
#> ── <LearnerClassifH2ODeeplearning> (classif.h2o.deeplearning): H2O Deep Learning
#> • Model: -
#> • Parameters: epochs=1
#> • Packages: mlr3, mlr3extralearners, and h2o
#> • Predict Types: [response] and prob
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: missings, multiclass, twoclass, and weights
#> • Other settings: use_weights = 'use', predict_raw = 'FALSE'
# Define a Task
task = tsk("sonar")
# Create train and test set
ids = partition(task)
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
#> Warning:
#> Your H2O cluster version is (2 years, 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
print(learner$model)
#> Model Details:
#> ==============
#>
#> H2OBinomialModel: deeplearning
#> Model ID: DeepLearning_model_R_1777020145368_1
#> Status of Neuron Layers: predicting Class, 2-class classification, bernoulli distribution, CrossEntropy loss, 52,802 weights/biases, 632.9 KB, 148 training samples, mini-batch size 1
#> layer units type dropout l1 l2 mean_rate rate_rms momentum
#> 1 1 60 Input 0.00 % NA NA NA NA NA
#> 2 2 200 Rectifier 0.00 % 0.000000 0.000000 0.003481 0.002377 0.000000
#> 3 3 200 Rectifier 0.00 % 0.000000 0.000000 0.010495 0.027080 0.000000
#> 4 4 2 Softmax NA 0.000000 0.000000 0.001119 0.000824 0.000000
#> mean_weight weight_rms mean_bias bias_rms
#> 1 NA NA NA NA
#> 2 0.000417 0.091030 0.497942 0.004800
#> 3 -0.000619 0.069927 0.998990 0.003438
#> 4 -0.025706 0.392462 -0.000000 0.001642
#>
#>
#> H2OBinomialMetrics: deeplearning
#> ** Reported on training data. **
#> ** Metrics reported on full training frame **
#>
#> MSE: 0.131622
#> RMSE: 0.3627974
#> LogLoss: 0.5269645
#> Mean Per-Class Error: 0.1472574
#> AUC: 0.9267932
#> AUCPR: 0.9086081
#> Gini: 0.8535865
#>
#> Confusion Matrix (vertical: actual; across: predicted) for F1-optimal threshold:
#> M R Error Rate
#> M 61 18 0.227848 =18/79
#> R 4 56 0.066667 =4/60
#> Totals 65 74 0.158273 =22/139
#>
#> Maximum Metrics: Maximum metrics at their respective thresholds
#> metric threshold value idx
#> 1 max f1 0.035785 0.835821 73
#> 2 max f2 0.011633 0.906250 79
#> 3 max f0point5 0.945666 0.833333 38
#> 4 max accuracy 0.189988 0.848921 66
#> 5 max precision 1.000000 1.000000 0
#> 6 max recall 0.000052 1.000000 107
#> 7 max specificity 1.000000 1.000000 0
#> 8 max absolute_mcc 0.035785 0.700333 73
#> 9 max min_per_class_accuracy 0.301166 0.833333 61
#> 10 max mean_per_class_accuracy 0.189988 0.853059 66
#> 11 max tns 1.000000 79.000000 0
#> 12 max fns 1.000000 59.000000 0
#> 13 max fps 0.000000 79.000000 138
#> 14 max tps 0.000052 60.000000 107
#> 15 max tnr 1.000000 1.000000 0
#> 16 max fnr 1.000000 0.983333 0
#> 17 max fpr 0.000000 1.000000 138
#> 18 max tpr 0.000052 1.000000 107
#>
#> Gains/Lift Table: Extract with `h2o.gainsLift(<model>, <data>)` or `h2o.gainsLift(<model>, valid=<T/F>, xval=<T/F>)`
#>
#>
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.173913