Skip to contents

Gradient boosting machine learner. Class h2o::h2o.gbm() from package h2o.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.h2o.gbm")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “integer”, “numeric”, “factor”

  • Required Packages: mlr3, mlr3extralearners, h2o

Parameters

IdTypeDefaultLevelsRange
auc_typecharacterAUTOAUTO, NONE, MACRO_OVR, WEIGHTED_OVR, MACRO_OVO, WEIGHTED_OVO-
auto_rebalancelogicalTRUETRUE, FALSE-
balance_classeslogicalFALSETRUE, FALSE-
build_tree_one_nodelogicalFALSETRUE, FALSE-
categorical_encodingcharacterAUTOAUTO, Enum, OneHotInternal, OneHotExplicit, Binary, Eigen, LabelEncoder, SortByResponse, EnumLimited-
check_constant_responselogicalTRUETRUE, FALSE-
checkpointuntypedNULL-
class_sampling_factorsuntypedNULL-
col_sample_ratenumeric1\([0, 1]\)
col_sample_rate_change_per_levelnumeric1\([0, 2]\)
col_sample_rate_per_treenumeric1\([0, 1]\)
export_checkpoints_diruntypedNULL-
gainslift_binsinteger-1\([-1, \infty)\)
histogram_typecharacterAUTOAUTO, UniformAdaptive, Random, QuantilesGlobal, RoundRobin, UniformRobust-
ignore_const_colslogicalTRUETRUE, FALSE-
in_training_checkpoints_diruntypedNULL-
in_training_checkpoints_tree_intervalinteger1\([1, \infty)\)
interaction_constraintsuntypedNULL-
learn_ratenumeric0.1\([0, 1]\)
learn_rate_annealingnumeric1\([0, 1]\)
max_abs_leafnode_prednumericInf\([0, \infty)\)
max_after_balance_sizenumeric5\((-\infty, \infty)\)
max_depthinteger5\([1, \infty)\)
max_runtime_secsnumeric0\([0, \infty)\)
min_rowsinteger10\([1, \infty)\)
min_split_improvementnumeric1e-05\([0, \infty)\)
monotone_constraintsuntypedNULL-
nbinsinteger20\([1, \infty)\)
nbins_catsinteger1024\([1, \infty)\)
nbins_top_levelinteger1024\([1, \infty)\)
ntreesinteger50\([1, \infty)\)
pred_noise_bandwidthnumeric0\([0, \infty)\)
sample_ratenumeric1\([0, 1]\)
sample_rate_per_classuntypedNULL-
score_each_iterationlogicalFALSETRUE, FALSE-
score_tree_intervalinteger0\([0, \infty)\)
seedinteger-1\((-\infty, \infty)\)
stopping_metriccharacterAUTOAUTO, logloss, AUC, AUCPR, lift_top_group, misclassification, mean_per_class_error-
stopping_roundsinteger0\([0, \infty)\)
stopping_tolerancenumeric0.001\([0, \infty)\)
verboselogicalFALSETRUE, 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

Author

awinterstetter

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifH2OGBM

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifH2OGBM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("classif.h2o.gbm")
print(learner)
#> 
#> ── <LearnerClassifH2OGBM> (classif.h2o.gbm): H2O GBM ───────────────────────────
#> • Model: -
#> • Parameters: list()
#> • 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'

# 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)

print(learner$model)
#> Model Details:
#> ==============
#> 
#> H2OBinomialModel: gbm
#> Model ID:  GBM_model_R_1774260318250_4 
#> Model Summary: 
#>   number_of_trees number_of_internal_trees model_size_in_bytes min_depth
#> 1              50                       50                9182         4
#>   max_depth mean_depth min_leaves max_leaves mean_leaves
#> 1         5    4.96000          8         12    10.02000
#> 
#> 
#> H2OBinomialMetrics: gbm
#> ** Reported on training data. **
#> 
#> MSE:  0.0008694279
#> RMSE:  0.02948606
#> LogLoss:  0.02547061
#> Mean Per-Class Error:  0
#> AUC:  1
#> AUCPR:  1
#> Gini:  1
#> R^2:  0.9964813
#> 
#> Confusion Matrix (vertical: actual; across: predicted) for F1-optimal threshold:
#>         M  R    Error    Rate
#> M      77  0 0.000000   =0/77
#> R       0 62 0.000000   =0/62
#> Totals 77 62 0.000000  =0/139
#> 
#> Maximum Metrics: Maximum metrics at their respective thresholds
#>                         metric threshold     value idx
#> 1                       max f1  0.921245  1.000000  61
#> 2                       max f2  0.921245  1.000000  61
#> 3                 max f0point5  0.921245  1.000000  61
#> 4                 max accuracy  0.921245  1.000000  61
#> 5                max precision  0.993763  1.000000   0
#> 6                   max recall  0.921245  1.000000  61
#> 7              max specificity  0.993763  1.000000   0
#> 8             max absolute_mcc  0.921245  1.000000  61
#> 9   max min_per_class_accuracy  0.921245  1.000000  61
#> 10 max mean_per_class_accuracy  0.921245  1.000000  61
#> 11                     max tns  0.993763 77.000000   0
#> 12                     max fns  0.993763 61.000000   0
#> 13                     max fps  0.006642 77.000000 138
#> 14                     max tps  0.921245 62.000000  61
#> 15                     max tnr  0.993763  1.000000   0
#> 16                     max fnr  0.993763  0.983871   0
#> 17                     max fpr  0.006642  1.000000 138
#> 18                     max tpr  0.921245  1.000000  61
#> 
#> 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.2463768