Using H2O package for Deep Learning (Neural Networks) in a Regression Problem

I'm working on a Regression Problem with Deep Learning (Neural Networks).

I'm seriously considering to use the package: H2O because it looks really good (instead of the neuralnet package).

I have been searching a lot but didn't find any example, that meets the following points:

  1. Uses H2O package.
  2. It is a regression Problem (predicting one numeric value).
  3. Uses Neural Networks (Deep Learning).
  4. It does the training of the Neural Networks.
  5. For a single observation (like simulating a future new value), it uses the trained model to predict the target numeric value for that observation (which contains the values for predictor variables).

Sincerely, I will provide a :heart: in your comment if you point me to an example that meets those points.

In my opinion, this is a very common use case, isn't it?


In my opinion a good starting point for modeling with h2o is using h2o.automl() function and then you can manually fine tune a final model. The general pattern for training a model with h2o is as follows



# Convert your dataframes to h2o objects
train <- as.h2o(train)
valid <- as.h2o(valid)
test <- as.h2o(test)

# Set variable names
y <- "dependent_variable"
x <- setdiff(names(train), y)

# Automatic model training
# You can force Deep Learning by excluding the other algorithms with exclude_algos parameter
models <- h2o.automl(x, y, 
                         training_frame = train, 
                         validation_frame = valid, 
                         leaderboard_frame = test,
                         stopping_metric = "deviance",
                         seed = 12345, 
                         exclude_algos = c("GLM", "DRF", "XGBoost", "GBM", "StackedEnsemble"))

# Chossing the best model (relative to the stopping metric)
best_model <- models@leader

# Prepare new data and forecasting
new_data <- as.h2o(new_data)
predictions <- h2o.predict(best_model, new_data)

After that you could fine tune your model replacing h2o.automl() with h2o.deeplearning() and manually setting the parameters.


Thank you @andresrcs, that helped!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.