Creates a generalized additive model, specified by a response variable, a set of predictors, and a description of the error distribution.
h2o.gam( x, y, training_frame, gam_columns, model_id = NULL, validation_frame = NULL, nfolds = 0, seed = 1, keep_cross_validation_models = TRUE, keep_cross_validation_predictions = FALSE, keep_cross_validation_fold_assignment = FALSE, fold_assignment = c("AUTO", "Random", "Modulo", "Stratified"), fold_column = NULL, ignore_const_cols = TRUE, score_each_iteration = FALSE, offset_column = NULL, weights_column = NULL, family = c("AUTO", "gaussian", "binomial", "quasibinomial", "ordinal", "multinomial", "poisson", "gamma", "tweedie", "negativebinomial", "fractionalbinomial"), tweedie_variance_power = 0, tweedie_link_power = 0, theta = 0, solver = c("AUTO", "IRLSM", "L_BFGS", "COORDINATE_DESCENT_NAIVE", "COORDINATE_DESCENT", "GRADIENT_DESCENT_LH", "GRADIENT_DESCENT_SQERR"), alpha = NULL, lambda = NULL, lambda_search = FALSE, early_stopping = TRUE, nlambdas = 1, standardize = FALSE, missing_values_handling = c("MeanImputation", "Skip", "PlugValues"), plug_values = NULL, compute_p_values = FALSE, remove_collinear_columns = FALSE, splines_non_negative = NULL, intercept = TRUE, non_negative = FALSE, max_iterations = 1, objective_epsilon = 1, beta_epsilon = 1e04, gradient_epsilon = 1, link = c("family_default", "identity", "logit", "log", "inverse", "tweedie", "ologit"), startval = NULL, prior = 1, cold_start = FALSE, lambda_min_ratio = 1, beta_constraints = NULL, max_active_predictors = 1, interactions = NULL, interaction_pairs = NULL, obj_reg = 1, export_checkpoints_dir = NULL, stopping_rounds = 0, stopping_metric = c("AUTO", "deviance", "logloss", "MSE", "RMSE", "MAE", "RMSLE", "AUC", "AUCPR", "lift_top_group", "misclassification", "mean_per_class_error", "custom", "custom_increasing"), stopping_tolerance = 0.001, balance_classes = FALSE, class_sampling_factors = NULL, max_after_balance_size = 5, max_runtime_secs = 0, num_knots = NULL, spline_orders = NULL, knot_ids = NULL, standardize_tp_gam_cols = FALSE, scale_tp_penalty_mat = FALSE, bs = NULL, scale = NULL, keep_gam_cols = FALSE, store_knot_locations = FALSE, auc_type = c("AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO", "WEIGHTED_OVO"), gainslift_bins = 1 )
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. 
gam_columns  Arrays of predictor column names for gam for smoothers using single or multiple predictors like {{'c1'},{'c2','c3'},{'c4'},...} 
model_id  Destination id for this model; autogenerated if not specified. 
validation_frame  Id of the validation data frame. 
nfolds  Number of folds for Kfold crossvalidation (0 to disable or >= 2). Defaults to 0. 
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 (timebased random number). 
keep_cross_validation_models 

keep_cross_validation_predictions 

keep_cross_validation_fold_assignment 

fold_assignment  Crossvalidation fold assignment scheme, if fold_column is not specified. The 'Stratified' option will stratify the folds based on the response variable, for classification problems. Must be one of: "AUTO", "Random", "Modulo", "Stratified". Defaults to AUTO. 
fold_column  Column with crossvalidation fold index assignment per observation. 
ignore_const_cols 

score_each_iteration 

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 perrow observation weights and do not increase the size of the data frame. This is typically the number of times a row is repeated, but noninteger values are supported as well. During training, rows with higher weights matter more, due to the larger loss function prefactor. 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. 
family  Family. Use binomial for classification with logistic regression, others are for regression problems. Must be one of: "AUTO", "gaussian", "binomial", "quasibinomial", "ordinal", "multinomial", "poisson", "gamma", "tweedie", "negativebinomial", "fractionalbinomial". Defaults to AUTO. 
tweedie_variance_power  Tweedie variance power Defaults to 0. 
tweedie_link_power  Tweedie link power Defaults to 0. 
theta  Theta Defaults to 0. 
solver  AUTO will set the solver based on given data and the other parameters. IRLSM is fast on on problems with small number of predictors and for lambdasearch with L1 penalty, L_BFGS scales better for datasets with many columns. Must be one of: "AUTO", "IRLSM", "L_BFGS", "COORDINATE_DESCENT_NAIVE", "COORDINATE_DESCENT", "GRADIENT_DESCENT_LH", "GRADIENT_DESCENT_SQERR". Defaults to AUTO. 
alpha  Distribution of regularization between the L1 (Lasso) and L2 (Ridge) penalties. A value of 1 for alpha represents Lasso regression, a value of 0 produces Ridge regression, and anything in between specifies the amount of mixing between the two. Default value of alpha is 0 when SOLVER = 'LBFGS'; 0.5 otherwise. 
lambda  Regularization strength 
lambda_search 

early_stopping 

nlambdas  Number of lambdas to be used in a search. Default indicates: If alpha is zero, with lambda search set to True, the value of nlamdas is set to 30 (fewer lambdas are needed for ridge regression) otherwise it is set to 100. Defaults to 1. 
standardize 

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

remove_collinear_columns 

splines_non_negative  Valid for Ispline (bs=2) only. True if the Isplines are monotonically increasing (and monotonically non decreasing) and False if the Isplines are monotonically decreasing (and monotonically nonincreasing). If specified, must be the same size as gam_columns. Values for other spline types will be ignored. Default to true. 
intercept 

non_negative 

max_iterations  Maximum number of iterations Defaults to 1. 
objective_epsilon  Converge if objective value changes less than this. Default indicates: If lambda_search is set to True the value of objective_epsilon is set to .0001. If the lambda_search is set to False and lambda is equal to zero, the value of objective_epsilon is set to .000001, for any other value of lambda the default value of objective_epsilon is set to .0001. Defaults to 1. 
beta_epsilon  Converge if beta changes less (using Linfinity norm) than beta esilon, ONLY applies to IRLSM solver Defaults to 0.0001. 
gradient_epsilon  Converge if objective changes less (using Linfinity norm) than this, ONLY applies to LBFGS solver. Default indicates: If lambda_search is set to False and lambda is equal to zero, the default value of gradient_epsilon is equal to .000001, otherwise the default value is .0001. If lambda_search is set to True, the conditional values above are 1E8 and 1E6 respectively. Defaults to 1. 
link  Link function. Must be one of: "family_default", "identity", "logit", "log", "inverse", "tweedie", "ologit". Defaults to family_default. 
startval  double array to initialize coefficients for GAM. 
prior  Prior probability for y==1. To be used only for logistic regression iff the data has been sampled and the mean of response does not reflect reality. Defaults to 1. 
cold_start 

lambda_min_ratio  Minimum lambda used in lambda search, specified as a ratio of lambda_max (the smallest lambda that drives all coefficients to zero). Default indicates: if the number of observations is greater than the number of variables, then lambda_min_ratio is set to 0.0001; if the number of observations is less than the number of variables, then lambda_min_ratio is set to 0.01. Defaults to 1. 
beta_constraints  Beta constraints 
max_active_predictors  Maximum number of active predictors during computation. Use as a stopping criterion to prevent expensive model building with many predictors. Default indicates: If the IRLSM solver is used, the value of max_active_predictors is set to 5000 otherwise it is set to 100000000. Defaults to 1. 
interactions  A list of predictor column indices to interact. All pairwise combinations will be computed for the list. 
interaction_pairs  A list of pairwise (first order) column interactions. 
obj_reg  Likelihood divider in objective value computation, default is 1/nobs Defaults to 1. 
export_checkpoints_dir  Automatically export generated models to this directory. 
stopping_rounds  Early stopping based on convergence of stopping_metric. Stop if simple moving average of length k of the stopping_metric does not improve for k:=stopping_rounds scoring events (0 to disable) Defaults to 0. 
stopping_metric  Metric to use for early stopping (AUTO: logloss for classification, deviance for regression and anomaly_score for Isolation Forest). Note that custom and custom_increasing can only be used in GBM and DRF with the Python client. Must be one of: "AUTO", "deviance", "logloss", "MSE", "RMSE", "MAE", "RMSLE", "AUC", "AUCPR", "lift_top_group", "misclassification", "mean_per_class_error", "custom", "custom_increasing". Defaults to AUTO. 
stopping_tolerance  Relative tolerance for metricbased stopping criterion (stop if relative improvement is not at least this much) Defaults to 0.001. 
balance_classes 

class_sampling_factors  Desired over/undersampling ratios per class (in lexicographic order). If not specified, sampling factors will be automatically computed to obtain class balance during training. Requires balance_classes. 
max_after_balance_size  Maximum relative size of the training data after balancing class counts (can be less than 1.0). Requires balance_classes. Defaults to 5.0. 
max_runtime_secs  Maximum allowed runtime in seconds for model training. Use 0 to disable. Defaults to 0. 
num_knots  Number of knots for gam predictors. If specified, must specify one for each gam predictor. For monotone Isplines, mininum = 2, for cs spline, minimum = 3. For thin plate, minimum is size of polynomial basis + 2. 
spline_orders  Order of Isplines or NBSplineTypeI Msplines used for gam predictors. If specified, must be the same size as gam_columns. For Isplines, the spline_orders will be the same as the polynomials used to generate the splines. For Msplines, the polynomials used to generate the splines will be spline_order1. Values for bs=0 or 1 will be ignored. 
knot_ids  Array storing frame keys of knots. One for each gam column set specified in gam_columns 
standardize_tp_gam_cols 

scale_tp_penalty_mat 

bs  Basis function type for each gam predictors, 0 for cr, 1 for thin plate regression with knots, 2 for monotone Isplines, 3 for NBSplineTypeI Msplines (refer to doc here: https://github.com/h2oai/h2o3/issues/6926). If specified, must be the same size as gam_columns 
scale  Smoothing parameter for gam predictors. If specified, must be of the same length as gam_columns 
keep_gam_cols 

store_knot_locations 

auc_type  Set default multinomial AUC type. Must be one of: "AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO", "WEIGHTED_OVO". Defaults to AUTO. 
gainslift_bins  Gains/Lift table number of bins. 0 means disabled.. Default value 1 means automatic binning. Defaults to 1. 
if (FALSE) { h2o.init() # Run GAM of CAPSULE ~ AGE + RACE + PSA + DCAPS prostate_path < system.file("extdata", "prostate.csv", package = "h2o") prostate < h2o.uploadFile(path = prostate_path) prostate$CAPSULE < as.factor(prostate$CAPSULE) h2o.gam(y = "CAPSULE", x = c("RACE"), gam_columns = c("PSA"), training_frame = prostate, family = "binomial") }