h2o.deeplearning | R Documentation |
Builds a feed-forward multilayer artificial neural network on an H2OFrame.
h2o.deeplearning(
x,
y,
training_frame,
model_id = NULL,
validation_frame = NULL,
nfolds = 0,
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,
weights_column = NULL,
offset_column = NULL,
balance_classes = FALSE,
class_sampling_factors = NULL,
max_after_balance_size = 5,
checkpoint = NULL,
pretrained_autoencoder = NULL,
overwrite_with_best_model = TRUE,
use_all_factor_levels = TRUE,
standardize = TRUE,
activation = c("Tanh", "TanhWithDropout", "Rectifier", "RectifierWithDropout",
"Maxout", "MaxoutWithDropout"),
hidden = c(200, 200),
epochs = 10,
train_samples_per_iteration = -2,
target_ratio_comm_to_comp = 0.05,
seed = -1,
adaptive_rate = TRUE,
rho = 0.99,
epsilon = 1e-08,
rate = 0.005,
rate_annealing = 1e-06,
rate_decay = 1,
momentum_start = 0,
momentum_ramp = 1e+06,
momentum_stable = 0,
nesterov_accelerated_gradient = TRUE,
input_dropout_ratio = 0,
hidden_dropout_ratios = NULL,
l1 = 0,
l2 = 0,
max_w2 = 3.4028235e+38,
initial_weight_distribution = c("UniformAdaptive", "Uniform", "Normal"),
initial_weight_scale = 1,
initial_weights = NULL,
initial_biases = NULL,
loss = c("Automatic", "CrossEntropy", "Quadratic", "Huber", "Absolute", "Quantile"),
distribution = c("AUTO", "bernoulli", "multinomial", "gaussian", "poisson", "gamma",
"tweedie", "laplace", "quantile", "huber"),
quantile_alpha = 0.5,
tweedie_power = 1.5,
huber_alpha = 0.9,
score_interval = 5,
score_training_samples = 10000,
score_validation_samples = 0,
score_duty_cycle = 0.1,
classification_stop = 0,
regression_stop = 1e-06,
stopping_rounds = 5,
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,
max_runtime_secs = 0,
score_validation_sampling = c("Uniform", "Stratified"),
diagnostics = TRUE,
fast_mode = TRUE,
force_load_balance = TRUE,
variable_importances = TRUE,
replicate_training_data = TRUE,
single_node_mode = FALSE,
shuffle_training_data = FALSE,
missing_values_handling = c("MeanImputation", "Skip"),
quiet_mode = FALSE,
autoencoder = FALSE,
sparse = FALSE,
col_major = FALSE,
average_activation = 0,
sparsity_beta = 0,
max_categorical_features = 2147483647,
reproducible = FALSE,
export_weights_and_biases = FALSE,
mini_batch_size = 1,
categorical_encoding = c("AUTO", "Enum", "OneHotInternal", "OneHotExplicit", "Binary",
"Eigen", "LabelEncoder", "SortByResponse", "EnumLimited"),
elastic_averaging = FALSE,
elastic_averaging_moving_rate = 0.9,
elastic_averaging_regularization = 0.001,
export_checkpoints_dir = NULL,
auc_type = c("AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO", "WEIGHTED_OVO"),
custom_metric_func = NULL,
gainslift_bins = -1,
verbose = FALSE
)
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. |
model_id |
Destination id for this model; auto-generated if not specified. |
validation_frame |
Id of the validation data frame. |
nfolds |
Number of folds for K-fold cross-validation (0 to disable or >= 2). Defaults to 0. |
keep_cross_validation_models |
|
keep_cross_validation_predictions |
|
keep_cross_validation_fold_assignment |
|
fold_assignment |
Cross-validation 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 cross-validation fold index assignment per observation. |
ignore_const_cols |
|
score_each_iteration |
|
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. |
offset_column |
Offset column. This will be added to the combination of columns before applying the link function. |
balance_classes |
|
class_sampling_factors |
Desired over/under-sampling 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. |
checkpoint |
Model checkpoint to resume training with. |
pretrained_autoencoder |
Pretrained autoencoder model to initialize this model with. |
overwrite_with_best_model |
|
use_all_factor_levels |
|
standardize |
|
activation |
Activation function. Must be one of: "Tanh", "TanhWithDropout", "Rectifier", "RectifierWithDropout", "Maxout", "MaxoutWithDropout". Defaults to Rectifier. |
Hidden layer sizes (e.g. [100, 100]). Defaults to c(200, 200). | |
epochs |
How many times the dataset should be iterated (streamed), can be fractional. Defaults to 10. |
train_samples_per_iteration |
Number of training samples (globally) per MapReduce iteration. Special values are 0: one epoch, -1: all available data (e.g., replicated training data), -2: automatic. Defaults to -2. |
target_ratio_comm_to_comp |
Target ratio of communication overhead to computation. Only for multi-node operation and train_samples_per_iteration = -2 (auto-tuning). Defaults to 0.05. |
seed |
Seed for random numbers (affects certain parts of the algo that are stochastic and those might or might not be enabled by default). Note: only reproducible when running single threaded. Defaults to -1 (time-based random number). |
adaptive_rate |
|
rho |
Adaptive learning rate time decay factor (similarity to prior updates). Defaults to 0.99. |
epsilon |
Adaptive learning rate smoothing factor (to avoid divisions by zero and allow progress). Defaults to 1e-08. |
rate |
Learning rate (higher => less stable, lower => slower convergence). Defaults to 0.005. |
rate_annealing |
Learning rate annealing: rate / (1 + rate_annealing * samples). Defaults to 1e-06. |
rate_decay |
Learning rate decay factor between layers (N-th layer: rate * rate_decay ^ (n - 1). Defaults to 1. |
momentum_start |
Initial momentum at the beginning of training (try 0.5). Defaults to 0. |
momentum_ramp |
Number of training samples for which momentum increases. Defaults to 1000000. |
momentum_stable |
Final momentum after the ramp is over (try 0.99). Defaults to 0. |
nesterov_accelerated_gradient |
|
input_dropout_ratio |
Input layer dropout ratio (can improve generalization, try 0.1 or 0.2). Defaults to 0. |
Hidden layer dropout ratios (can improve generalization), specify one value per hidden layer, defaults to 0.5. | |
l1 |
L1 regularization (can add stability and improve generalization, causes many weights to become 0). Defaults to 0. |
l2 |
L2 regularization (can add stability and improve generalization, causes many weights to be small. Defaults to 0. |
max_w2 |
Constraint for squared sum of incoming weights per unit (e.g. for Rectifier). Defaults to 3.4028235e+38. |
initial_weight_distribution |
Initial weight distribution. Must be one of: "UniformAdaptive", "Uniform", "Normal". Defaults to UniformAdaptive. |
initial_weight_scale |
Uniform: -value...value, Normal: stddev. Defaults to 1. |
initial_weights |
A list of H2OFrame ids to initialize the weight matrices of this model with. |
initial_biases |
A list of H2OFrame ids to initialize the bias vectors of this model with. |
loss |
Loss function. Must be one of: "Automatic", "CrossEntropy", "Quadratic", "Huber", "Absolute", "Quantile". Defaults to Automatic. |
distribution |
Distribution function Must be one of: "AUTO", "bernoulli", "multinomial", "gaussian", "poisson", "gamma", "tweedie", "laplace", "quantile", "huber". Defaults to AUTO. |
quantile_alpha |
Desired quantile for Quantile regression, must be between 0 and 1. Defaults to 0.5. |
tweedie_power |
Tweedie power for Tweedie regression, must be between 1 and 2. Defaults to 1.5. |
huber_alpha |
Desired quantile for Huber/M-regression (threshold between quadratic and linear loss, must be between 0 and 1). Defaults to 0.9. |
score_interval |
Shortest time interval (in seconds) between model scoring. Defaults to 5. |
score_training_samples |
Number of training set samples for scoring (0 for all). Defaults to 10000. |
score_validation_samples |
Number of validation set samples for scoring (0 for all). Defaults to 0. |
score_duty_cycle |
Maximum duty cycle fraction for scoring (lower: more training, higher: more scoring). Defaults to 0.1. |
classification_stop |
Stopping criterion for classification error fraction on training data (-1 to disable). Defaults to 0. |
regression_stop |
Stopping criterion for regression error (MSE) on training data (-1 to disable). Defaults to 1e-06. |
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 5. |
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 metric-based stopping criterion (stop if relative improvement is not at least this much) Defaults to 0. |
max_runtime_secs |
Maximum allowed runtime in seconds for model training. Use 0 to disable. Defaults to 0. |
score_validation_sampling |
Method used to sample validation dataset for scoring. Must be one of: "Uniform", "Stratified". Defaults to Uniform. |
diagnostics |
|
fast_mode |
|
force_load_balance |
|
variable_importances |
|
replicate_training_data |
|
single_node_mode |
|
shuffle_training_data |
|
missing_values_handling |
Handling of missing values. Either MeanImputation or Skip. Must be one of: "MeanImputation", "Skip". Defaults to MeanImputation. |
quiet_mode |
|
autoencoder |
|
sparse |
|
col_major |
|
average_activation |
Average activation for sparse auto-encoder. #Experimental Defaults to 0. |
sparsity_beta |
Sparsity regularization. #Experimental Defaults to 0. |
max_categorical_features |
Max. number of categorical features, enforced via hashing. #Experimental Defaults to 2147483647. |
reproducible |
|
export_weights_and_biases |
|
mini_batch_size |
Mini-batch size (smaller leads to better fit, larger can speed up and generalize better). Defaults to 1. |
categorical_encoding |
Encoding scheme for categorical features Must be one of: "AUTO", "Enum", "OneHotInternal", "OneHotExplicit", "Binary", "Eigen", "LabelEncoder", "SortByResponse", "EnumLimited". Defaults to AUTO. |
elastic_averaging |
|
elastic_averaging_moving_rate |
Elastic averaging moving rate (only if elastic averaging is enabled). Defaults to 0.9. |
elastic_averaging_regularization |
Elastic averaging regularization strength (only if elastic averaging is enabled). Defaults to 0.001. |
export_checkpoints_dir |
Automatically export generated models to this directory. |
auc_type |
Set default multinomial AUC type. Must be one of: "AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO", "WEIGHTED_OVO". Defaults to AUTO. |
custom_metric_func |
Reference to custom evaluation function, format: 'language:keyName=funcName' |
gainslift_bins |
Gains/Lift table number of bins. 0 means disabled.. Default value -1 means automatic binning. Defaults to -1. |
verbose |
|
predict.H2OModel
for prediction
## Not run:
library(h2o)
h2o.init()
iris_hf <- as.h2o(iris)
iris_dl <- h2o.deeplearning(x = 1:4, y = 5, training_frame = iris_hf, seed=123456)
# now make a prediction
predictions <- h2o.predict(iris_dl, iris_hf)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.