Skip to main content

`random_columns`

  • Available in: HGLM
  • Hyperparameter: yes

Description​

Hierarchical GLM (HGLM) fits generalized linear models with random effects, where the random effect can come from a conjugate exponential-family distribution (for example, Gaussian). The random_columns option specifies an array of random column indices to use in GLM when HGLM=True.

Example​

library(h2o)
h2o.init()

# Import the semiconductor dataset
h2odata <- h2o.importFile("https://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/semiconductor.csv")

# Set the response, predictor, and random columns
yresp <- "y"
xlist <- c("x1", "x3", "x5", "x6")
z <- c(1)

# Convert the "Device" column to a factor
h2odata$Device <- h2o.asfactor(h2odata$Device)

# Train and view the model
h2o_glm <- h2o.glm(x = xlist,
y = yresp,
family = "gaussian",
rand_family = c("gaussian"),
rand_link = c("identity"),
training_frame = h2odata,
HGLM = TRUE,
random_columns = z,
calc_like = TRUE)
print(h2o_glm)

Feedback