There are two main components in agua:
New parsnip engine 'h2o'
for many models, see the vignette for a complete list.
Infrastructure for the tune package.
When fitting a parsnip model, the data are passed to the h2o server directly. For tuning, the data are passed once and instructions are given to h2o.grid()
to process them.
This work is based on @stevenpawley's h2oparsnip package. Additional work was done by Qiushi Yan for his 2022 summer internship at Posit.
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 the h2o server and how to make predictions.
knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE )
library(tidymodels) library(agua) # Start the h2o server before running models h2o_start() # Demonstrate fitting parsnip models: # Specify the type of model and the h2o engine spec <- rand_forest(mtry = 3, trees = 1000) %>% set_engine("h2o") %>% set_mode("regression") # Fit the model on the h2o server set.seed(1) mod <- fit(spec, mpg ~ ., data = mtcars) mod # Predictions predict(mod, head(mtcars)) # When done h2o_end()
Before using the 'h2o'
engine, users need to run agua::h2o_start()
or h2o::h2o.init()
to start the h2o server, which will be storing data, models, and other values passed from the R session.
There are several package vignettes including:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.