save_gluonts_model: Saving and Loading GluonTS Models

Description Usage Arguments Examples

View source: R/core-save_and_load.R

Description

GluonTS 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_gluonts_model(object, path, overwrite = FALSE)

load_gluonts_model(path)

Arguments

object

A fitted model object

path

A directory to store the GluonTS model files

overwrite

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

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
## Not run: 
library(tidymodels)
library(tidyverse)
library(timetk)

model_fit <- nbeats(

    # User Defined (Required) Parameters
    id                    = "id",
    freq                  = "M",
    prediction_length     = 24,

    # Hyper Parameters
    epochs                = 1,
    num_batches_per_epoch = 4
) %>%
    set_engine("gluonts_nbeats") %>%
    fit(value ~ date + id, m750)

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

# Loads the model
load_gluonts_model(path = "/dir_nbeats_model/")


## End(Not run)

modeltime.gluonts documentation built on Jan. 8, 2021, 2:23 a.m.