Fits a HGLM model with both the residual noise and random effect being modeled by Gaussian distribution. The fixed effect coefficients are specified in parameter x, the random effect coefficients are specified in parameter random_columns. The column specified in group_column will contain the level 2 index value and must be an enum column.

h2o.hglm(
  x,
  y,
  training_frame,
  random_columns,
  group_column,
  model_id = NULL,
  validation_frame = NULL,
  ignore_const_cols = TRUE,
  offset_column = NULL,
  weights_column = NULL,
  max_runtime_secs = 0,
  custom_metric_func = NULL,
  score_each_iteration = FALSE,
  score_iteration_interval = 5,
  seed = -1,
  missing_values_handling = c("MeanImputation", "Skip", "PlugValues"),
  plug_values = NULL,
  family = c("gaussian"),
  rand_family = c("gaussian"),
  max_iterations = -1,
  initial_fixed_effects = NULL,
  initial_random_effects = NULL,
  initial_t_matrix = NULL,
  tau_u_var_init = 0,
  tau_e_var_init = 0,
  method = c("EM"),
  em_epsilon = 0.001,
  random_intercept = TRUE,
  gen_syn_data = FALSE
)

Arguments

x

(Optional) A vector containing the names or indices of the predictor variables to use in building the model. If x is missing, then all columns except y are used.

y

The name or column index of the response variable in the data. The response must be either a numeric or a categorical/factor variable. If the response is numeric, then a regression model will be trained, otherwise it will train a classification model.

training_frame

Id of the training data frame.

random_columns

Random columns indices for HGLM.

group_column

Group column is the column that is categorical and used to generate the groups in HGLM

model_id

Destination id for this model; auto-generated if not specified.

validation_frame

Id of the validation data frame.

ignore_const_cols

Logical. Ignore constant columns. Defaults to TRUE.

offset_column

Offset column. This will be added to the combination of columns before applying the link function.

weights_column

Column with observation weights. Giving some observation a weight of zero is equivalent to excluding it from the dataset; giving an observation a relative weight of 2 is equivalent to repeating that row twice. Negative weights are not allowed. Note: Weights are per-row observation weights and do not increase the size of the data frame. This is typically the number of times a row is repeated, but non-integer values are supported as well. During training, rows with higher weights matter more, due to the larger loss function pre-factor. If you set weight = 0 for a row, the returned prediction frame at that row is zero and this is incorrect. To get an accurate prediction, remove all rows with weight == 0.

max_runtime_secs

Maximum allowed runtime in seconds for model training. Use 0 to disable. Defaults to 0.

custom_metric_func

Reference to custom evaluation function, format: `language:keyName=funcName`

score_each_iteration

Logical. Whether to score during each iteration of model training. Defaults to FALSE.

score_iteration_interval

Perform scoring for every score_iteration_interval iterations. Defaults to 5.

seed

Seed for random numbers (affects certain parts of the algo that are stochastic and those might or might not be enabled by default). Defaults to -1 (time-based random number).

missing_values_handling

Handling of missing values. Either MeanImputation, Skip or PlugValues. Must be one of: "MeanImputation", "Skip", "PlugValues". Defaults to MeanImputation.

plug_values

Plug Values (a single row frame containing values that will be used to impute missing values of the training/validation frame, use with conjunction missing_values_handling = PlugValues).

family

Family. Only gaussian is supported now. Must be one of: "gaussian". Defaults to gaussian.

rand_family

Set distribution of random effects. Only Gaussian is implemented now. Must be one of: "gaussian".

max_iterations

Maximum number of iterations. Value should >=1. A value of 0 is only set when only the model coefficient names and model coefficient dimensions are needed. Defaults to -1.

initial_fixed_effects

An array that contains initial values of the fixed effects coefficient.

initial_random_effects

A H2OFrame id that contains initial values of the random effects coefficient. The row names shouldbe the random coefficient names. If you are not sure what the random coefficient names are, build HGLM model with max_iterations = 0 and checkout the model output field random_coefficient_names. The number of rows of this frame should be the number of level 2 units. Again, to figure this out, build HGLM model with max_iterations=0 and check out the model output field group_column_names. The number of rows should equal the length of thegroup_column_names.

initial_t_matrix

A H2OFrame id that contains initial values of the T matrix. It should be a positive symmetric matrix.

tau_u_var_init

Initial variance of random coefficient effects. If set, should provide a value > 0.0. If not set, will be randomly set in the model building process. Defaults to 0.

tau_e_var_init

Initial variance of random noise. If set, should provide a value > 0.0. If not set, will be randomly set in the model building process. Defaults to 0.

method

We only implemented EM as a method to obtain the fixed, random coefficients and the various variances. Must be one of: "EM". Defaults to EM.

em_epsilon

Converge if beta/ubeta/tmat/tauEVar changes less (using L-infinity norm) than em esilon. ONLY applies to EM method. Defaults to 0.001.

random_intercept

Logical. If true, will allow random component to the GLM coefficients. Defaults to TRUE.

gen_syn_data

Logical. If true, add gaussian noise with variance specified in parms._tau_e_var_init. Defaults to FALSE.

Examples