save_h2o_model: Saving and Loading Modeltime H2O Models

Description Usage Arguments Value Examples

View source: R/core-save_and_load.R

Description

H2O AutoML models require a special storage process that saves / loads the recipe used to recreate a model to / from a directory that the user defines.

Usage

1
2
3
save_h2o_model(object, path, overwrite = FALSE)

load_h2o_model(path)

Arguments

object

A fitted model object

path

A directory to store the H2O AutoML model files

overwrite

Whether or not to allow overwriting a H2O AutoML model's directory. Default: FALSE.

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
library(tidymodels)
library(tidyverse)
library(timetk)
library(modeltime.h2o)

h2o.init()

model_fit <- automl_reg(mode = 'regression') %>%
    set_engine(
        engine                     = 'h2o',
        max_runtime_secs           = 30, 
        max_runtime_secs_per_model = 30,
        project_name               = 'project_01',
        nfolds                     = 5,
        max_models                 = 1000,
        exclude_algos              = c("DeepLearning"),
        seed                       =  786
    ) %>%
    fit(value ~ date + id, m750)

# Saves the related files needed to recreate the model
model_fit %>% save_h2o_model(path = "/dir_h2o_automl_model/")

# Loads the model
load_h2o_model(path = "/dir_h2o_automl_model/")

# Shutdown H2O when Finished. 
# Make sure to save any work before. 
h2o.shutdown(prompt = FALSE)


## End(Not run)

modeltime.h2o documentation built on April 5, 2021, 5:07 p.m.