if (FALSE) {
library(h2o)
library(h2otools) #for h2o.get_ids() function
library(autoEnsemble)
# initiate the H2O server to train a grid of models
h2o.init(ignore_config = TRUE, nthreads = 2, bind_to_localhost = FALSE, insecure = TRUE)
# Run a grid search or AutoML search
prostate_path <- system.file("extdata", "prostate.csv", package = "h2o")
prostate <- h2o.importFile(path = prostate_path, header = TRUE)
y <- "CAPSULE"
prostate[,y] <- as.factor(prostate[,y]) #convert to factor for classification
aml <- h2o.automl(y = y, training_frame = prostate, max_runtime_secs = 30,
seed = 2023, nfolds = 10, keep_cross_validation_predictions = TRUE)
# get the model IDs from the H2O Grid search or H2O AutoML Grid
ids <- h2otools::h2o.get_ids(aml)
# evaluate all the models and return a dataframe
evals <- evaluate(id = ids)
}
Run the code above in your browser using DataLab