agua enables users to fit, optimize, and evaluate models viaH2O using tidymodels syntax. Most users willnot have to use aqua directly; the features can be accessed via the newparsnip computational engine'h2o'.
There are two main components in agua:
New parsnip engine'h2o' for many models, seeGet startedfor a complete list.
Infrastructure for the tune package.
When fitting a parsnip model, the data are passed to the h2o serverdirectly. For tuning, the data are passed once and instructions aregiven toh2o.grid() to process them.
This work is based on
The CRAN version of the package can be installed via
install.packages("agua")You can also install the development version of agua using:
require(pak)pak::pak("tidymodels/agua")The following code demonstrates how to create a single model on theh2o server and how to make predictions.
library(tidymodels)library(agua)library(h2o)tidymodels_prefer()# Start the h2o server before running modelsh2o_start()# Demonstrate fitting parsnip models:# Specify the type of model and the h2o enginespec<-rand_forest(mtry =3,trees =1000)%>%set_engine("h2o")%>%set_mode("regression")# Fit the model on the h2o serverset.seed(1)mod<-fit(spec, mpg~ .,data = mtcars)mod#> parsnip model object#>#> Model Details:#> ==============#>#> H2ORegressionModel: drf#> Model ID: DRF_model_R_1656520956148_1#> Model Summary:#> number_of_trees number_of_internal_trees model_size_in_bytes min_depth#> 1 1000 1000 285914 4#> max_depth mean_depth min_leaves max_leaves mean_leaves#> 1 10 6.70600 10 27 18.04100#>#>#> H2ORegressionMetrics: drf#> ** Reported on training data. **#> ** Metrics reported on Out-Of-Bag training samples **#>#> MSE: 4.354249#> RMSE: 2.086684#> MAE: 1.657823#> RMSLE: 0.09848976#> Mean Residual Deviance : 4.354249# Predictionspredict(mod,head(mtcars))#> # A tibble: 6 × 1#> .pred#> <dbl>#> 1 20.9#> 2 20.8#> 3 23.3#> 4 20.4#> 5 17.9#> 6 18.7# When doneh2o_end()Before using the'h2o' engine, users need to runagua::h2o_start() orh2o::h2o.init() to startthe h2o server, which will be storing data, models, and other valuespassed from the R session.
There are several package vignettes including:
Please note that the agua project is released with aContributorCode of Conduct. By contributing to this project, you agree to abideby its terms.