Skip to contents

Generalized linear model. Calls h2o::h2o.glm() from package h2o.

H2O Connection

If no running H2O connection is found, the learner will automatically start a local H2O server on 127.0.0.1 via h2o::h2o.init(). If you want to connect to a remote H2O cluster, call h2o::h2o.init() with the appropriate arguments before training or predicting.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.h2o.glm")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”

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

  • Required Packages: mlr3, mlr3extralearners, h2o

Parameters

IdTypeDefaultLevelsRange
alphanumeric0.5\([0, 1]\)
beta_constraintsuntypedNULL-
beta_epsilonnumeric1e-04\([0, \infty)\)
build_null_modellogicalFALSETRUE, FALSE-
calc_likelogicalFALSETRUE, FALSE-
checkpointuntypedNULL-
cold_startlogicalFALSETRUE, FALSE-
compute_p_valueslogicalFALSETRUE, FALSE-
early_stoppinglogicalTRUETRUE, FALSE-
export_checkpoints_diruntypedNULL-
generate_scoring_historylogicalFALSETRUE, FALSE-
generate_variable_inflation_factorslogicalFALSETRUE, FALSE-
gradient_epsilonnumeric-1\([0, \infty)\)
HGLMlogicalFALSETRUE, FALSE-
ignore_const_colslogicalTRUETRUE, FALSE-
interactionsuntypedNULL-
interaction_pairsuntypedNULL-
interceptlogicalTRUETRUE, FALSE-
lambdanumeric1e-05\([0, \infty)\)
lambda_min_rationumeric-1\([0, 1]\)
lambda_searchlogicalFALSETRUE, FALSE-
linkcharacterfamily_defaultfamily_default, identity, log, inverse-
max_active_predictorsinteger-1\([1, \infty)\)
max_iterationsinteger-1\([0, \infty)\)
max_runtime_secsnumeric0\([0, \infty)\)
missing_values_handlingcharacterMeanImputationMeanImputation, Skip, PlugValues-
nlambdasinteger-1\([1, \infty)\)
non_negativelogicalFALSETRUE, FALSE-
objective_epsilonnumeric-1\([0, \infty)\)
obj_regnumeric-1\([0, \infty)\)
plug_valuesuntypedNULL-
random_columnsuntypedNULL-
rand_familyuntypedNULL-
rand_linkuntypedNULL-
remove_collinear_columnslogicalFALSETRUE, FALSE-
score_each_iterationlogicalFALSETRUE, FALSE-
score_iteration_intervalinteger-1\((-\infty, \infty)\)
seedinteger-1\((-\infty, \infty)\)
solvercharacterAUTOAUTO, IRLSM, L_BFGS, COORDINATE_DESCENT_NAIVE, COORDINATE_DESCENT, GRADIENT_DESCENT_LH, GRADIENT_DESCENT_SQERR-
standardizelogicalTRUETRUE, FALSE-
startvaluntypedNULL-
stopping_metriccharacterAUTOAUTO, deviance, MSE, RMSE, MAE, RMSLE-
stopping_roundsinteger0\([0, \infty)\)
stopping_tolerancenumeric0.001\([0, \infty)\)

Model family

This learner calls h2o::h2o.glm() with family = "gaussian"

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::LearnerRegr -> LearnerRegrH2OGLM

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

LearnerRegrH2OGLM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("regr.h2o.glm")
print(learner)
#> 
#> ── <LearnerRegrH2OGLM> (regr.h2o.glm): H2O Generalized Linear Model ────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3extralearners, and h2o
#> • Predict Types: [response]
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: missings and weights
#> • Other settings: use_weights = 'use'

# Define a Task
task = tsk("mtcars")

# 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:
#> ==============
#> 
#> H2ORegressionModel: glm
#> Model ID:  GLM_model_R_1774260318250_111 
#> GLM Model: summary
#>     family     link                             regularization
#> 1 gaussian identity Elastic Net (alpha = 0.5, lambda = 1.011 )
#>   number_of_predictors_total number_of_active_predictors number_of_iterations
#> 1                         10                           9                    1
#>     training_frame
#> 1 data_sid_bb94_31
#> 
#> Coefficients: glm coefficients
#>        names coefficients standardized_coefficients
#> 1  Intercept    25.875194                 19.452381
#> 2         am     0.452071                  0.224957
#> 3       carb    -0.361820                 -0.487354
#> 4        cyl    -0.388544                 -0.721439
#> 5       disp    -0.006083                 -0.799639
#> 6       drat     0.567687                  0.272424
#> 7       gear     0.382766                  0.283252
#> 8         hp    -0.013244                 -0.806423
#> 9       qsec     0.000000                  0.000000
#> 10        vs     1.318839                  0.656272
#> 11        wt    -1.035801                 -1.117914
#> 
#> H2ORegressionMetrics: glm
#> ** Reported on training data. **
#> 
#> MSE:  6.38529
#> RMSE:  2.526913
#> MAE:  1.884107
#> RMSLE:  0.1176407
#> Mean Residual Deviance :  6.38529
#> R^2 :  0.8213482
#> Null Deviance :750.5724
#> Null D.o.F. :20
#> Residual Deviance :134.0911
#> Residual D.o.F. :11
#> AIC :120.5294
#> 
#> 
#> 
#> 


# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> regr.mse 
#> 8.015602